hexsha
stringlengths
40
40
size
int64
5
1.05M
ext
stringclasses
98 values
lang
stringclasses
21 values
max_stars_repo_path
stringlengths
3
945
max_stars_repo_name
stringlengths
4
118
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
10
max_stars_count
int64
1
368k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
945
max_issues_repo_name
stringlengths
4
118
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
10
max_issues_count
int64
1
134k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
945
max_forks_repo_name
stringlengths
4
135
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
10
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
5
1.05M
avg_line_length
float64
1
1.03M
max_line_length
int64
2
1.03M
alphanum_fraction
float64
0
1
c38c92556fc455a9104e20d37e5f0aac18f268af
29,475
rs
Rust
src/app/states.rs
GuillaumeGomez/bottom
398d52af2e6b001256adef71be8e7c85a943066c
[ "MIT" ]
null
null
null
src/app/states.rs
GuillaumeGomez/bottom
398d52af2e6b001256adef71be8e7c85a943066c
[ "MIT" ]
null
null
null
src/app/states.rs
GuillaumeGomez/bottom
398d52af2e6b001256adef71be8e7c85a943066c
[ "MIT" ]
null
null
null
use std::{collections::HashMap, time::Instant}; use unicode_segmentation::GraphemeCursor; use tui::widgets::TableState; use crate::{ app::{layout_manager::BottomWidgetType, query::*}, constants, data_harvester::processes::{self, ProcessSorting}, }; use ProcessSorting::*; #[derive(Debug)] pub enum ScrollDirection { // UP means scrolling up --- this usually DECREMENTS Up, // DOWN means scrolling down --- this usually INCREMENTS Down, } impl Default for ScrollDirection { fn default() -> Self { ScrollDirection::Down } } #[derive(Debug)] pub enum CursorDirection { Left, Right, } /// AppScrollWidgetState deals with fields for a scrollable app's current state. #[derive(Default)] pub struct AppScrollWidgetState { pub current_scroll_position: usize, pub previous_scroll_position: usize, pub scroll_direction: ScrollDirection, pub table_state: TableState, } #[derive(PartialEq)] pub enum KillSignal { Cancel, Kill(usize), } impl Default for KillSignal { #[cfg(target_family = "unix")] fn default() -> Self { KillSignal::Kill(15) } #[cfg(target_os = "windows")] fn default() -> Self { KillSignal::Kill(1) } } #[derive(Default)] pub struct AppDeleteDialogState { pub is_showing_dd: bool, pub selected_signal: KillSignal, /// tl x, tl y, br x, br y, index/signal pub button_positions: Vec<(u16, u16, u16, u16, usize)>, pub keyboard_signal_select: usize, pub last_number_press: Option<Instant>, pub scroll_pos: usize, } pub struct AppHelpDialogState { pub is_showing_help: bool, pub scroll_state: ParagraphScrollState, pub index_shortcuts: Vec<u16>, } impl Default for AppHelpDialogState { fn default() -> Self { AppHelpDialogState { is_showing_help: false, scroll_state: ParagraphScrollState::default(), index_shortcuts: vec![0; constants::HELP_TEXT.len()], } } } /// AppSearchState deals with generic searching (I might do this in the future). pub struct AppSearchState { pub is_enabled: bool, pub current_search_query: String, pub is_blank_search: bool, pub is_invalid_search: bool, pub grapheme_cursor: GraphemeCursor, pub cursor_direction: CursorDirection, pub cursor_bar: usize, /// This represents the position in terms of CHARACTERS, not graphemes pub char_cursor_position: usize, /// The query pub query: Option<Query>, pub error_message: Option<String>, } impl Default for AppSearchState { fn default() -> Self { AppSearchState { is_enabled: false, current_search_query: String::default(), is_invalid_search: false, is_blank_search: true, grapheme_cursor: GraphemeCursor::new(0, 0, true), cursor_direction: CursorDirection::Right, cursor_bar: 0, char_cursor_position: 0, query: None, error_message: None, } } } impl AppSearchState { /// Returns a reset but still enabled app search state pub fn reset(&mut self) { *self = AppSearchState { is_enabled: self.is_enabled, ..AppSearchState::default() } } pub fn is_invalid_or_blank_search(&self) -> bool { self.is_blank_search || self.is_invalid_search } } /// Meant for canvas operations involving table column widths. #[derive(Default)] pub struct CanvasTableWidthState { pub desired_column_widths: Vec<u16>, pub calculated_column_widths: Vec<u16>, } /// ProcessSearchState only deals with process' search's current settings and state. pub struct ProcessSearchState { pub search_state: AppSearchState, pub is_ignoring_case: bool, pub is_searching_whole_word: bool, pub is_searching_with_regex: bool, } impl Default for ProcessSearchState { fn default() -> Self { ProcessSearchState { search_state: AppSearchState::default(), is_ignoring_case: true, is_searching_whole_word: false, is_searching_with_regex: false, } } } impl ProcessSearchState { pub fn search_toggle_ignore_case(&mut self) { self.is_ignoring_case = !self.is_ignoring_case; } pub fn search_toggle_whole_word(&mut self) { self.is_searching_whole_word = !self.is_searching_whole_word; } pub fn search_toggle_regex(&mut self) { self.is_searching_with_regex = !self.is_searching_with_regex; } } pub struct ColumnInfo { pub enabled: bool, pub shortcut: Option<&'static str>, // FIXME: Move column width logic here! // pub hard_width: Option<u16>, // pub max_soft_width: Option<f64>, } pub struct ProcColumn { pub ordered_columns: Vec<ProcessSorting>, /// The y location of headers. Since they're all aligned, it's just one value. pub column_header_y_loc: Option<u16>, /// The x start and end bounds for each header. pub column_header_x_locs: Option<Vec<(u16, u16)>>, pub column_mapping: HashMap<ProcessSorting, ColumnInfo>, pub longest_header_len: u16, pub column_state: TableState, pub scroll_direction: ScrollDirection, pub current_scroll_position: usize, pub previous_scroll_position: usize, pub backup_prev_scroll_position: usize, } impl Default for ProcColumn { fn default() -> Self { let ordered_columns = vec![ Count, Pid, ProcessName, Command, CpuPercent, Mem, MemPercent, ReadPerSecond, WritePerSecond, TotalRead, TotalWrite, User, State, ]; let mut column_mapping = HashMap::new(); let mut longest_header_len = 0; for column in ordered_columns.clone() { longest_header_len = std::cmp::max(longest_header_len, column.to_string().len()); match column { CpuPercent => { column_mapping.insert( column, ColumnInfo { enabled: true, shortcut: Some("c"), // hard_width: None, // max_soft_width: None, }, ); } MemPercent => { column_mapping.insert( column, ColumnInfo { enabled: true, shortcut: Some("m"), // hard_width: None, // max_soft_width: None, }, ); } Mem => { column_mapping.insert( column, ColumnInfo { enabled: false, shortcut: Some("m"), // hard_width: None, // max_soft_width: None, }, ); } ProcessName => { column_mapping.insert( column, ColumnInfo { enabled: true, shortcut: Some("n"), // hard_width: None, // max_soft_width: None, }, ); } Command => { column_mapping.insert( column, ColumnInfo { enabled: false, shortcut: Some("n"), // hard_width: None, // max_soft_width: None, }, ); } Pid => { column_mapping.insert( column, ColumnInfo { enabled: true, shortcut: Some("p"), // hard_width: None, // max_soft_width: None, }, ); } Count => { column_mapping.insert( column, ColumnInfo { enabled: false, shortcut: None, // hard_width: None, // max_soft_width: None, }, ); } User => { column_mapping.insert( column, ColumnInfo { enabled: cfg!(target_family = "unix"), shortcut: None, }, ); } _ => { column_mapping.insert( column, ColumnInfo { enabled: true, shortcut: None, // hard_width: None, // max_soft_width: None, }, ); } } } let longest_header_len = longest_header_len as u16; ProcColumn { ordered_columns, column_mapping, longest_header_len, column_state: TableState::default(), scroll_direction: ScrollDirection::default(), current_scroll_position: 0, previous_scroll_position: 0, backup_prev_scroll_position: 0, column_header_y_loc: None, column_header_x_locs: None, } } } impl ProcColumn { /// Returns its new status. pub fn toggle(&mut self, column: &ProcessSorting) -> Option<bool> { if let Some(mapping) = self.column_mapping.get_mut(column) { mapping.enabled = !(mapping.enabled); Some(mapping.enabled) } else { None } } pub fn try_set(&mut self, column: &ProcessSorting, setting: bool) -> Option<bool> { if let Some(mapping) = self.column_mapping.get_mut(column) { mapping.enabled = setting; Some(mapping.enabled) } else { None } } pub fn try_enable(&mut self, column: &ProcessSorting) -> Option<bool> { if let Some(mapping) = self.column_mapping.get_mut(column) { mapping.enabled = true; Some(mapping.enabled) } else { None } } pub fn try_disable(&mut self, column: &ProcessSorting) -> Option<bool> { if let Some(mapping) = self.column_mapping.get_mut(column) { mapping.enabled = false; Some(mapping.enabled) } else { None } } pub fn is_enabled(&self, column: &ProcessSorting) -> bool { if let Some(mapping) = self.column_mapping.get(column) { mapping.enabled } else { false } } pub fn get_enabled_columns_len(&self) -> usize { self.ordered_columns .iter() .filter_map(|column_type| { if let Some(col_map) = self.column_mapping.get(column_type) { if col_map.enabled { Some(1) } else { None } } else { None } }) .sum() } /// NOTE: ALWAYS call this when opening the sorted window. pub fn set_to_sorted_index_from_type(&mut self, proc_sorting_type: &ProcessSorting) { // TODO [Custom Columns]: If we add custom columns, this may be needed! Since column indices will change, this runs the risk of OOB. So, when you change columns, CALL THIS AND ADAPT! let mut true_index = 0; for column in &self.ordered_columns { if *column == *proc_sorting_type { break; } if self.column_mapping.get(column).unwrap().enabled { true_index += 1; } } self.current_scroll_position = true_index; self.backup_prev_scroll_position = self.previous_scroll_position; } /// This function sets the scroll position based on the index. pub fn set_to_sorted_index_from_visual_index(&mut self, visual_index: usize) { self.current_scroll_position = visual_index; self.backup_prev_scroll_position = self.previous_scroll_position; } pub fn get_column_headers( &self, proc_sorting_type: &ProcessSorting, sort_reverse: bool, ) -> Vec<String> { const DOWN_ARROW: char = '▼'; const UP_ARROW: char = '▲'; // TODO: Gonna have to figure out how to do left/right GUI notation if we add it. self.ordered_columns .iter() .filter_map(|column_type| { let mapping = self.column_mapping.get(column_type).unwrap(); let mut command_str = String::default(); if let Some(command) = mapping.shortcut { command_str = format!("({})", command); } if mapping.enabled { Some(format!( "{}{}{}", column_type, command_str, if proc_sorting_type == column_type { if sort_reverse { DOWN_ARROW } else { UP_ARROW } } else { ' ' } )) } else { None } }) .collect() } } pub struct ProcWidgetState { pub process_search_state: ProcessSearchState, pub is_grouped: bool, pub scroll_state: AppScrollWidgetState, pub process_sorting_type: processes::ProcessSorting, pub is_process_sort_descending: bool, pub is_using_command: bool, pub current_column_index: usize, pub is_sort_open: bool, pub columns: ProcColumn, pub is_tree_mode: bool, pub table_width_state: CanvasTableWidthState, pub requires_redraw: bool, } impl ProcWidgetState { pub fn init( is_case_sensitive: bool, is_match_whole_word: bool, is_use_regex: bool, is_grouped: bool, show_memory_as_values: bool, is_tree_mode: bool, is_using_command: bool, ) -> Self { let mut process_search_state = ProcessSearchState::default(); if is_case_sensitive { // By default it's off process_search_state.search_toggle_ignore_case(); } if is_match_whole_word { process_search_state.search_toggle_whole_word(); } if is_use_regex { process_search_state.search_toggle_regex(); } let (process_sorting_type, is_process_sort_descending) = if is_tree_mode { (processes::ProcessSorting::Pid, false) } else { (processes::ProcessSorting::CpuPercent, true) }; // TODO: If we add customizable columns, this should pull from config let mut columns = ProcColumn::default(); columns.set_to_sorted_index_from_type(&process_sorting_type); if is_grouped { // Normally defaults to showing by PID, toggle count on instead. columns.toggle(&ProcessSorting::Count); columns.toggle(&ProcessSorting::Pid); } if show_memory_as_values { // Normally defaults to showing by percent, toggle value on instead. columns.toggle(&ProcessSorting::Mem); columns.toggle(&ProcessSorting::MemPercent); } if is_using_command { columns.toggle(&ProcessSorting::ProcessName); columns.toggle(&ProcessSorting::Command); } ProcWidgetState { process_search_state, is_grouped, scroll_state: AppScrollWidgetState::default(), process_sorting_type, is_process_sort_descending, is_using_command, current_column_index: 0, is_sort_open: false, columns, is_tree_mode, table_width_state: CanvasTableWidthState::default(), requires_redraw: false, } } /// Updates sorting when using the column list. /// ...this really should be part of the ProcColumn struct (along with the sorting fields), /// but I'm too lazy. /// /// Sorry, future me, you're gonna have to refactor this later. Too busy getting /// the feature to work in the first place! :) pub fn update_sorting_with_columns(&mut self) { let mut true_index = 0; let mut enabled_index = 0; let target_itx = self.columns.current_scroll_position; for column in &self.columns.ordered_columns { let enabled = self.columns.column_mapping.get(column).unwrap().enabled; if enabled_index == target_itx && enabled { break; } if enabled { enabled_index += 1; } true_index += 1; } if let Some(new_sort_type) = self.columns.ordered_columns.get(true_index) { if *new_sort_type == self.process_sorting_type { // Just reverse the search if we're reselecting! self.is_process_sort_descending = !(self.is_process_sort_descending); } else { self.process_sorting_type = new_sort_type.clone(); match self.process_sorting_type { ProcessSorting::State | ProcessSorting::Pid | ProcessSorting::ProcessName | ProcessSorting::Command => { // Also invert anything that uses alphabetical sorting by default. self.is_process_sort_descending = false; } _ => { self.is_process_sort_descending = true; } } } } } pub fn toggle_command_and_name(&mut self, is_using_command: bool) { if let Some(pn) = self .columns .column_mapping .get_mut(&ProcessSorting::ProcessName) { pn.enabled = !is_using_command; } if let Some(c) = self .columns .column_mapping .get_mut(&ProcessSorting::Command) { c.enabled = is_using_command; } } pub fn get_search_cursor_position(&self) -> usize { self.process_search_state .search_state .grapheme_cursor .cur_cursor() } pub fn get_char_cursor_position(&self) -> usize { self.process_search_state.search_state.char_cursor_position } pub fn is_search_enabled(&self) -> bool { self.process_search_state.search_state.is_enabled } pub fn get_current_search_query(&self) -> &String { &self.process_search_state.search_state.current_search_query } pub fn update_query(&mut self) { if self .process_search_state .search_state .current_search_query .is_empty() { self.process_search_state.search_state.is_blank_search = true; self.process_search_state.search_state.is_invalid_search = false; self.process_search_state.search_state.error_message = None; } else { let parsed_query = self.parse_query(); // debug!("Parsed query: {:#?}", parsed_query); if let Ok(parsed_query) = parsed_query { self.process_search_state.search_state.query = Some(parsed_query); self.process_search_state.search_state.is_blank_search = false; self.process_search_state.search_state.is_invalid_search = false; self.process_search_state.search_state.error_message = None; } else if let Err(err) = parsed_query { self.process_search_state.search_state.is_blank_search = false; self.process_search_state.search_state.is_invalid_search = true; self.process_search_state.search_state.error_message = Some(err.to_string()); } } self.scroll_state.previous_scroll_position = 0; self.scroll_state.current_scroll_position = 0; } pub fn clear_search(&mut self) { self.process_search_state.search_state.reset(); } pub fn search_walk_forward(&mut self, start_position: usize) { self.process_search_state .search_state .grapheme_cursor .next_boundary( &self.process_search_state.search_state.current_search_query[start_position..], start_position, ) .unwrap(); } pub fn search_walk_back(&mut self, start_position: usize) { self.process_search_state .search_state .grapheme_cursor .prev_boundary( &self.process_search_state.search_state.current_search_query[..start_position], 0, ) .unwrap(); } } pub struct ProcState { pub widget_states: HashMap<u64, ProcWidgetState>, pub force_update: Option<u64>, pub force_update_all: bool, } impl ProcState { pub fn init(widget_states: HashMap<u64, ProcWidgetState>) -> Self { ProcState { widget_states, force_update: None, force_update_all: false, } } pub fn get_mut_widget_state(&mut self, widget_id: u64) -> Option<&mut ProcWidgetState> { self.widget_states.get_mut(&widget_id) } pub fn get_widget_state(&self, widget_id: u64) -> Option<&ProcWidgetState> { self.widget_states.get(&widget_id) } } pub struct NetWidgetState { pub current_display_time: u64, pub autohide_timer: Option<Instant>, // pub draw_max_range_cache: f64, // pub draw_labels_cache: Vec<String>, // pub draw_time_start_cache: f64, // TODO: Re-enable these when we move net details state-side! // pub unit_type: DataUnitTypes, // pub scale_type: AxisScaling, } impl NetWidgetState { pub fn init( current_display_time: u64, autohide_timer: Option<Instant>, // unit_type: DataUnitTypes, // scale_type: AxisScaling, ) -> Self { NetWidgetState { current_display_time, autohide_timer, // draw_max_range_cache: 0.0, // draw_labels_cache: vec![], // draw_time_start_cache: 0.0, // unit_type, // scale_type, } } } pub struct NetState { pub force_update: Option<u64>, pub widget_states: HashMap<u64, NetWidgetState>, } impl NetState { pub fn init(widget_states: HashMap<u64, NetWidgetState>) -> Self { NetState { force_update: None, widget_states, } } pub fn get_mut_widget_state(&mut self, widget_id: u64) -> Option<&mut NetWidgetState> { self.widget_states.get_mut(&widget_id) } pub fn get_widget_state(&self, widget_id: u64) -> Option<&NetWidgetState> { self.widget_states.get(&widget_id) } } pub struct CpuWidgetState { pub current_display_time: u64, pub is_legend_hidden: bool, pub autohide_timer: Option<Instant>, pub scroll_state: AppScrollWidgetState, pub is_multi_graph_mode: bool, pub table_width_state: CanvasTableWidthState, } impl CpuWidgetState { pub fn init(current_display_time: u64, autohide_timer: Option<Instant>) -> Self { CpuWidgetState { current_display_time, is_legend_hidden: false, autohide_timer, scroll_state: AppScrollWidgetState::default(), is_multi_graph_mode: false, table_width_state: CanvasTableWidthState::default(), } } } pub struct CpuState { pub force_update: Option<u64>, pub widget_states: HashMap<u64, CpuWidgetState>, } impl CpuState { pub fn init(widget_states: HashMap<u64, CpuWidgetState>) -> Self { CpuState { force_update: None, widget_states, } } pub fn get_mut_widget_state(&mut self, widget_id: u64) -> Option<&mut CpuWidgetState> { self.widget_states.get_mut(&widget_id) } pub fn get_widget_state(&self, widget_id: u64) -> Option<&CpuWidgetState> { self.widget_states.get(&widget_id) } } pub struct MemWidgetState { pub current_display_time: u64, pub autohide_timer: Option<Instant>, } impl MemWidgetState { pub fn init(current_display_time: u64, autohide_timer: Option<Instant>) -> Self { MemWidgetState { current_display_time, autohide_timer, } } } pub struct MemState { pub force_update: Option<u64>, pub widget_states: HashMap<u64, MemWidgetState>, } impl MemState { pub fn init(widget_states: HashMap<u64, MemWidgetState>) -> Self { MemState { force_update: None, widget_states, } } pub fn get_mut_widget_state(&mut self, widget_id: u64) -> Option<&mut MemWidgetState> { self.widget_states.get_mut(&widget_id) } pub fn get_widget_state(&self, widget_id: u64) -> Option<&MemWidgetState> { self.widget_states.get(&widget_id) } } pub struct TempWidgetState { pub scroll_state: AppScrollWidgetState, pub table_width_state: CanvasTableWidthState, } impl TempWidgetState { pub fn init() -> Self { TempWidgetState { scroll_state: AppScrollWidgetState::default(), table_width_state: CanvasTableWidthState::default(), } } } pub struct TempState { pub widget_states: HashMap<u64, TempWidgetState>, } impl TempState { pub fn init(widget_states: HashMap<u64, TempWidgetState>) -> Self { TempState { widget_states } } pub fn get_mut_widget_state(&mut self, widget_id: u64) -> Option<&mut TempWidgetState> { self.widget_states.get_mut(&widget_id) } pub fn get_widget_state(&self, widget_id: u64) -> Option<&TempWidgetState> { self.widget_states.get(&widget_id) } } pub struct DiskWidgetState { pub scroll_state: AppScrollWidgetState, pub table_width_state: CanvasTableWidthState, } impl DiskWidgetState { pub fn init() -> Self { DiskWidgetState { scroll_state: AppScrollWidgetState::default(), table_width_state: CanvasTableWidthState::default(), } } } pub struct DiskState { pub widget_states: HashMap<u64, DiskWidgetState>, } impl DiskState { pub fn init(widget_states: HashMap<u64, DiskWidgetState>) -> Self { DiskState { widget_states } } pub fn get_mut_widget_state(&mut self, widget_id: u64) -> Option<&mut DiskWidgetState> { self.widget_states.get_mut(&widget_id) } pub fn get_widget_state(&self, widget_id: u64) -> Option<&DiskWidgetState> { self.widget_states.get(&widget_id) } } pub struct BasicTableWidgetState { // Since this is intended (currently) to only be used for ONE widget, that's // how it's going to be written. If we want to allow for multiple of these, // then we can expand outwards with a normal BasicTableState and a hashmap pub currently_displayed_widget_type: BottomWidgetType, pub currently_displayed_widget_id: u64, pub widget_id: i64, pub left_tlc: Option<(u16, u16)>, pub left_brc: Option<(u16, u16)>, pub right_tlc: Option<(u16, u16)>, pub right_brc: Option<(u16, u16)>, } #[derive(Default)] pub struct BatteryWidgetState { pub currently_selected_battery_index: usize, pub tab_click_locs: Option<Vec<((u16, u16), (u16, u16))>>, } pub struct BatteryState { pub widget_states: HashMap<u64, BatteryWidgetState>, } impl BatteryState { pub fn init(widget_states: HashMap<u64, BatteryWidgetState>) -> Self { BatteryState { widget_states } } pub fn get_mut_widget_state(&mut self, widget_id: u64) -> Option<&mut BatteryWidgetState> { self.widget_states.get_mut(&widget_id) } pub fn get_widget_state(&self, widget_id: u64) -> Option<&BatteryWidgetState> { self.widget_states.get(&widget_id) } } #[derive(Default)] pub struct ParagraphScrollState { pub current_scroll_index: u16, pub max_scroll_index: u16, } #[derive(Default)] pub struct ConfigState { pub current_category_index: usize, pub category_list: Vec<ConfigCategory>, } #[derive(Default)] pub struct ConfigCategory { pub category_name: &'static str, pub options_list: Vec<ConfigOption>, } pub struct ConfigOption { pub set_function: Box<dyn Fn() -> anyhow::Result<()>>, }
31.190476
192
0.56916
b2dc609945782154da069152ac5405f35cce2d2b
25
py
Python
SWSIdentity/Controllers/__init__.py
vanzhiganov/identity
90936482cc23251ba06121658e6a0a9251e30b3b
[ "Apache-2.0" ]
1
2018-03-26T21:18:52.000Z
2018-03-26T21:18:52.000Z
SWSIdentity/Controllers/__init__.py
vanzhiganov/identity
90936482cc23251ba06121658e6a0a9251e30b3b
[ "Apache-2.0" ]
null
null
null
SWSIdentity/Controllers/__init__.py
vanzhiganov/identity
90936482cc23251ba06121658e6a0a9251e30b3b
[ "Apache-2.0" ]
null
null
null
__all__ = [ 'Users' ]
8.333333
11
0.48
9bd7efdd2505312e91c27fc71b3ed5a5555a0741
2,068
js
JavaScript
offroad/js/store/updater/actions.js
berno22/openpilot-apks
52dfd61552e4a80702890ba1386ad01bf86fd462
[ "MIT" ]
4
2020-07-22T10:53:11.000Z
2021-04-08T14:32:41.000Z
offroad/js/store/updater/actions.js
berno22/openpilot-apks
52dfd61552e4a80702890ba1386ad01bf86fd462
[ "MIT" ]
5
2020-02-03T06:19:54.000Z
2020-05-07T23:40:26.000Z
offroad/js/store/updater/actions.js
berno22/openpilot-apks
52dfd61552e4a80702890ba1386ad01bf86fd462
[ "MIT" ]
15
2020-01-31T08:14:16.000Z
2020-05-05T17:39:20.000Z
import { NavigationActions } from 'react-navigation'; import { resetToLaunch } from '../nav/actions'; import ChffrPlus from '../../native/ChffrPlus'; import Logging from '../../native/Logging'; import { Params } from '../../config'; export const ACTION_UPDATE_CHECKED = 'ACTION_UPDATE_CHECKED'; export const ACTION_UPDATE_PROMPTED = 'ACTION_UPDATE_PROMPTED'; const PROMPT_INTERVAL_MILLIS = 86400 * 1000; // 1 day export const didCheckUpdate = (isUpdateAvailable) => { return async (dispatch, getState) => { let releaseNotes = ''; if (isUpdateAvailable) { try { const { gitBranch } = await ChffrPlus.getGitVersion(); const isPassive = (await ChffrPlus.readParam(Params.KEY_IS_PASSIVE)) === "1"; const base = isPassive ? 'chffrplus' : 'openpilot'; const releasesUrl = `https://raw.githubusercontent.com/commaai/${base}/${gitBranch}/RELEASES.md`; const resp = await fetch(releasesUrl); const releasesMd = await resp.text(); const firstBlockEndIdx = releasesMd.indexOf('\n\n'); if (firstBlockEndIdx !== -1) { releaseNotes = releasesMd.substring(0, firstBlockEndIdx); } } catch(err) { Logging.cloudLog('Could not get release notes', { err: err.toString() }) } } dispatch({ type: ACTION_UPDATE_CHECKED, isUpdateAvailable, releaseNotes, }); const { lastUpdatePromptMillis } = getState().updater; const shouldShowUpdatePrompt = ( isUpdateAvailable && (Date.now() - lastUpdatePromptMillis) > PROMPT_INTERVAL_MILLIS ); if (shouldShowUpdatePrompt) { dispatch({ type: ACTION_UPDATE_PROMPTED }); dispatch(NavigationActions.navigate({ routeName: 'UpdatePrompt' })); } } } export const dismissUpdatePrompt = () => { return dispatch => { dispatch(resetToLaunch()); } };
35.050847
113
0.59236
15bd4f3e467957c3df3e573882c990370613e873
1,005
rb
Ruby
hello.rb
joycedelatorre/SWPM
eabaae832941301072b5af1938bfbee9bdabb132
[ "MIT" ]
null
null
null
hello.rb
joycedelatorre/SWPM
eabaae832941301072b5af1938bfbee9bdabb132
[ "MIT" ]
null
null
null
hello.rb
joycedelatorre/SWPM
eabaae832941301072b5af1938bfbee9bdabb132
[ "MIT" ]
null
null
null
puts "Hello World" require 'open-uri' require 'httparty' require 'json' $pictures=[] def take_picture(num_to_take, num_sleep) picture_container = [] num_of_pictures = 0 while num_of_pictures < num_to_take @urlstring_to_post = 'http://10.0.0.1:10000/sony/camera' @result = HTTParty.post(@urlstring_to_post.to_str, :body => { :method => 'actTakePicture', :params => [], :id => 1, :version => '1.0' }.to_json, :headers => { 'Content-Type' => 'application/json' } ) num_of_pictures += 1 picture_container << @result["result"][0][0] sleep(num_sleep) #clean picture_container. end $pictures << picture_container end take_picture(2,0) def download_pics() $pictures[0].each do |pic| filename_pic = pic.slice(/\bpict\d*\_\d*\.[A-Z]*/) open("pictures/" + filename_pic, 'wb') do |file| file << open(pic).read # p file end end end download_pics()
23.928571
62
0.58806
993f0fc6cc47d894128876f54bc4401fe2737f5e
657
h
C
aws-cpp-sdk-workspaces/include/aws/workspaces/model/ReconnectEnum.h
Neusoft-Technology-Solutions/aws-sdk-cpp
88c041828b0dbee18a297c3cfe98c5ecd0706d0b
[ "Apache-2.0" ]
1
2022-02-12T08:09:30.000Z
2022-02-12T08:09:30.000Z
aws-cpp-sdk-workspaces/include/aws/workspaces/model/ReconnectEnum.h
Neusoft-Technology-Solutions/aws-sdk-cpp
88c041828b0dbee18a297c3cfe98c5ecd0706d0b
[ "Apache-2.0" ]
1
2022-01-03T23:59:37.000Z
2022-01-03T23:59:37.000Z
aws-cpp-sdk-workspaces/include/aws/workspaces/model/ReconnectEnum.h
ravindra-wagh/aws-sdk-cpp
7d5ff01b3c3b872f31ca98fb4ce868cd01e97696
[ "Apache-2.0" ]
1
2021-11-09T11:58:03.000Z
2021-11-09T11:58:03.000Z
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/workspaces/WorkSpaces_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> namespace Aws { namespace WorkSpaces { namespace Model { enum class ReconnectEnum { NOT_SET, ENABLED, DISABLED }; namespace ReconnectEnumMapper { AWS_WORKSPACES_API ReconnectEnum GetReconnectEnumForName(const Aws::String& name); AWS_WORKSPACES_API Aws::String GetNameForReconnectEnum(ReconnectEnum value); } // namespace ReconnectEnumMapper } // namespace Model } // namespace WorkSpaces } // namespace Aws
20.53125
82
0.759513
5fa6c02ef416ffb10b2b4b0c1a86f24c13a92f44
1,581
css
CSS
public/css/st_sample.css
jimmy210792/Jayaam
ecb9997fc48fc1d45216f609f699346b0d0f9138
[ "MIT" ]
null
null
null
public/css/st_sample.css
jimmy210792/Jayaam
ecb9997fc48fc1d45216f609f699346b0d0f9138
[ "MIT" ]
null
null
null
public/css/st_sample.css
jimmy210792/Jayaam
ecb9997fc48fc1d45216f609f699346b0d0f9138
[ "MIT" ]
null
null
null
body { font-family: 'Roboto Condensed', sans-serif; } h1 { text-align: center; background-color: #FEFFED; height: 70px; color: rgb(95, 89, 89); margin: 0 0 -29px 0; padding-top: 14px; border-radius: 10px 10px 0 0; font-size: 35px; } .main { position: absolute; top: 50px; left: 20%; width: 450px; height:530px; border: 2px solid gray; border-radius: 10px; } .main label{ color: rgba(0, 0, 0, 0.71); margin-left: 60px; } #image_preview{ position: absolute; font-size: 30px; top: 100px; left: 100px; width: 250px; height: 230px; text-align: center; line-height: 180px; font-weight: bold; color: #C0C0C0; background-color: #FFFFFF; overflow: auto; } #selectImage{ padding: 19px 21px 14px 15px; position: absolute; bottom: 0px; width: 414px; background-color: #FEFFED; border-radius: 10px; } .submit{ font-size: 16px; background: linear-gradient(#ffbc00 5%, #ffdd7f 100%); border: 1px solid #e5a900; color: #4E4D4B; font-weight: bold; cursor: pointer; width: 300px; border-radius: 5px; padding: 10px 0; outline: none; margin-top: 20px; margin-left: 15%; } .submit:hover{ background: linear-gradient(#ffdd7f 5%, #ffbc00 100%); } #file { color: red; padding: 5px; border: 5px solid #8BF1B0; background-color: #8BF1B0; margin-top: 10px; border-radius: 5px; box-shadow: 0 0 15px #626F7E; margin-left: 15%; width: 72%; } #message{ position:absolute; top:120px; left:815px; } #success { color:green; } #invalid { color:red; } #line { margin-top: 274px; } #error { color:red; } #error_message { color:blue; } #loading { display:none; position:absolute; top:50px; left:850px; font-size:25px; }
14.372727
54
0.707147
9e0932e759006fabae25a32e0f5eb1755ddedeee
16,073
lua
Lua
lua/kakoge/panels/cropper_strip.lua
Cryotheus/kakoge
5f3e9c6d3dbe6f372bf2622b161b36c68d957c0c
[ "MIT" ]
null
null
null
lua/kakoge/panels/cropper_strip.lua
Cryotheus/kakoge
5f3e9c6d3dbe6f372bf2622b161b36c68d957c0c
[ "MIT" ]
null
null
null
lua/kakoge/panels/cropper_strip.lua
Cryotheus/kakoge
5f3e9c6d3dbe6f372bf2622b161b36c68d957c0c
[ "MIT" ]
null
null
null
local PANEL = {} --accessor functions AccessorFunc(PANEL, "Font", "Font", FORCE_STRING) AccessorFunc(PANEL, "MinimumCropSize", "MinimumCropSize", FORCE_NUMBER) --local functions local function get_power(result) return math.ceil(math.log(result, 2)) end --post function setup if not KAKOGE.CropperFontMade then surface.CreateFont("KakogeCropper", { antialias = false, name = "Consolas", size = 16, weight = 500 }) KAKOGE.CropperFontMade = true end --panel functions function PANEL:Annotate(x, y, width, height, fractional, z_position) local annotation = vgui.Create("KakogeCropperAnnotation", self.AnnotationPanel) local z_position = z_position or self.ImageCount + 1 table.insert(self.Annotations, annotation) if fractional then annotation:SetFractionBounds(x, y, width, height, true) else local parent_width, parent_height = self:GetSize() annotation:SetFractionBounds(x / parent_width, y / parent_height, width / parent_width, height / parent_height, true) end annotation:SetFont("CloseCaption_BoldItalic") annotation:SetText("THUNDER!") annotation:SetTextColor(color_black) annotation:SetZPos(z_position) return annotation end function PANEL:AnnotateCrop(x_fraction, y_fraction, width_fraction, height_fraction, file_name) local annotation = self:Annotate(x_fraction, y_fraction, width_fraction, height_fraction, true) print(x_fraction, y_fraction, width_fraction, height_fraction, file_name) annotation:SetFont("DermaDefaultBold") annotation:SetText(file_name) return annotation end function PANEL:CalculateCrop(start_x, start_y, end_x, end_y) local maximum_x, maximum_y, minimum_x, minimum_y = self:CalculateMaxes(start_x, start_y, end_x, end_y) return maximum_x, maximum_y, minimum_x, minimum_y, math.min(maximum_x - minimum_x, self:GetWide(), 2 ^ get_power(ScrW())), math.min(maximum_y - minimum_y, self:GetTall(), 2 ^ get_power(ScrH())) end function PANEL:CalculateMaxes(start_x, start_y, end_x, end_y) local maximum_x, maximum_y = end_x, end_y local minimum_x, minimum_y = start_x, start_y if start_x > end_x then maximum_x = start_x minimum_x = end_x end if start_y > end_y then maximum_y = start_y minimum_y = end_y end return maximum_x, maximum_y, minimum_x, minimum_y end function PANEL:ClearAnnotations() self.AnnotationPanel:Clear() table.Empty(self.Annotations) end function PANEL:ClearImages() local images = self.Images self:ClearAnnotations() for index, image in ipairs(images) do image:Remove() images[index] = nil end end function PANEL:Crop(start_image, end_image, start_x, start_y, end_x, end_y, annotate) local maximum_x, maximum_y, minimum_x, minimum_y, drag_width, drag_height = self:CalculateCrop(start_x, start_y, end_x, end_y) --assertions if drag_width == 0 or drag_height == 0 then return self:RejectCrop(start_x, start_y, end_x, end_y, "zero sized crop", 2) elseif drag_width < self.MinimumCropSize or drag_height < self.MinimumCropSize then return self:RejectCrop(start_x, start_y, end_x, end_y, "undersized crop", 2) end local crop_images = {} local directory = self.Directory .. "crops/" local image_heights = {} local end_index, start_index = end_image:GetZPos(), start_image:GetZPos() local images = self.Images local maximum_width = self.MaximumWidth --flip start index should always be lower than end_index if start_index > end_index then end_index, start_index = start_index, end_index end --first pass to calculate end of the render target's size local width, height = self:GetSize() local scale = maximum_width / width local scale_width, scale_height = math.Round(drag_width * scale), math.Round(drag_height * scale) --because capture's size cannot exceede the frame buffer >:( if scale_width > 2 ^ get_power(ScrW()) or scale_height > 2 ^ get_power(ScrH()) then return self:RejectCrop(start_x, start_y, end_x, end_y, "oversized crop", 3) end local file_name = string.format("%u_%u_%u_%u.png", minimum_x, minimum_y, scale_width, scale_height) local power = get_power(math.max(scale_height, maximum_width)) local scale_x, scale_y = math.Round(minimum_x * scale), math.Round(minimum_y * scale) local y_offset = math.Round(images[start_index]:GetY() * scale) - scale_y local target_info = hook.Call("KakogeRenderTarget", KAKOGE, power, true, function() render.Clear(0, 0, 255, 255) render.Clear(0, 0, 255, 255, true, true) surface.SetDrawColor(0, 255, 0) surface.DrawRect(0, 0, 100, 100) --we make the capture's x and y the image's 0, 0 so we can fit more for index = start_index, end_index do local image = images[index] local image_height = maximum_width / image.ActualWidth * image.ActualHeight --DImage:PaintAt has scaling loss surface.SetDrawColor(255, 255, 255) surface.SetMaterial(image:GetMaterial()) surface.DrawTexturedRect(-scale_x, y_offset, maximum_width, image_height) y_offset = y_offset + image_height end --unfortunately this seems to return an empty or malformed string when beyond the frame buffer >:( --the frame buffer's ratio is sometimes be 2:1, but in normal play is 1:1 file.CreateDir(directory) file.Write(directory .. file_name, render.Capture{ alpha = false, format = "png", x = 0, y = 0, w = scale_width, h = scale_height }) end, MATERIAL_RT_DEPTH_NONE, IMAGE_FORMAT_RGB888) local debug_expires = RealTime() + 10 hook.Add("HUDPaint", "Kakoge", function() if RealTime() > debug_expires then hook.Remove("HUDPaint", "Kakoge") end surface.SetDrawColor(255, 255, 255) surface.SetMaterial(target_info.Material) surface.DrawTexturedRect(0, 0, 2 ^ power, 2 ^ power) end) if annotate then annotate = self:AnnotateCrop(minimum_x / width, minimum_y / height, drag_width / width, drag_height / height, string.StripExtension(file_name)) end self:OnCrop(scale_x, scale_y, scale_width, scale_height, annotate) return true end function PANEL:GetCropFromFile(file_name_stripped) local bounds = string.Split(file_name_stripped, "_") if #bounds ~= 4 then return end for index, value in ipairs(bounds) do bounds[index] = tonumber(value) end return unpack(bounds) end function PANEL:Init() self.Annotations = {} self.CropRejections = {} self.Font = "KakogeCropper" self.Images = {} self.Pressing = {} self.MinimumCropSize = 16 do --annotation panel local panel = vgui.Create("DPanel", self) panel.IndexingParent = self panel:SetPaintBackground(false) panel:SetMouseInputEnabled(false) panel:SetZPos(29999) function panel:PerformLayout(width, height) self.IndexingParent:PerformLayoutAnnotations(self, width, height) end self.AnnotationPanel = panel end do --overlay panel local panel = vgui.Create("DPanel", self) panel.IndexingParent = self panel:SetMouseInputEnabled(false) panel:SetZPos(30000) function panel:Paint(width, height) self.IndexingParent:PaintOverlay(self, width, height) end function panel:PerformLayout(width, height) self.IndexingParent:PerformLayoutOverlay(self, width, height) end self.OverlayPanel = panel end end function PANEL:OnCrop(scale_x, scale_y, scale_width, scale_height) end function PANEL:OnMousePressedImage(image, code) local pressing = self.Pressing local x, y = self:ScreenToLocal(gui.MouseX(), gui.MouseY()) pressing[code] = { Image = image, X = x, Y = y } end function PANEL:OnMouseReleasedImage(image, code) local pressing = self.Pressing local press_data = pressing[code] local x, y = self:ScreenToLocal(gui.MouseX(), gui.MouseY()) if press_data then self:OnMouseClickedImage(code, press_data.Image, image, press_data.X, press_data.Y, x, y) pressing[code] = nil end end function PANEL:OnMouseClickedImage(code, start_image, end_image, start_x, start_y, end_x, end_y) --crop wtih left click, but cancel with right click --probably will add a new mode in the furute if code == MOUSE_LEFT and not self.Pressing[MOUSE_RIGHT] then self:Crop(start_image, end_image, start_x, start_y, end_x, end_y, true) end end function PANEL:OnRemove() local directory = self.Directory local files = file.Find(directory .. "crops/*.png", "DATA") print(directory .. "crops/*.png") if files then local roster = {} PrintTable(files, 1) for index, file_name in ipairs(files) do local x, y, width, height = self:GetCropFromFile(string.StripExtension(file_name)) if x and y and width and height then table.insert(roster, file_name) end end PrintTable(roster, 1) if next(roster) then file.Write(directory .. "crops/roster.txt", table.concat(roster, "\n")) end end end function PANEL:PaintCrop(start_x, start_y, width, height) --right click means cancel, so turn white if they are cancelling local disco = self.Pressing[MOUSE_RIGHT] and color_white or HSVToColor(math.floor(RealTime() * 2) * 30, 0.7, 1) local font = self.Font local screen_end_x, screen_end_y = gui.MouseX(), gui.MouseY() local end_x, end_y = self:ScreenToLocal(screen_end_x, screen_end_y) local screen_start_x, screen_start_y = self:LocalToScreen(start_x, start_y) local maximum_x, maximum_y, minimum_x, minimum_y, drag_width, drag_height = self:CalculateCrop(start_x, start_y, end_x, end_y) local screen_minimum_x, screen_minimum_y = math.min(screen_end_x, screen_start_x), math.min(screen_end_y, screen_start_y) surface.SetDrawColor(0, 0, 0, 64) surface.DrawRect(minimum_x, minimum_y, drag_width, drag_height) surface.SetDrawColor(0, 0, 0, 255) surface.DrawOutlinedRect(minimum_x, minimum_y, drag_width, drag_height, 3) surface.SetDrawColor(disco) surface.DrawOutlinedRect(minimum_x + 1, minimum_y + 1, drag_width - 2, drag_height - 2, 1) --scissor rect bad! render.SetScissorRect(screen_minimum_x + 3, screen_minimum_y + 3, screen_minimum_x + drag_width - 3, screen_minimum_y + drag_height - 3, true) draw.SimpleTextOutlined(drag_width .. " width", font, minimum_x + drag_width - 4, minimum_y + 2, disco, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP, 1, color_black) draw.SimpleTextOutlined(drag_height .. " height", font, minimum_x + drag_width - 4, minimum_y + 16, disco, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP, 1, color_black) render.SetScissorRect(0, 0, 0, 0, false) end function PANEL:PaintOverlay(overlay_panel, width, height) local cropping = self.Pressing[MOUSE_LEFT] self:PaintRejects(width, height) if cropping then self:PaintCrop(cropping.X, cropping.Y, width, height) end end function PANEL:PaintRejects(width, height) local font = self.Font local real_time = RealTime() local rejection_index = 1 local rejections = self.CropRejections while rejection_index <= #rejections do local reject_data = rejections[rejection_index] local expires = reject_data.Expires if real_time > expires then table.remove(rejections, rejection_index) else local difference = expires - real_time local fraction = math.Clamp(difference, 0, 1) local fraction_510 = fraction * 510 local message = reject_data.Message local saturation = math.ceil(difference * 2) % 2 * 64 local x, y, width, height = reject_data.X, reject_data.Y, reject_data.Width, reject_data.Height surface.SetDrawColor(255, saturation, saturation, fraction * 192) surface.DrawRect(x, y, width, height) --a little bit hacky, but an alpha above 255 is treated as 255, so we can make this fade 0.5 seconds before the expiration by making it double 255 surface.SetDrawColor(0, 0, 0, fraction_510) surface.DrawOutlinedRect(x, y, width, height, 3) surface.SetDrawColor(255, saturation, saturation, fraction_510) surface.DrawOutlinedRect(x + 1, y + 1, width - 2, height - 2, 1) if message then local clipping = DisableClipping(true) local message_saturation = saturation + 32 draw.SimpleTextOutlined(message, font, x + width * 0.5, y + height * 0.5, Color(255, message_saturation, message_saturation, fraction_510), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0, 0, 0, fraction_510)) DisableClipping(clipping) end rejection_index = rejection_index + 1 end end end function PANEL:PerformLayout(width, height) local annotation_panel = self.AnnotationPanel local overlay = self.OverlayPanel --1 instead of 0, because I'm scared of dividing by 0... --never again, that sh*t is like a plague annotation_panel:SetTall(1) overlay:SetTall(1) for index, image in ipairs(self.Images) do local image_width = image:GetWide() image:SetCursor("crosshair") image:SetTall(width / image.ActualWidth * image.ActualHeight) end self:SizeToChildren(false, true) --now, resize! annotation_panel:SetSize(self:GetSize()) overlay:SetSize(self:GetSize()) end function PANEL:PerformLayoutAnnotations(annotation_parent, width, height) local annotation_parent = self.AnnotationPanel for index, annotation in ipairs(self.Annotations) do annotation:ScaleToPanel(annotation_parent, width, height) end end function PANEL:PerformLayoutOverlay(overlay, width, height) end function PANEL:RejectCrop(start_x, start_y, end_x, end_y, message, duration) local maximum_x, maximum_y, minimum_x, minimum_y, drag_width, drag_height = self:CalculateCrop(start_x, start_y, end_x, end_y) table.insert(self.CropRejections, { Expires = RealTime() + duration, Width = drag_width, Height = drag_height, Message = message, X = minimum_x, Y = minimum_y, }) return false, message end function PANEL:SetAnnotationsEditable(state) self.AnnotationPanel:SetMouseInputEnabled(state) end function PANEL:SetDirectory(directory) if not string.EndsWith(directory, "/") then directory = directory .. "/" end local files, folders = file.Find(directory .. "*", "DATA") local images = self.Images self.Directory = directory self:ClearImages() assert(files, "KakogeCropperStrip had an invalid directory set") for index, file_name in ipairs(files) do files[file_name] = index end for index, folder_name in ipairs(folders) do folders[folder_name] = index end --trustee generated roster if files["roster.txt"] then local total_height = 0 local maximum_width = 0 local image_count = 0 local image_names = string.Split(file.Read(directory .. "roster.txt", "DATA"), "\n") for index, image_name in ipairs(image_names) do local image = vgui.Create("KakogeCropperImage", self) image_count = image_count + 1 image.CropperStrip = self table.insert(images, image) image:Dock(TOP) image:SetMaterial("data/" .. directory .. image_name) image:SetZPos(index) maximum_width = math.max(maximum_width, image.ActualWidth) total_height = total_height + image.ActualHeight end self.TotalHeight = total_height self.MaximumWidth = maximum_width self.ImageCount = image_count self:InvalidateLayout(true) local parent_width, parent_height = maximum_width, total_height --we store our crops in a folder alongside its OCR data --easy way to store meta without having duplication: use the file's name! if folders.crops then local crop_files, crop_folders = file.Find(directory .. "crops/*", "DATA") for index, file_name in ipairs(crop_files) do crop_files[file_name] = index end for index, file_name in ipairs(crop_files) do local file_name_stripped = string.StripExtension(file_name) local x, y, width, height = self:GetCropFromFile(file_name_stripped) if x and y and width and height then local extension = string.GetExtensionFromFilename(file_name) if extension == "png" then self:AnnotateCrop(x / parent_width, y / parent_height, width / parent_width, height / parent_height, file_name_stripped) elseif extension == "txt" then --more! self:DescribeAnnotation(file_name_stripped) else print("bonus file: " .. file_name) end else print("malformed file in crops folder: " .. file_name_stripped, x, y, width, height) end end end end end function PANEL:SetFont(font) self.Font = font and tostring(font) or "KakogeCropper" end --post derma.DefineControl("KakogeCropperStrip", "", PANEL, "DSizeToContents")
33.837895
214
0.745225
18ec6a13ace86b5dbff85d26fc384b4096c79b66
2,052
css
CSS
WebApp/Styles/MarkupPanel.css
jsmeyers/GPV
86ac68ed135e2d4fa16d2fb83e22680093fea06c
[ "Apache-2.0" ]
null
null
null
WebApp/Styles/MarkupPanel.css
jsmeyers/GPV
86ac68ed135e2d4fa16d2fb83e22680093fea06c
[ "Apache-2.0" ]
null
null
null
WebApp/Styles/MarkupPanel.css
jsmeyers/GPV
86ac68ed135e2d4fa16d2fb83e22680093fea06c
[ "Apache-2.0" ]
null
null
null
/* Copyright 2012 Applied Geographics, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pnlMarkupContent { top: 40px; padding: 5px; } #pnlMarkupContent label { width: 27%; text-align: right; } #pnlMarkupContent label:nth-of-type(5){ width: 10%; } #chkMarkupLock{ margin-left:10px; } label#labMarkupLock { width: 9%; } #pnlMarkupContent .Input { width: 71%; margin-top: 1px; } #pnlMarkupContent button { margin: 2px; border-width: 1px; } .MarkupGroup.CommandLink { display: inline-block; text-align: center; color: #000000; } #chkTextGlow{ display: inline-block; margin: 8px 5px; } #cmdMarkupColor, #cmdTextGlowColor { position: relative; top: 2px; height: 16px; width: 16px; display: inline-block; } #btnMarkupColor, #btnTextGlowColor{ } #pnlMarkupGrid { top: 150px; border-top: solid 1px #b9b9b9; background-color: #F0F0F0; overflow: auto; } .ColorSelector { position: absolute; box-shadow: 0 1px 5px rgba(0,0,0,.65); -webkit-box-shadow: 0 1px 5px rgba(0,0,0,.65); -moz-box-shadow: 0 1px 5px rgba(0,0,0,.65); border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; } .MeasureText { left: 3px; top: 1px; font-family: Verdana, sans-serif; font-size: 11px; color: #404040; width: 200px; line-height: 13px; cursor: default; text-shadow: 0px 0px 4px white; } .MeasureText.Area2 { left: -100px; top: -13px; text-align: center; } .MeasureText.Area3 { left: -100px; top: -19px; text-align: center; }
18.321429
76
0.680799
b96b4a3b22d22dcf62f9c4f5109f781911322574
5,823
h
C
YLCleaner/Xcode-RuntimeHeaders/IDELogNavigator/IDEBotEditorTestDetailWrapperView.h
liyong03/YLCleaner
7453187a884c8e783bda1af82cbbb51655ec41c6
[ "MIT" ]
1
2019-02-15T02:16:35.000Z
2019-02-15T02:16:35.000Z
YLCleaner/Xcode-RuntimeHeaders/IDELogNavigator/IDEBotEditorTestDetailWrapperView.h
liyong03/YLCleaner
7453187a884c8e783bda1af82cbbb51655ec41c6
[ "MIT" ]
null
null
null
YLCleaner/Xcode-RuntimeHeaders/IDELogNavigator/IDEBotEditorTestDetailWrapperView.h
liyong03/YLCleaner
7453187a884c8e783bda1af82cbbb51655ec41c6
[ "MIT" ]
null
null
null
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "NSView.h" #import "NSTableViewDataSource-Protocol.h" #import "NSTableViewDelegate-Protocol.h" @class DVTBorderedView, IDEBotEditorTestDetailHeaderTableView, IDEBotEditorTestDetailResultsRowView, IDEBotEditorTestDetailResultsTableView, NSArray, NSArrayController, NSMutableArray, NSString; @interface IDEBotEditorTestDetailWrapperView : NSView <NSTableViewDataSource, NSTableViewDelegate> { BOOL _contentIsVisible; BOOL _dataSourceIsReady; NSArray *_runs; NSArrayController *_testTitlesController; id <IDEBotEditorTestDetailSelectionProtocol> _delegate; IDEBotEditorTestDetailResultsRowView *_detailsRowView; NSString *_selectedColumnIdentifier; long long _selectedRow; DVTBorderedView *_integrationTitleBV; DVTBorderedView *_integrationTVBV; DVTBorderedView *_testsFailedTitleBV; DVTBorderedView *_testsFailedTVBV; DVTBorderedView *_totalTitleBV; DVTBorderedView *_totalTVBV; DVTBorderedView *_testTitleTVBV; IDEBotEditorTestDetailHeaderTableView *_integrationTV; IDEBotEditorTestDetailHeaderTableView *_testsFailedTV; IDEBotEditorTestDetailHeaderTableView *_totalTV; IDEBotEditorTestDetailResultsTableView *_testTitleTV; IDEBotEditorTestDetailResultsTableView *_testDetailsTV; NSArray *_headerTableviews; NSArray *_contentTableviews; NSArrayController *_runsController; NSArray *_testTitles; NSMutableArray *_historyItems; double _contentColumnWidth; } + (id)selectionColor; @property(nonatomic) double contentColumnWidth; // @synthesize contentColumnWidth=_contentColumnWidth; @property(retain, nonatomic) NSMutableArray *historyItems; // @synthesize historyItems=_historyItems; @property(nonatomic) BOOL dataSourceIsReady; // @synthesize dataSourceIsReady=_dataSourceIsReady; @property(retain, nonatomic) NSArray *testTitles; // @synthesize testTitles=_testTitles; @property(retain, nonatomic) NSArrayController *runsController; // @synthesize runsController=_runsController; @property(retain, nonatomic) NSArray *contentTableviews; // @synthesize contentTableviews=_contentTableviews; @property(retain, nonatomic) NSArray *headerTableviews; // @synthesize headerTableviews=_headerTableviews; @property IDEBotEditorTestDetailResultsTableView *testDetailsTV; // @synthesize testDetailsTV=_testDetailsTV; @property IDEBotEditorTestDetailResultsTableView *testTitleTV; // @synthesize testTitleTV=_testTitleTV; @property IDEBotEditorTestDetailHeaderTableView *totalTV; // @synthesize totalTV=_totalTV; @property IDEBotEditorTestDetailHeaderTableView *testsFailedTV; // @synthesize testsFailedTV=_testsFailedTV; @property IDEBotEditorTestDetailHeaderTableView *integrationTV; // @synthesize integrationTV=_integrationTV; @property DVTBorderedView *testTitleTVBV; // @synthesize testTitleTVBV=_testTitleTVBV; @property DVTBorderedView *totalTVBV; // @synthesize totalTVBV=_totalTVBV; @property DVTBorderedView *totalTitleBV; // @synthesize totalTitleBV=_totalTitleBV; @property DVTBorderedView *testsFailedTVBV; // @synthesize testsFailedTVBV=_testsFailedTVBV; @property DVTBorderedView *testsFailedTitleBV; // @synthesize testsFailedTitleBV=_testsFailedTitleBV; @property DVTBorderedView *integrationTVBV; // @synthesize integrationTVBV=_integrationTVBV; @property DVTBorderedView *integrationTitleBV; // @synthesize integrationTitleBV=_integrationTitleBV; @property(nonatomic) long long selectedRow; // @synthesize selectedRow=_selectedRow; @property(retain, nonatomic) NSString *selectedColumnIdentifier; // @synthesize selectedColumnIdentifier=_selectedColumnIdentifier; @property(retain, nonatomic) IDEBotEditorTestDetailResultsRowView *detailsRowView; // @synthesize detailsRowView=_detailsRowView; @property(nonatomic) __weak id <IDEBotEditorTestDetailSelectionProtocol> delegate; // @synthesize delegate=_delegate; @property(retain, nonatomic) NSArrayController *testTitlesController; // @synthesize testTitlesController=_testTitlesController; @property(nonatomic, getter=isContentVisible) BOOL contentIsVisible; // @synthesize contentIsVisible=_contentIsVisible; @property(retain, nonatomic) NSArray *runs; // @synthesize runs=_runs; - (void).cxx_destruct; - (void)doubleClickInChildTableViewDetected:(id)arg1; - (void)clickInChildTableViewDetected:(id)arg1; - (unsigned long long)indexOfColumnIdentifier:(id)arg1 inTableView:(id)arg2; - (void)reloadHeaderViews; - (void)refreshHeaderViews; - (void)clearContentItems; - (void)deselectAllTableviews; - (void)tableViewSelectionDidChange:(id)arg1; - (void)tableViewSelectionIsChanging:(id)arg1; - (void)updateTestTitleTableViewTextFieldTextColor; - (void)setViewBackgroundColor:(id)arg1 tableColumn:(id)arg2 row:(long long)arg3; - (id)tableView:(id)arg1 viewForTableColumn:(id)arg2 row:(long long)arg3; - (BOOL)tableView:(id)arg1 shouldEditTableColumn:(id)arg2 row:(long long)arg3; - (long long)numberOfRowsInTableView:(id)arg1; - (void)reloadDetailSection; - (void)reloadHeaderSection; - (void)updateTrackingAreas; - (void)setFilterPredicate:(id)arg1; - (void)removeColumnsForTableView:(id)arg1; - (void)setupSynchroScrollView:(id)arg1 synchroMode:(int)arg2 useCustomScroller:(BOOL)arg3; - (void)setupScrollingInternals; - (void)setupBorderColors; - (void)setupViews; - (id)setupColumnWithIdentifier:(id)arg1 width:(unsigned long long)arg2; - (void)setTestRuns:(id)arg1 testTitles:(id)arg2; - (id)historyViewItemAtIndex:(unsigned long long)arg1; - (unsigned long long)historyViewItemCount; - (void)clearHistoryItems; - (void)appendHistoryViewItem:(id)arg1; - (double)adjustedWidthOfColumn; @property(readonly, nonatomic) unsigned long long numberOfAllowedColumns; - (void)dealloc; - (void)awakeFromNib; @end
53.916667
194
0.818478
58374ac411f643cd9d641daf193fd22943afa51c
1,248
swift
Swift
Swift/LeetCode/LeetCode/PermutationsII.swift
TonnyL/Windary
39f85cdedaaf5b85f7ce842ecef975301fc974cf
[ "MIT" ]
205
2017-11-16T08:38:46.000Z
2022-03-06T05:50:03.000Z
Swift/LeetCode/LeetCode/PermutationsII.swift
santosh241/Windary
39f85cdedaaf5b85f7ce842ecef975301fc974cf
[ "MIT" ]
3
2018-04-10T10:17:52.000Z
2020-12-11T08:00:09.000Z
Swift/LeetCode/LeetCode/PermutationsII.swift
santosh241/Windary
39f85cdedaaf5b85f7ce842ecef975301fc974cf
[ "MIT" ]
28
2018-04-10T06:42:42.000Z
2021-09-14T14:15:39.000Z
// // PermutationsII.swift // LeetCode // // Created by 黎赵太郎 on 05/12/2017. // Copyright © 2017 lizhaotailang. All rights reserved. // // Given a collection of numbers that might contain duplicates, return all possible unique permutations. // // For example, // [1,1,2] have the following unique permutations: // [ // [1,1,2], // [1,2,1], // [2,1,1] // ] // // Accepted. See [PermutationsIITests](./LeetCodeTests/PermutationsIITests.swift) for test cases. // import Foundation class PermutationsII { func permuteUnique(_ nums: [Int]) -> [[Int]] { var results: [[Int]] = [] if nums.isEmpty { return results } if nums.count == 1 { results.append([nums[0]]) return results } let ints = Array(nums[0..<nums.count - 1]) var map: [String: Array<Int>] = [:] for list in permuteUnique(ints) { for i in 0...list.count { var tmp = Array(list) tmp.insert(nums[nums.count - 1], at: i) map[String(describing: tmp)] = tmp } } map.values.forEach{ results.append($0) } return results } }
23.54717
105
0.526442
84f4b5d60e5b65ecfd8049a38b39b65f7c8e8a56
3,120
h
C
firmware/LightControl.h
csjall/LightControl
1f1a7cb4e91dc8c00b5b15c521ea92c2e900019c
[ "MIT" ]
null
null
null
firmware/LightControl.h
csjall/LightControl
1f1a7cb4e91dc8c00b5b15c521ea92c2e900019c
[ "MIT" ]
null
null
null
firmware/LightControl.h
csjall/LightControl
1f1a7cb4e91dc8c00b5b15c521ea92c2e900019c
[ "MIT" ]
null
null
null
#ifndef LightControl_h #define LightControl_h #include <Particle.h> //---------------------------------------------------------------------------- #define IMPLEMENT_REGISTER(name, type, offset, mask) \ type get##name() const \ { \ type value; \ memcpy(&value, &buffer[offset], sizeof(type)); \ value &= mask; \ return value; \ } \ void set##name(type value) \ { \ value &= mask; \ memcpy(&buffer[offset], &value, sizeof(type)); \ } \ void read##name() \ { \ readRegister(offset, sizeof(type)); \ } \ void write##name() \ { \ writeRegister(offset, sizeof(type)); \ } \ // Container for current register map. class RegisterMap { public: RegisterMap(); IMPLEMENT_REGISTER(Model, uint8_t, 0x00, 0xFF) IMPLEMENT_REGISTER(Version, uint8_t, 0x1, 0xFF) IMPLEMENT_REGISTER(SerialNumber, uint32_t, 0x2, 0xFFFFFFFF) IMPLEMENT_REGISTER(WavelengthCount, uint8_t, 0x6, 0xFF) IMPLEMENT_REGISTER(CalibratedDutyCycle1, uint16_t, 0x7, 0xFFFF) IMPLEMENT_REGISTER(CalibratedDutyCycle2, uint16_t, 0x9, 0xFFFF) IMPLEMENT_REGISTER(CalibratedDutyCycle3, uint16_t, 0xB, 0xFFFF) IMPLEMENT_REGISTER(CalibratedDutyCycle4, uint16_t, 0xD, 0xFFFF) IMPLEMENT_REGISTER(CalibrationTemperature, uint16_t, 0xF, 0xFFFF) IMPLEMENT_REGISTER(TemperatureCoefficient1, uint16_t, 0x11, 0xFFFF) IMPLEMENT_REGISTER(TemperatureCoefficient2, uint16_t, 0x13, 0xFFFF) IMPLEMENT_REGISTER(Address, uint8_t, 0x15, 0x7F) IMPLEMENT_REGISTER(CompensationInterval, uint16_t, 0x16, 0xFFFF) IMPLEMENT_REGISTER(LightOutputFactor1, uint16_t, 0x18, 0xFFFF) IMPLEMENT_REGISTER(LightOutputFactor2, uint16_t, 0x1A, 0xFFFF) IMPLEMENT_REGISTER(SensorTemperature, uint16_t, 0x1C, 0xFFFF) IMPLEMENT_REGISTER(CalculatedDutyCycle1, uint16_t, 0x1E, 0xFFFF) IMPLEMENT_REGISTER(CalculatedDutyCycle2, uint16_t, 0x20, 0xFFFF) IMPLEMENT_REGISTER(VoltageReading1, uint16_t, 0x22, 0xFFFF) IMPLEMENT_REGISTER(VoltageReading2, uint16_t, 0x24, 0xFFFF) IMPLEMENT_REGISTER(VoltageReading3, uint16_t, 0x26, 0xFFFF) IMPLEMENT_REGISTER(VoltageReading4, uint16_t, 0x28, 0xFFFF) IMPLEMENT_REGISTER(VoltageReading5, uint16_t, 0x2A, 0xFFFF) void receiveEvent(int16_t numberOfBytes); void requestEvent(); private: void readRegister(uint8_t offset, uint8_t size); void writeRegister(uint8_t, uint8_t size); void readHeader(); void writeHeader(uint8_t offset, uint8_t size); uint8_t buffer[0x30]; uint8_t offset; uint8_t size; }; //---------------------------------------------------------------------------- // Container for averaged circular buffer class CircularBuffer { public: static const uint8_t TotalValues = 4; CircularBuffer(); void setup(uint16_t value); void addValue(uint16_t value); uint16_t getAverage() const; private: uint16_t values[TotalValues]; uint16_t runningTotal; uint8_t lastIndex; }; //---------------------------------------------------------------------------- class Scanner { public: Scanner(bool reserved); void reset(); uint8_t next(); private: static bool isReserved(uint8_t address); bool reserved; uint8_t address; }; #endif
27.857143
78
0.697115
6f41343ddd5b8a87549d292306a404506e1d7ef2
3,589
rs
Rust
src/affine.rs
sradley/cipher
6af859b6e0d204b5904d0cbd8a31ab12d3b7ed63
[ "MIT" ]
2
2019-08-22T17:23:37.000Z
2019-08-25T11:07:39.000Z
src/affine.rs
sradley/cipher
6af859b6e0d204b5904d0cbd8a31ab12d3b7ed63
[ "MIT" ]
1
2019-08-24T17:45:47.000Z
2019-08-24T17:45:47.000Z
src/affine.rs
sradley/cipher
6af859b6e0d204b5904d0cbd8a31ab12d3b7ed63
[ "MIT" ]
null
null
null
//! # Affine Cipher //! //! Implements the functionality for the Affine cipher. //! //! The following is an excerpt from [Wikipedia](https://en.wikipedia.org/wiki/Affine_cipher). //! > The affine cipher is a type of monoalphabetic substitution cipher, wherein each letter in an //! alphabet is mapped to its numeric equivalent, encrypted using a simple mathematical function, //! and converted back to a letter. //! //! > The formula used means that each letter encrypts to one other letter, and back again, meaning //! the cipher is essentially a standard substitution cipher with a rule governing which letter goes //! to which. //! //! > As such, it has the weaknesses of all substitution ciphers. Each letter is enciphered with the //! function (ax + b) mod 26, where b is the magnitude of the shift. use crate::{input, Cipher, CipherResult}; static RELATIVE_PRIMES: [i32; 12] = [1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25]; /// An Affine cipher implementation. pub struct Affine { a: i32, b: i32, } impl Affine { /// Takes the two keys for the Affine cipher and returns a /// corresponding Affine struct. /// /// # Panics /// * If `a` is outside the range [1, 26). /// * If `b` is outside the range [0, 26). /// * If `a` is not relatively prime to 26. pub fn new(a: i32, b: i32) -> Self { assert!(0 < a && a < 26, "`a` must be in the range [1, 26)"); assert!(0 <= b && b < 26, "`b` must be in the range [0, 26)"); assert!( RELATIVE_PRIMES.contains(&a), "`a` must be relatively prime to 26" ); Self { a, b } } } impl Cipher for Affine { /// Enciphers the given plaintext (a str reference) using the Affine cipher /// and returns the ciphertext as a `CipherResult`. /// /// # Example /// ``` /// use ciphers::{Cipher, Affine}; /// /// let affine = Affine::new(7, 11); /// /// let ctext = affine.encipher("DEFENDTHEEASTWALLOFTHECASTLE"); /// assert_eq!(ctext.unwrap(), "GNUNYGOINNLHOJLKKFUOINZLHOKN"); /// ``` fn encipher(&self, ptext: &str) -> CipherResult { input::is_alpha(ptext)?; let ptext = ptext.to_ascii_uppercase(); let ctext = ptext .bytes() .map(move |c| ((self.a * (c as i32 - 65) + self.b) % 26) as u8 + 65) .collect(); Ok(String::from_utf8(ctext).unwrap()) } /// Deciphers the given ciphertext (a str reference) using the Affine cipher /// and returns the plaintext as a `CipherResult`. /// /// # Example /// ``` /// use ciphers::{Cipher, Affine}; /// /// let affine = Affine::new(7, 11); /// /// let ptext = affine.decipher("GNUNYGOINNLHOJLKKFUOINZLHOKN"); /// assert_eq!(ptext.unwrap(), "DEFENDTHEEASTWALLOFTHECASTLE"); /// ``` fn decipher(&self, ctext: &str) -> CipherResult { input::is_alpha(ctext)?; let ctext = ctext.to_ascii_uppercase(); let a_inv = invmod(self.a, 26).unwrap(); let ptext = ctext .bytes() .map(move |c| (((a_inv * (c as i32 - 65 - self.b)) % 26 + 26) % 26) as u8 + 65) .collect(); Ok(String::from_utf8(ptext).unwrap()) } } fn egcd(a: i32, b: i32) -> (i32, i32, i32) { match a { 0 => (b, 0, 1), _ => { let (g, x, y) = egcd(b % a, a); (g, y - (b / a) * x, x) } } } fn invmod(a: i32, m: i32) -> Option<i32> { let (g, x, _) = egcd(a, m); match g { 1 => Some((x % m + m) % m), _ => None, } }
30.675214
100
0.561716
7aa9938049f00fed20f14858e051842cbf18568d
892
swift
Swift
VK-Light-presentation/Controller/Friends/AllFriendDataTableView.swift
DarskiyDanil/VK-Light-presentation
7fa68f2982f3cab7a5adbe44736c6af2069a9ac8
[ "MIT" ]
null
null
null
VK-Light-presentation/Controller/Friends/AllFriendDataTableView.swift
DarskiyDanil/VK-Light-presentation
7fa68f2982f3cab7a5adbe44736c6af2069a9ac8
[ "MIT" ]
null
null
null
VK-Light-presentation/Controller/Friends/AllFriendDataTableView.swift
DarskiyDanil/VK-Light-presentation
7fa68f2982f3cab7a5adbe44736c6af2069a9ac8
[ "MIT" ]
null
null
null
// // AllFriendDataTableView.swift // VK-Light-presentation // // Created by Данил Дарский on 02.01.2020. // Copyright © 2020 Данил Дарский. All rights reserved. // import UIKit class AllFriendDataTableView: UITableView, UITableViewDataSource, UITableViewDelegate { var allFriend: [AllFriendCoreData]? func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return self.allFriend?.count ?? 0 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: AllFriendCell.idCell, for: indexPath) as! AllFriendCell let friendOne = allFriend?[indexPath.row] guard let friend = friendOne else {return cell} cell.configure(with: friend) return cell } }
28.774194
120
0.680493
ec71720c1dc094ac5d33958d8b3c3b60cb1418cc
1,213
sql
SQL
sql/tdoer.table/fw/fw_tenant_product.sql
t-doer/tdoer-core-data
6d232deb6d9ab5cebb5c10aec3a37fa41b4f5c11
[ "Apache-2.0" ]
1
2020-02-16T06:54:26.000Z
2020-02-16T06:54:26.000Z
sql/tdoer.table/fw/fw_tenant_product.sql
t-doer/tdoer-core-data
6d232deb6d9ab5cebb5c10aec3a37fa41b4f5c11
[ "Apache-2.0" ]
null
null
null
sql/tdoer.table/fw/fw_tenant_product.sql
t-doer/tdoer-core-data
6d232deb6d9ab5cebb5c10aec3a37fa41b4f5c11
[ "Apache-2.0" ]
null
null
null
drop table if exists fw_tenant_product; /*==============================================================*/ /* Table: fw_tenant_product */ /*==============================================================*/ create table fw_tenant_product ( ID bigint not null comment 'Mapping ID', TENANT_ID bigint not null comment 'Tenant ID', PRODUCT_ID varchar(64) not null comment 'Product ID', START_DATE date not null comment 'Rental start date', END_DATE date not null comment 'Rental end date', ENABLED char(1) default 'N' not null comment 'Enabled or not: Y | N', CREATED_BY varchar(64) not null comment 'User''s name who created the record', CREATED_AT datetime not null comment 'The time created at', UPDATED_BY varchar(64) comment 'User''s name who updated the record', UPDATED_AT timestamp default current_timestamp on update current_timestamp comment 'The time updated at', primary key (ID) ) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci COMMENT='Product Rental, the tenant rents which products' AUTO_INCREMENT=1;
50.541667
118
0.584501
5f2c4ec227b30ffc450facc3aaa9bcf4febd6d86
3,443
sql
SQL
sqlnexus/SQLNexus_PostProcessing.sql
asavioli/SqlNexus
f0980dd6095ed64a112d130ac7fb456a9b5bd6dc
[ "MIT" ]
null
null
null
sqlnexus/SQLNexus_PostProcessing.sql
asavioli/SqlNexus
f0980dd6095ed64a112d130ac7fb456a9b5bd6dc
[ "MIT" ]
null
null
null
sqlnexus/SQLNexus_PostProcessing.sql
asavioli/SqlNexus
f0980dd6095ed64a112d130ac7fb456a9b5bd6dc
[ "MIT" ]
null
null
null
set nocount on --add extra columns that represent local server time, computed based on offset if the data is available --these will facilitation joins between ReadTrace.* tables and other tbl_* tables - the latter storing datetime in local server time if (OBJECT_ID('[ReadTrace].[tblBatches]') is not null) begin --add columns to tblBatches if ((COLUMNPROPERTY (OBJECT_ID('[ReadTrace].[tblBatches]'), 'StartTime_local', 'ColumnId' ) IS NULL) and (COLUMNPROPERTY (OBJECT_ID('[ReadTrace].[tblBatches]'), 'EndTime_local', 'ColumnId' ) IS NULL)) begin ALTER TABLE [ReadTrace].[tblBatches] ADD StartTime_local datetime, EndTime_local datetime; end end if (OBJECT_ID('[ReadTrace].[tblStatements]') is not null) begin --add columns to tblStatements if ((COLUMNPROPERTY (OBJECT_ID('[ReadTrace].[tblStatements]'), 'StartTime_local', 'ColumnId' ) IS NULL) and (COLUMNPROPERTY (OBJECT_ID('[ReadTrace].[tblStatements]'), 'EndTime_local', 'ColumnId' ) IS NULL)) begin ALTER TABLE [ReadTrace].[tblStatements] ADD StartTime_local datetime, EndTime_local datetime; end end if (OBJECT_ID('[ReadTrace].[tblConnections]') is not null) begin --add columns to tblConnections if ((COLUMNPROPERTY (OBJECT_ID('[ReadTrace].[tblConnections]'), 'StartTime_local', 'ColumnId' ) IS NULL) and (COLUMNPROPERTY (OBJECT_ID('[ReadTrace].[tblConnections]'), 'EndTime_local', 'ColumnId' ) IS NULL)) begin ALTER TABLE [ReadTrace].[tblConnections] ADD StartTime_local datetime, EndTime_local datetime; end end go if ( (OBJECT_ID('tbl_ServerProperties') is not null) or (OBJECT_ID('tbl_server_times') is not null) ) begin --get the offset from one of two possible tables declare @utc_to_local_offset numeric(3,0) = 0 if OBJECT_ID('tbl_ServerProperties') is not null begin select @utc_to_local_offset = PropertyValue from tbl_ServerProperties where PropertyName = 'UTCOffset_in_Hours' end else if OBJECT_ID('tbl_server_times') is not null begin select top 1 @utc_to_local_offset = time_delta_hours * -1 from tbl_server_times end --update the new columns in tblBatches with local times if ((COLUMNPROPERTY (OBJECT_ID('[ReadTrace].[tblBatches]'), 'StartTime_local', 'ColumnId' ) IS NOT NULL) and (COLUMNPROPERTY (OBJECT_ID('[ReadTrace].[tblBatches]'), 'EndTime_local', 'ColumnId' ) IS NOT NULL)) begin update [ReadTrace].[tblBatches] set StartTime_local = DATEADD(hour, @utc_to_local_offset, StartTime) , EndTime_local = DATEADD (hour, @utc_to_local_offset, EndTime) ; end --update the new columns in tblStatements with local times if ((COLUMNPROPERTY (OBJECT_ID('[ReadTrace].[tblStatements]'), 'StartTime_local', 'ColumnId' ) IS NOT NULL) and (COLUMNPROPERTY (OBJECT_ID('[ReadTrace].[tblStatements]'), 'EndTime_local', 'ColumnId' ) IS NOT NULL)) begin update [ReadTrace].[tblStatements] set StartTime_local = DATEADD(hour, @utc_to_local_offset, StartTime) , EndTime_local = DATEADD (hour, @utc_to_local_offset, EndTime) ; end --update the new columns in tblConnections with local times if ((COLUMNPROPERTY (OBJECT_ID('[ReadTrace].[tblConnections]'), 'StartTime_local', 'ColumnId' ) IS NOT NULL) and (COLUMNPROPERTY (OBJECT_ID('[ReadTrace].[tblConnections]'), 'EndTime_local', 'ColumnId' ) IS NOT NULL)) begin update [ReadTrace].[tblConnections] set StartTime_local = DATEADD(hour, @utc_to_local_offset, StartTime) , EndTime_local = DATEADD (hour, @utc_to_local_offset, EndTime) ; end end
42.506173
133
0.75138
c37d4a531b0ce97c79d458189f298f40a8426545
6,710
go
Go
lib/config_test.go
CallMeFoxie/cri-o
7a329fc0a6198e611ad862a67aca3380406dfc83
[ "Apache-2.0" ]
1
2019-07-15T16:37:01.000Z
2019-07-15T16:37:01.000Z
lib/config_test.go
CallMeFoxie/cri-o
7a329fc0a6198e611ad862a67aca3380406dfc83
[ "Apache-2.0" ]
null
null
null
lib/config_test.go
CallMeFoxie/cri-o
7a329fc0a6198e611ad862a67aca3380406dfc83
[ "Apache-2.0" ]
null
null
null
package lib_test import ( "io/ioutil" "os" "github.com/kubernetes-sigs/cri-o/lib" "github.com/kubernetes-sigs/cri-o/oci" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) // The actual test suite var _ = t.Describe("Config", func() { // The system under test var sut *lib.Config BeforeEach(func() { sut = lib.DefaultConfig() Expect(sut).NotTo(BeNil()) }) const ( validPath = "/bin/sh" wrongPath = "/wrong" ) t.Describe("ValidateRuntimeConfig", func() { It("should succeed with default config", func() { // Given // When err := sut.RuntimeConfig.Validate(false) // Then Expect(err).To(BeNil()) }) It("should succeed during runtime", func() { // Given sut.Runtimes["runc"] = oci.RuntimeHandler{RuntimePath: validPath} sut.Conmon = validPath // When err := sut.RuntimeConfig.Validate(true) // Then Expect(err).To(BeNil()) }) It("should succeed with additional devices", func() { // Given sut.AdditionalDevices = []string{"/dev/null:/dev/null:rw"} sut.Runtimes["runc"] = oci.RuntimeHandler{RuntimePath: validPath} sut.Conmon = validPath // When err := sut.RuntimeConfig.Validate(true) // Then Expect(err).To(BeNil()) }) It("should succeed with hooks directories", func() { // Given sut.Runtimes["runc"] = oci.RuntimeHandler{RuntimePath: validPath} sut.Conmon = validPath sut.HooksDir = []string{validPath} // When err := sut.RuntimeConfig.Validate(true) // Then Expect(err).To(BeNil()) }) It("should fail on invalid hooks directory", func() { // Given sut.Runtimes["runc"] = oci.RuntimeHandler{RuntimePath: validPath} sut.Conmon = validPath sut.HooksDir = []string{wrongPath} // When err := sut.RuntimeConfig.Validate(true) // Then Expect(err).NotTo(BeNil()) }) It("should fail on invalid conmon path", func() { // Given sut.Runtimes["runc"] = oci.RuntimeHandler{RuntimePath: validPath} sut.Conmon = wrongPath sut.HooksDir = []string{validPath} // When err := sut.RuntimeConfig.Validate(true) // Then Expect(err).NotTo(BeNil()) }) It("should fail on wrong DefaultUlimits", func() { // Given sut.DefaultUlimits = []string{wrongPath} // When err := sut.RuntimeConfig.Validate(false) // Then Expect(err).NotTo(BeNil()) }) It("should fail on wrong invalid device specification", func() { // Given sut.AdditionalDevices = []string{"::::"} // When err := sut.RuntimeConfig.Validate(false) // Then Expect(err).NotTo(BeNil()) }) It("should fail on invalid device", func() { // Given sut.AdditionalDevices = []string{wrongPath} // When err := sut.RuntimeConfig.Validate(false) // Then Expect(err).NotTo(BeNil()) }) It("should fail on invalid device mode", func() { // Given sut.AdditionalDevices = []string{"/dev/null:/dev/null:abc"} // When err := sut.RuntimeConfig.Validate(false) // Then Expect(err).NotTo(BeNil()) }) It("should fail on invalid first device", func() { // Given sut.AdditionalDevices = []string{"wrong:/dev/null:rw"} // When err := sut.RuntimeConfig.Validate(false) // Then Expect(err).NotTo(BeNil()) }) It("should fail on invalid second device", func() { // Given sut.AdditionalDevices = []string{"/dev/null:wrong:rw"} // When err := sut.RuntimeConfig.Validate(false) // Then Expect(err).NotTo(BeNil()) }) It("should fail on no default runtime", func() { // Given sut.Runtimes = make(map[string]oci.RuntimeHandler) // When err := sut.RuntimeConfig.Validate(false) // Then Expect(err).NotTo(BeNil()) }) It("should fail on non existing runtime binary", func() { // Given sut.Runtimes["runc"] = oci.RuntimeHandler{RuntimePath: "not-existing"} // When err := sut.RuntimeConfig.Validate(true) // Then Expect(err).NotTo(BeNil()) }) }) t.Describe("ValidateNetworkConfig", func() { It("should succeed with default config", func() { // Given // When err := sut.NetworkConfig.Validate(false) // Then Expect(err).To(BeNil()) }) It("should succeed during runtime", func() { // Given sut.NetworkConfig.NetworkDir = validPath sut.NetworkConfig.PluginDir = []string{validPath} // When err := sut.NetworkConfig.Validate(true) // Then Expect(err).To(BeNil()) }) It("should fail on invalid NetworkDir", func() { // Given sut.NetworkConfig.NetworkDir = wrongPath sut.NetworkConfig.PluginDir = []string{validPath} // When err := sut.NetworkConfig.Validate(true) // Then Expect(err).NotTo(BeNil()) }) It("should fail on invalid PluginDir", func() { // Given sut.NetworkConfig.NetworkDir = validPath sut.NetworkConfig.PluginDir = []string{wrongPath} // When err := sut.NetworkConfig.Validate(true) // Then Expect(err).NotTo(BeNil()) }) }) t.Describe("ToFile", func() { It("should succeed with default config", func() { // Given tmpfile, err := ioutil.TempFile("", "config") Expect(err).To(BeNil()) defer os.Remove(tmpfile.Name()) // When err = sut.ToFile(tmpfile.Name()) // Then Expect(err).To(BeNil()) _, err = os.Stat(tmpfile.Name()) Expect(err).To(BeNil()) }) It("should fail with invalid path", func() { // Given // When err := sut.ToFile("/proc/invalid") // Then Expect(err).NotTo(BeNil()) }) }) t.Describe("UpdateFromFile", func() { It("should succeed with default config", func() { // Given // When err := sut.UpdateFromFile("testdata/config.toml") // Then Expect(err).To(BeNil()) Expect(sut.Storage).To(Equal("overlay2")) Expect(sut.PidsLimit).To(BeEquivalentTo(2048)) }) It("should fail when file does not exist", func() { // Given // When err := sut.UpdateFromFile("/invalid/file") // Then Expect(err).NotTo(BeNil()) }) It("should fail when toml decode fails", func() { // Given // When err := sut.UpdateFromFile("config.go") // Then Expect(err).NotTo(BeNil()) }) }) t.Describe("GetData", func() { It("should succeed with default config", func() { // Given // When config := sut.GetData() // Then Expect(config).NotTo(BeNil()) Expect(config).To(Equal(sut)) }) It("should succeed with empty config", func() { // Given sut := &lib.Config{} // When config := sut.GetData() // Then Expect(config).NotTo(BeNil()) Expect(config).To(Equal(sut)) }) It("should succeed with nil config", func() { // Given var sut *lib.Config // When config := sut.GetData() // Then Expect(config).To(BeNil()) }) }) })
20.333333
73
0.623249
f5cb970fce28f0b44845194a2e71a96bd488bbb0
745
swift
Swift
Pod/Classes/UtmModel.swift
segmentify/mobile-sdk-ios
89b71b7f90dad953783fa4e78d9eb45aec52e3bd
[ "BSD-2-Clause" ]
5
2018-01-25T08:59:03.000Z
2020-04-09T14:35:08.000Z
Pod/Classes/UtmModel.swift
segmentify/mobile-sdk-ios
89b71b7f90dad953783fa4e78d9eb45aec52e3bd
[ "BSD-2-Clause" ]
4
2020-04-24T16:46:40.000Z
2020-05-08T06:36:51.000Z
Pod/Classes/UtmModel.swift
segmentify/mobile-sdk-ios
89b71b7f90dad953783fa4e78d9eb45aec52e3bd
[ "BSD-2-Clause" ]
4
2018-02-05T07:40:23.000Z
2020-11-26T14:18:25.000Z
// // ProductModel.swift // Segmentify import Foundation public class UtmModel{ public var utm_source:String? public var utm_medium:String? public var utm_campaign:String? public var utm_content:String? public init() { self.utm_source = "segmentify" self.utm_medium = "push" let instanceId = UserDefaults.standard.object(forKey: "SEGMENTIFY_PUSH_CAMPAIGN_ID") as? String let productId = UserDefaults.standard.object(forKey: "SEGMENTIFY_PUSH_CAMPAIGN_PRODUCT_ID") as? String if (instanceId?.isEmpty == false) { self.utm_campaign = instanceId } if (productId?.isEmpty == false) { self.utm_content = productId } } }
23.28125
110
0.645638
8f96062d689611adb09f8fa2c4045d586dd7e5d2
609
lua
Lua
cocos2d/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_controller_auto_api.lua
weiDDD/particleSystem
32652b09da35e025956999227f08be83b5d79cb1
[ "Apache-2.0" ]
34
2017-08-16T13:58:24.000Z
2022-03-31T11:50:25.000Z
cocos2d/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_controller_auto_api.lua
weiDDD/particleSystem
32652b09da35e025956999227f08be83b5d79cb1
[ "Apache-2.0" ]
null
null
null
cocos2d/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_controller_auto_api.lua
weiDDD/particleSystem
32652b09da35e025956999227f08be83b5d79cb1
[ "Apache-2.0" ]
17
2017-08-18T07:42:44.000Z
2022-01-02T02:43:06.000Z
-------------------------------- -- @module cc -------------------------------------------------------- -- the cc Controller -- @field [parent=#cc] Controller#Controller Controller preloaded module -------------------------------------------------------- -- the cc EventController -- @field [parent=#cc] EventController#EventController EventController preloaded module -------------------------------------------------------- -- the cc EventListenerController -- @field [parent=#cc] EventListenerController#EventListenerController EventListenerController preloaded module return nil
30.45
112
0.505747
18b84858a0c0f3c05ddff8df5b50fbb737197d83
27
rs
Rust
src/commands/text/mod.rs
TheBotCrator/Life
15e905db7764bc721f420bf9a689e443e4607dc4
[ "0BSD" ]
24
2018-02-14T20:48:40.000Z
2020-08-26T02:32:14.000Z
src/commands/text/mod.rs
TheBotCrator/Life
15e905db7764bc721f420bf9a689e443e4607dc4
[ "0BSD" ]
9
2018-03-21T01:47:24.000Z
2020-08-01T17:31:43.000Z
src/commands/text/mod.rs
TheBotCrator/Life
15e905db7764bc721f420bf9a689e443e4607dc4
[ "0BSD" ]
5
2018-03-13T01:25:34.000Z
2020-07-19T09:23:49.000Z
pub mod hug; pub mod ship;
9
13
0.703704
f0946ea2bf53c1ae92d330d9dbabf6c8b74df40e
1,420
js
JavaScript
src/index.js
tensegrity666/clone-wars-gta
4b3baeac2673b8c7ce50e677d004e5e87a010e02
[ "MIT" ]
null
null
null
src/index.js
tensegrity666/clone-wars-gta
4b3baeac2673b8c7ce50e677d004e5e87a010e02
[ "MIT" ]
4
2021-08-31T21:26:45.000Z
2022-02-27T10:56:01.000Z
src/index.js
tensegrity666/clone-wars-gta
4b3baeac2673b8c7ce50e677d004e5e87a010e02
[ "MIT" ]
null
null
null
/* eslint-disable no-console */ import './index.css'; import Phaser from 'phaser'; import PROPERTIES from './game-props'; import GameScene from './scenes'; import MenuScene from './scenes/menu'; import LoadScene from './scenes/load'; import GameOverScene from './scenes/gameover'; import UIScene from './scenes/player-interface'; import ButtonsScene from './scenes/buttons'; import TimeQuestScene from './scenes/timequest'; import StatisticsScene from './scenes/statistics'; import InctructionScene from './scenes/instruction'; const config = { parent: 'container', type: Phaser.AUTO, width: PROPERTIES.width, height: PROPERTIES.height, render: { pixelart: false, }, physics: { default: PROPERTIES.phisycs, arcade: { gravity: PROPERTIES.gravity, debug: false, }, }, scale: { mode: Phaser.Scale.FIT, autoCenter: Phaser.Scale.CENTER_BOTH, }, scene: [ LoadScene, MenuScene, GameScene, UIScene, ButtonsScene, TimeQuestScene, StatisticsScene, GameOverScene, InctructionScene, ], disableContextMenu: true, }; const loadHandler = () => { navigator.serviceWorker.register('./service-worker.js').catch((err) => { console.log(`Error: ${err}`); }); }; if ('serviceWorker' in navigator && process.env.NODE_ENV === 'production') { window.addEventListener('load', loadHandler); } export default new Phaser.Game(config);
23.278689
76
0.683803
6b4b2f9993b2b22245a99d1ced4a9b9b5fa1b2bf
5,917
c
C
helsing/src/vampire/vargs.c
plerros/Helsing
468a745ce98e00aa64d4a3eac8ad5d40cb2ea5a1
[ "BSD-3-Clause" ]
1
2022-01-02T15:55:50.000Z
2022-01-02T15:55:50.000Z
helsing/src/vampire/vargs.c
plerros/helsing
468a745ce98e00aa64d4a3eac8ad5d40cb2ea5a1
[ "BSD-3-Clause" ]
15
2021-05-04T03:43:39.000Z
2022-03-22T14:03:15.000Z
helsing/src/vampire/vargs.c
plerros/helsing
468a745ce98e00aa64d4a3eac8ad5d40cb2ea5a1
[ "BSD-3-Clause" ]
null
null
null
// SPDX-License-Identifier: BSD-3-Clause /* * Copyright (c) 2012 Jens Kruse Andersen * Copyright (c) 2021 Pierro Zachareas */ #include <stdlib.h> #include <stdbool.h> #include <stdio.h> #include "configuration.h" #include "configuration_adv.h" #include "helper.h" #include "llnode.h" #include "array.h" #include "cache.h" #include "vargs.h" #if SANITY_CHECK #include <assert.h> #endif static bool notrailingzero(fang_t x) { return ((x % BASE) != 0); } static fang_t sqrtv_floor(vamp_t x) // vamp_t sqrt to fang_t. { vamp_t x2 = x / 2; vamp_t root = x2; if (root > 0) { vamp_t tmp = (root + x / root) / 2; while (tmp < root) { root = tmp; tmp = (root + x / root) / 2; } return root; } return x; } static fang_t sqrtv_roof(vamp_t x) { if (x == 0) return 0; fang_t root = sqrtv_floor(x); if (root == fang_max) return root; return (x / root); } /* * disqualify_mult: * * Disqualify ineligible values before congruence_check. * Currently suppoted numerical bases: 2~10. */ static bool disqualify_mult(vamp_t x) { bool ret = false; switch (BASE) { case 2: ret = false; break; case 7: { int tmp = x % (BASE - 1); ret = (tmp == 1 || tmp == 3 || tmp == 4 || tmp == 5); break; } case 10: ret = (x % 3 == 1); break; default: /* * A represents the last bit of multiplier * B represents the last bit of multiplicand * * A B A+B A*B Match * 0 0 0 0 true * 0 1 1 0 false * 1 0 1 0 false * 1 1 (1)0 1 false * * If BASE-1 is a power of two, we can safely disqualify * the cases where A is 1. */ if (((BASE - 1) & (BASE - 2)) == 0) ret = x % 2; else ret = (x % (BASE - 1) == 1); } return ret; } // Modulo base-1 lack of congruence static bool congruence_check(vamp_t x, vamp_t y) { return ((x + y) % (BASE - 1) != (x * y) % (BASE - 1)); } void vargs_new(struct vargs **ptr, struct cache *digptr) { #if SANITY_CHECK assert(ptr != NULL); assert (*ptr == NULL); #endif struct vargs *new = malloc(sizeof(struct vargs)); if (new == NULL) abort(); new->digptr = digptr; new->local_count = 0; new->result = NULL; *ptr = new; } void vargs_free(struct vargs *args) { if (args == NULL) return; array_free(args->result); free(args); } void vargs_reset(struct vargs *args) { args->local_count = 0; array_free(args->result); args->result = NULL; } void vampire(vamp_t min, vamp_t max, struct vargs *args, fang_t fmax) { struct llnode *ll = NULL; fang_t min_sqrt = sqrtv_roof(min); fang_t max_sqrt = sqrtv_floor(max); #if CACHE length_t length_max = length(max); length_t length_a = length_max / 3; if (length_max < 9) length_a += length_max % 3; fang_t power_a = pow_v(length_a); digits_t *dig = args->digptr->dig; #endif for (fang_t multiplier = fmax; multiplier >= min_sqrt && multiplier > 0; multiplier--) { if (disqualify_mult(multiplier)) continue; fang_t multiplicand = div_roof(min, multiplier); // fmin * fmax <= min - BASE^n bool mult_zero = notrailingzero(multiplier); fang_t multiplicand_max; if (multiplier > max_sqrt) multiplicand_max = max / multiplier; else multiplicand_max = multiplier; // multiplicand <= multiplier: 5267275776 = 72576 * 72576. while (multiplicand <= multiplicand_max && congruence_check(multiplier, multiplicand)) multiplicand++; if (multiplicand <= multiplicand_max) { vamp_t product_iterator = multiplier; product_iterator *= BASE - 1; // <= (BASE-1) * (2^32) vamp_t product = multiplier; product *= multiplicand; // avoid overflow #if CACHE fang_t step0 = product_iterator % power_a; fang_t step1 = product_iterator / power_a; /* * digd = dig[multiplier]; * Each digd is calculated and accessed only once, we don't need to store them in memory. * We can calculate digd on the spot and make the dig array 10 times smaller. */ digits_t digd = set_dig(multiplier); fang_t e0 = multiplicand % power_a; fang_t e1 = multiplicand / power_a; fang_t de0 = product % power_a; fang_t de1 = (product / power_a) % power_a; fang_t de2 = (product / power_a) / power_a; for (; multiplicand <= multiplicand_max; multiplicand += BASE - 1) { if (digd + dig[e0] + dig[e1] == dig[de0] + dig[de1] + dig[de2]) if (mult_zero || notrailingzero(multiplicand)) { vargs_iterate_local_count(args); vargs_print_results(product, multiplier, multiplicand); llnode_add(&(ll), product); } product += product_iterator; e0 += BASE - 1; if (e0 >= power_a) { e0 -= power_a; e1 += 1; } de0 += step0; if (de0 >= power_a) { de0 -= power_a; de1 += 1; } de1 += step1; if (de1 >= power_a) { de1 -= power_a; de2 += 1; } } #else /* CACHE */ length_t mult_array[BASE] = {0}; for (fang_t i = multiplier; i > 0; i /= BASE) mult_array[i % BASE] += 1; for (; multiplicand <= multiplicand_max; multiplicand += BASE - 1) { uint16_t product_array[BASE] = {0}; for (vamp_t p = product; p > 0; p /= BASE) product_array[p % BASE] += 1; for (digit_t i = 0; i < BASE; i++) if (product_array[i] < mult_array[i]) goto vampire_exit; digit_t temp; for (fang_t m = multiplicand; m > 0; m /= BASE) { temp = m % BASE; if (product_array[temp] == 0) goto vampire_exit; else product_array[temp]--; } for (digit_t i = 0; i < (BASE - 1); i++) if (product_array[i] != mult_array[i]) goto vampire_exit; if (mult_zero || notrailingzero(multiplicand)) { vargs_iterate_local_count(args); vargs_print_results(product, multiplier, multiplicand); llnode_add(&(ll), product); } vampire_exit: product += product_iterator; } #endif /* CACHE */ } } array_new(&(args->result), ll, &(args->local_count)); llnode_free(ll); return; }
22.244361
92
0.617205
1664285912d53daa28d104e4efa0c83a6d7acf79
7,552
c
C
Integration/ECUone1_finalintegration/Rte/Rte_SeatHeater.c
ukpkmkkcrypto/communication-stack
f9ee3656a9b1c11a61585668fa7e985acdf4f2cb
[ "Apache-2.0" ]
80
2019-07-14T22:32:10.000Z
2022-03-30T05:28:59.000Z
Integration/ECUone1_finalintegration/Rte/Rte_SeatHeater.c
lihaixu0628/communication-stack
2e126df8fee16b6ca56e62feac1ede19615dcf29
[ "Apache-2.0" ]
8
2019-08-01T20:41:11.000Z
2022-03-25T18:58:00.000Z
Integration/ECUone1_finalintegration/Rte/Rte_SeatHeater.c
lihaixu0628/communication-stack
2e126df8fee16b6ca56e62feac1ede19615dcf29
[ "Apache-2.0" ]
51
2019-07-15T15:59:50.000Z
2022-03-25T22:59:07.000Z
#include "Rte.h" #include "Rtetypes.h" #include "Rte_SeatHeater.h" uint8 controlright; uint8 controlleft; //int temp=0; int*l; int s=0 ; uint8_t si=0 ; uint8_t su=0 ; uint8_t arrray[2]; void SeatHeaterRunnable( ) { Rte_Read_LeftLevelReceiver_Left_Level_Heater(&controlleft); Rte_Read_RightLevelReceiver_Right_Level_Interface(&controlright); l= &s; if ( (controlleft==0U) && (controlright==0U) ) { LCD_command(0x80); Delay_ms(2); LCD_data('R'); LCD_data('I'); LCD_data('G'); LCD_data('H'); LCD_data('T'); LCD_data(' '); LCD_data('S'); LCD_data('E'); LCD_data('A'); LCD_data('T'); LCD_data(' '); LCD_data('O'); LCD_data('F'); LCD_data('F'); LCD_data(' '); LCD_data(' '); LCD_command(0xC0); Delay_ms(2); LCD_data('L'); LCD_data('E'); LCD_data('F'); LCD_data('T'); LCD_data(' '); LCD_data(' '); LCD_data('S'); LCD_data('E'); LCD_data('A'); LCD_data('T'); LCD_data(' '); LCD_data('O'); LCD_data('F'); LCD_data('F'); LCD_data(' '); LCD_data(' '); LCD_data(' '); } else if ( (controlleft>0) && (controlright>0) ) /// one for left { si =controlleft /10; su = controlleft % 10; if(si>2) { si=2; } LCD_command(0x80); Delay_ms(2); LCD_data('R'); LCD_data('I'); LCD_data('G'); LCD_data('H'); LCD_data('T'); LCD_data(' '); LCD_data('S'); LCD_data('E'); LCD_data('A'); LCD_data('T'); LCD_data(' '); LCD_data(si +'0'); LCD_data(su +'0'); LCD_data(' '); LCD_data('C'); LCD_data(' '); LCD_command(0xC0); Delay_ms(2); LCD_data('L'); LCD_data('E'); LCD_data('F'); LCD_data('T'); LCD_data(' '); LCD_data(' '); LCD_data('S'); LCD_data('E'); LCD_data('A'); LCD_data('T'); LCD_data(' '); LCD_data(si +'0'); LCD_data(su +'0'); LCD_data(' '); LCD_data('C'); LCD_data(' '); } else if ( (controlright==0) && (controlleft>0) ) { si =controlleft /10; su = controlleft % 10; if(si>2) { si=2; } LCD_command(0x80); Delay_ms(2); LCD_data('R'); LCD_data('I'); LCD_data('G'); LCD_data('H'); LCD_data('T'); LCD_data(' '); LCD_data('S'); LCD_data('E'); LCD_data('A'); LCD_data('T'); LCD_data(' '); LCD_data('O'); LCD_data('F'); LCD_data('F'); LCD_data(' '); LCD_data(' '); LCD_data(' '); LCD_command(0xC0); Delay_ms(2); LCD_data('L'); LCD_data('E'); LCD_data('F'); LCD_data('T'); LCD_data(' '); LCD_data(' '); LCD_data('S'); LCD_data('E'); LCD_data('A'); LCD_data('T'); LCD_data(' '); LCD_data(si +'0'); LCD_data(su +'0'); LCD_data(' '); LCD_data(' '); LCD_data(' '); LCD_data(' '); } else if ((controlright>0) && (controlleft==0) ) { si =controlright /10; su = controlright % 10; if(si>2) { si=2; } LCD_command(0x80); Delay_ms(2); LCD_data('R'); LCD_data('I'); LCD_data('G'); LCD_data('H'); LCD_data('T'); LCD_data(' '); LCD_data('S'); LCD_data('E'); LCD_data('A'); LCD_data('T'); LCD_data(' '); LCD_data(si +'0'); LCD_data(su +'0'); LCD_data(' '); LCD_data('C'); LCD_data(' '); LCD_command(0xC0); Delay_ms(2); LCD_data('L'); LCD_data('E'); LCD_data('F'); LCD_data('T'); LCD_data(' '); LCD_data(' '); LCD_data('S'); LCD_data('E'); LCD_data('A'); LCD_data('T'); LCD_data(' '); LCD_data('O'); LCD_data('F'); LCD_data('F'); LCD_data(' '); LCD_data(' '); LCD_data('C'); LCD_data(' '); } }
33.564444
78
0.249603
c4ad1507fc7eda61e2a474fd9aab652863b11a49
3,083
h
C
ligra/edgeMapReduce.h
muwyse/ligra
d87dfa5d60a7d3307315a77401083c5187d391c3
[ "MIT" ]
389
2015-04-16T00:35:29.000Z
2022-03-16T10:33:24.000Z
ligra/edgeMapReduce.h
muwyse/ligra
d87dfa5d60a7d3307315a77401083c5187d391c3
[ "MIT" ]
27
2016-04-03T03:50:06.000Z
2021-07-29T08:00:20.000Z
ligra/edgeMapReduce.h
muwyse/ligra
d87dfa5d60a7d3307315a77401083c5187d391c3
[ "MIT" ]
148
2015-01-08T13:55:10.000Z
2022-03-10T17:35:38.000Z
#pragma once #include "ligra.h" #include "histogram.h" // edgeMapInduced // Version of edgeMapSparse that maps over the one-hop frontier and returns it as // a sparse array, without filtering. template <class E, class vertex, class VS, class F> inline vertexSubsetData<E> edgeMapInduced(graph<vertex>& GA, VS& V, F& f) { vertex *G = GA.V; uintT m = V.size(); V.toSparse(); auto degrees = array_imap<uintT>(m); granular_for(i, 0, m, (m > 2000), { vertex v = G[V.vtx(i)]; uintE degree = v.getOutDegree(); degrees[i] = degree; }); long outEdgeCount = pbbs::scan_add(degrees, degrees); if (outEdgeCount == 0) { return vertexSubsetData<E>(GA.n); } typedef tuple<uintE, E> VE; VE* outEdges = pbbs::new_array_no_init<VE>(outEdgeCount); auto gen = [&] (const uintE& ngh, const uintE& offset, const Maybe<E>& val = Maybe<E>()) { outEdges[offset] = make_tuple(ngh, val.t); }; parallel_for (size_t i = 0; i < m; i++) { uintT o = degrees[i]; auto v = V.vtx(i); G[v].template copyOutNgh<E>(v, o, f, gen); } auto vs = vertexSubsetData<E>(GA.n, outEdgeCount, outEdges); return vs; } template <class V, class vertex> struct EdgeMap { using K = uintE; // keys are always uintE's (vertex-identifiers) using KV = tuple<K, V>; graph<vertex>& G; pbbs::hist_table<K, V> ht; EdgeMap(graph<vertex>& _G, KV _empty, size_t ht_size=numeric_limits<size_t>::max()) : G(_G) { if (ht_size == numeric_limits<size_t>::max()) { ht_size = 1L << pbbs::log2_up(G.m/20); } else { ht_size = 1L << pbbs::log2_up(ht_size); } ht = pbbs::hist_table<K, V>(_empty, ht_size); } // map_f: (uintE v, uintE ngh) -> E // reduce_f: (E, tuple(uintE ngh, E ngh_val)) -> E // apply_f: (uintE ngh, E reduced_val) -> O template <class O, class M, class Map, class Reduce, class Apply, class VS> inline vertexSubsetData<O> edgeMapReduce(VS& vs, Map& map_f, Reduce& reduce_f, Apply& apply_f) { size_t m = vs.size(); if (m == 0) { return vertexSubsetData<O>(vs.numNonzeros()); } auto oneHop = edgeMapInduced<M, vertex, VS, Map>(G, vs, map_f); oneHop.toSparse(); auto get_elm = make_in_imap<tuple<K, M> >(oneHop.size(), [&] (size_t i) { return oneHop.vtxAndData(i); }); auto get_key = make_in_imap<uintE>(oneHop.size(), [&] (size_t i) -> uintE { return oneHop.vtx(i); }); auto q = [&] (sequentialHT<K, V>& S, tuple<K, M> v) -> void { S.template insertF<M>(v, reduce_f); }; auto res = pbbs::histogram_reduce<tuple<K, M>, tuple<K, O> >(get_elm, get_key, oneHop.size(), q, apply_f, ht); oneHop.del(); return vertexSubsetData<O>(vs.numNonzeros(), res.first, res.second); } template <class O, class Apply, class VS> inline vertexSubsetData<O> edgeMapCount(VS& vs, Apply& apply_f) { auto map_f = [] (const uintE& i, const uintE& j) { return pbbs::empty(); }; auto reduce_f = [&] (const uintE& cur, const tuple<uintE, pbbs::empty>& r) { return cur + 1; }; return edgeMapReduce<O, pbbs::empty>(vs, map_f, reduce_f, apply_f); } ~EdgeMap() { ht.del(); } };
35.436782
114
0.631528
a05c00cc3f3ae859c2931b3a0626730570768417
757
asm
Assembly
data/mapObjects/seafoamislands5.asm
adhi-thirumala/EvoYellow
6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c
[ "Unlicense" ]
16
2018-08-28T21:47:01.000Z
2022-02-20T20:29:59.000Z
data/mapObjects/seafoamislands5.asm
adhi-thirumala/EvoYellow
6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c
[ "Unlicense" ]
5
2019-04-03T19:53:11.000Z
2022-03-11T22:49:34.000Z
data/mapObjects/seafoamislands5.asm
adhi-thirumala/EvoYellow
6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c
[ "Unlicense" ]
2
2019-12-09T19:46:02.000Z
2020-12-05T21:36:30.000Z
SeafoamIslands5Object: db $7d ; border block db $4 ; warps db $11, $14, $5, SEAFOAM_ISLANDS_4 db $11, $15, $6, SEAFOAM_ISLANDS_4 db $7, $b, $1, SEAFOAM_ISLANDS_4 db $4, $19, $2, SEAFOAM_ISLANDS_4 db $2 ; signs db $f, $9, $4 ; SeafoamIslands5Text4 db $1, $17, $5 ; SeafoamIslands5Text5 db $3 ; objects object SPRITE_BOULDER, $4, $f, STAY, NONE, $1 ; person object SPRITE_BOULDER, $5, $f, STAY, NONE, $2 ; person object SPRITE_BIRD, $6, $1, STAY, DOWN, $3, ARTICUNO, 50 ; warp-to EVENT_DISP SEAFOAM_ISLANDS_5_WIDTH, $11, $14 ; SEAFOAM_ISLANDS_4 EVENT_DISP SEAFOAM_ISLANDS_5_WIDTH, $11, $15 ; SEAFOAM_ISLANDS_4 EVENT_DISP SEAFOAM_ISLANDS_5_WIDTH, $7, $b ; SEAFOAM_ISLANDS_4 EVENT_DISP SEAFOAM_ISLANDS_5_WIDTH, $4, $19 ; SEAFOAM_ISLANDS_4
31.541667
65
0.709379
f0827ff350329e8456da34903e3aafb85e4c8ff7
10,707
py
Python
blueprints/finance/views.py
shuxiang/MT-WMS
38ef18baed6d9eddb88d43da2eeed55988410daf
[ "Apache-2.0" ]
1
2022-03-11T05:42:25.000Z
2022-03-11T05:42:25.000Z
blueprints/finance/views.py
shuxiang/MT-WMS
38ef18baed6d9eddb88d43da2eeed55988410daf
[ "Apache-2.0" ]
null
null
null
blueprints/finance/views.py
shuxiang/MT-WMS
38ef18baed6d9eddb88d43da2eeed55988410daf
[ "Apache-2.0" ]
null
null
null
#coding=utf8 import json from sqlalchemy import func, or_ from pprint import pprint from datetime import datetime, timedelta from random import randint from flask import Blueprint, g, request, jsonify from flask_login import LoginManager, login_user, logout_user, login_required, current_user from extensions.database import db from extensions.permissions import admin_perm, manager_perm, normal_perm from models.inv import Inv, Good, Category, InvRfid from models.inv import InvMove, InvAdjust, InvCount from models.stockin import Stockin from models.stockout import Stockout from models.finance import Money, MoneySummary, MoneyAccount from models.auth import Partner from utils.flask_tools import json_response, gen_csv from utils.functions import gen_query, clear_empty, json2mdict, json2mdict_pop from utils.functions import update_model_with_fields, m2dict, copy_and_update_model, common_poplist from utils.functions import gen_query from utils.base import Dict, DictNone from blueprints.finance.action import FinanceAction import settings bp_finance = Blueprint("finance", __name__) # 获取订单统计数据-订单状态数量统计 @bp_finance.route('/money', methods=('GET', 'POST', 'PUT', 'PATCH', 'DELETE')) @bp_finance.route('/money/<int:money_id>', methods=('GET', 'POST', 'PUT', 'PATCH', 'DELETE')) @normal_perm.require() def money_api(money_id=None): if request.method == 'GET': query = Money.query.t_query res = gen_query(request.args.get('q', None), query, Money, db=db, per_page=settings.PER_PAGE) subq = Money.query.with_entities(func.sum(Money.amount).label('amount'), func.sum(Money.real).label('real'), func.sum(Money.bad).label('bad')).t_query subq = gen_query(request.args.get('q', None), subq, Money, db=db, export=True) income = subq.filter_by(come='income').order_by(None).group_by(Money.come).first() outcome = subq.filter_by(come='outcome').order_by(None).group_by(Money.come).first() res['income_amount'] = income.amount if income else 0 res['income_real'] = income.real if income else 0 res['income_bad'] = income.bad if income else 0 res['outcome_amount'] = outcome.amount if outcome else 0 res['outcome_real'] = outcome.real if outcome else 0 res['outcome_bad'] = outcome.bad if outcome else 0 return json_response(res) if request.method == 'POST': is_clear = request.json.pop('is_clear', False) date_forcount = request.json.pop('date_forcount', '') remark = request.json.pop('remark', '') m = Money(user_code=g.user.code, company_code=g.company_code, owner_code=g.owner_code, warehouse_code=g.warehouse_code, **json2mdict_pop(Money, clear_empty(request.json))) m.code = m.code.strip() db.session.add(m) m.is_clear = is_clear m.date_forcount = date_forcount[:10] if date_forcount else datetime.now().date() m.remark = remark if m.code: m.subcode = 'extra' if m.partner_code: _partner = Partner.query.c_query.filter_by(code=m.partner_code).first() if _partner: m.partner_str = '%s %s' % (_partner.name, _partner.tel or _partner.code) m.partner_name = _partner.name m.partner_id = _partner.id else: m.partner_str = m.partner_code db.session.commit() return json_response({'status': 'success', 'msg': 'ok', 'data': m.as_dict}) if request.method == 'PUT': is_clear = request.json.pop('is_clear', False) date_forcount = request.json.pop('date_forcount', '') remark = request.json.pop('remark', '') request.json.pop('real', None) m = Money.query.t_query.filter_by(id=money_id).first() m.update(json2mdict_pop(Money, clear_empty(request.json, False))) m.code = m.code.strip() m.is_clear = is_clear m.date_forcount = date_forcount[:10] or datetime.now().date() m.remark = remark or m.remark if m.code: m.subcode = 'extra' if m.partner_code: _partner = Partner.query.c_query.filter_by(code=m.partner_code).first() if _partner: m.partner_str = '%s %s' % (_partner.name, _partner.tel or _partner.code) m.partner_name = _partner.name m.partner_id = _partner.id else: m.partner_str = m.partner_code db.session.commit() return json_response({'status': 'success', 'msg': 'ok',}) if request.method == 'DELETE': m = Money.query.t_query.filter_by(id=money_id).with_for_update().first() if m.state == 'create': m.state = 'cancel' db.session.commit() return json_response({'status': 'success', 'msg': 'ok',}) return '' # 记录收款/付款流水 @bp_finance.route('/money/<action>/<int:money_id>', methods=('GET', 'POST', 'PUT', 'PATCH', 'DELETE')) @normal_perm.require() def money_action_api(action, money_id=None): """ post req: {real, money_id, ref_user_code, remark} """ if request.method == 'POST': action = FinanceAction() money = Money.query.t_query.filter_by(id=money_id).first() # (real, money, ref_user_code=None, remark='') ok = action.do_money_trans(money=money, **clear_empty(request.json)) db.session.commit() if ok: return json_response({'status': 'success', 'msg': 'ok'}) else: return json_response({'status': 'fail', 'msg': u'请输入正确的数字'}) return '' # 记录收款/付款流水查询 @bp_finance.route('/money/trans/<int:money_id>', methods=('GET', 'POST', 'PUT', 'PATCH', 'DELETE')) @normal_perm.require() def money_trans_api(money_id=None): m = Money.query.t_query.filter_by(id=money_id).first() data = [r.as_dict for r in m.lines] return json_response({'status': 'success', 'msg': u'ok', 'data': data}) # 获取订单统计数据-订单状态数量统计 @bp_finance.route('/money/summary', methods=('GET', 'POST', 'PUT', 'PATCH', 'DELETE')) @normal_perm.require() def money_summary_api(): if request.method == 'POST': month = request.json.get('month', None) xtype = request.json.get('xtype', None) come = request.json.get('come', None) action = FinanceAction() table, month = action.summary(month=month, xtype=xtype, come=come) return json_response({'status': 'success', 'data': table, 'month': month, 'msg': 'ok'}, indent=4) return '' # 按月份统计数据-最近12个月的数据 @bp_finance.route('/money/month/summary', methods=('GET', 'POST')) @normal_perm.require() def money_month_summary_api(): action = FinanceAction() now = datetime.now() year_ago = now.date() - timedelta(days=365) mon = func.date_format(Money.date_forcount, '%Y-%m').label('mon') current_mon = now.strftime('%Y-%m') real = func.sum(Money.real).label('real') for m in Money.query.with_entities(Money.xtype, Money.come, mon).t_query.filter(Money.date_forcount > year_ago).group_by(Money.xtype, Money.come, mon).all(): # print m.xtype, m.come, m.mon table1 = [] table2 = [] if MoneySummary.query.t_query.filter_by(xtype=m.xtype, come=m.come, month=m.mon).count() == 0: table1, month1 = action.summary(m.mon, m.xtype, m.come) if MoneySummary.query.t_query.filter_by(come=m.come, month=m.mon).count() == 0: table2, month2 = action.summary(m.mon, come=m.come) for t in table1+table2: if MoneySummary.query.t_query.filter_by(xtype=t.xtype, come=t.come, month=m.mon).count() == 0: ms = MoneySummary(company_code=g.company_code, owner_code=g.owner_code, warehouse_code=g.warehouse_code) # ms.real = t.real ms.real = t.month_real ms.amount = t.amount ms.xtype = t.xtype ms.come = t.come ms.month = m.mon db.session.add(ms) # 当前月会刷新 else: if m.mon == current_mon: ms = MoneySummary.query.t_query.filter_by(xtype=t.xtype, come=t.come, month=m.mon).first() ms.real = t.month_real ms.amount = t.amount db.session.commit() data = DictNone({'in':[], 'out':[], 'in_real':[], 'out_real':[]}) res = MoneySummary.query.t_query.filter(MoneySummary.month > year_ago.strftime('%Y-%m'), MoneySummary.xtype=='').order_by(MoneySummary.month.asc()).all() data.category = list(set([r.month for r in res])) data.category.sort() ind = {r.month:r for r in res if r.come == 'income'} outd = {r.month:r for r in res if r.come == 'outcome'} for c in data.category: d = ind.get(c, None) data['in'].append(d.amount if d else 0) data['in_real'].append(d.real if d else 0) d = outd.get(c, None) data['out'].append(d.amount if d else 0) data['out_real'].append(d.real if d else 0) return json_response(data, indent=4) # 获取订单统计数据-订单状态数量统计 @bp_finance.route('/money/account', methods=('GET', 'POST', 'PUT', 'PATCH', 'DELETE')) @bp_finance.route('/money/account/<int:account_id>', methods=('GET', 'POST', 'PUT', 'PATCH', 'DELETE')) @normal_perm.require() def money_account_api(account_id=None): if request.method == 'GET': query = MoneyAccount.query.t_query res = gen_query(request.args.get('q', None), query, MoneyAccount, db=db, per_page=settings.PER_PAGE) return json_response(res) if request.method == 'POST': remark = request.json.pop('remark', '') m = MoneyAccount(company_code=g.company_code, owner_code=g.owner_code, warehouse_code=g.warehouse_code, **json2mdict_pop(MoneyAccount, clear_empty(request.json))) db.session.add(m) m.remark = remark m.set_longname() db.session.commit() return json_response({'status': 'success', 'msg': 'ok', 'data': m.as_dict}) if request.method == 'PUT': remark = request.json.pop('remark', '') m = MoneyAccount.query.t_query.filter_by(id=account_id).first() m.update(json2mdict_pop(MoneyAccount, clear_empty(request.json, False))) m.remark = remark or m.remark m.set_longname() db.session.commit() return json_response({'status': 'success', 'msg': 'ok',}) if request.method == 'DELETE': m = MoneyAccount.query.t_query.filter_by(id=MoneyAccount_id).with_for_update().first() if m.state == 'on': m.state = 'off' db.session.commit() return json_response({'status': 'success', 'msg': 'ok',}) return ''
39.21978
161
0.631082
628c303fbc8fbbfb32e3832e8c50c5da77ffe438
385
rs
Rust
src/error.rs
duncandean/luno-rust
28498862f8088e68272407d6999558baa43b16fd
[ "MIT" ]
2
2019-12-10T10:47:07.000Z
2021-04-17T17:35:08.000Z
src/error.rs
duncandean/luno-rust
28498862f8088e68272407d6999558baa43b16fd
[ "MIT" ]
58
2019-08-19T08:49:11.000Z
2021-06-25T15:24:37.000Z
src/error.rs
dunxen/luno-rust
28498862f8088e68272407d6999558baa43b16fd
[ "MIT" ]
4
2019-07-09T19:01:29.000Z
2020-09-10T08:05:03.000Z
use thiserror::Error; /// LunoError is the wrapper error type for this crate to help differentiate it from /// more generic errors in your application. #[derive(Error, Debug)] pub enum LunoError { #[error("Network error encountered")] HttpError(reqwest::Error), } impl From<reqwest::Error> for LunoError { fn from(item: reqwest::Error) -> Self { LunoError::HttpError(item) } }
24.0625
84
0.724675
857eba492ba1131fa75e48be9b87af1600e17493
8,090
js
JavaScript
src/App/Market/index.js
cyptoman/NexusInterface
b2b654a79c696d6249b8cd438ae86679aea1e264
[ "MIT" ]
null
null
null
src/App/Market/index.js
cyptoman/NexusInterface
b2b654a79c696d6249b8cd438ae86679aea1e264
[ "MIT" ]
null
null
null
src/App/Market/index.js
cyptoman/NexusInterface
b2b654a79c696d6249b8cd438ae86679aea1e264
[ "MIT" ]
null
null
null
// External Dependencies import React, { Component } from 'react'; import { connect } from 'react-redux'; import { shell } from 'electron'; import styled from '@emotion/styled'; import Tooltip from 'components/Tooltip'; import Button from 'components/Button'; import syncingIcon from 'icons/syncing.svg'; import GA from 'lib/googleAnalytics'; import { showNotification } from 'lib/ui'; // Internal Global Dependencies import Icon from 'components/Icon'; import Panel from 'components/Panel'; import { binanceDepthLoader, bittrexDepthLoader, binance24hrInfo, bittrex24hrInfo, binanceCandlestickLoader, bittrexCandlestickLoader, } from 'lib/market'; // Internal Local Dependencies import MarketDepth from './Chart/MarketDepth'; import Candlestick from './Chart/Candlestick'; // Images import chartIcon from 'icons/chart.svg'; import bittrexLogo from 'icons/BittrexLogo.png'; import binanceLogo from 'icons/BINANCE.png'; const ExchangeUnitContainer = styled.div({ width: '100%', }); const MarketInfoContainer = styled.div({ display: 'flex', flexDirection: 'row', width: '100%', margin: '1.5em 0', borderTop: '1px solid #333', }); const ExchangeLogo = styled.img({ height: 60, }); const OneDay = styled.div({ display: 'grid', gridTemplateColumns: 'auto auto', }); // React-Redux mandatory methods const mapStateToProps = state => { return { ...state.market, ...state.common, ...state.intl, theme: state.theme, settings: state.settings, }; }; /** * The Market Page * * @class Market * @extends {Component} */ class Market extends Component { // React Method (Life cycle hook) componentDidMount() { this.refresher(); GA.SendScreen('Market'); } /** * Refreshes the data from the markets * * @memberof Market */ refresher() { let any = this; binanceDepthLoader(); bittrexDepthLoader(); binanceCandlestickLoader(any); bittrexCandlestickLoader(any); binance24hrInfo(); bittrex24hrInfo(); } /** * Formats the buy data and returns it * * @memberof Market */ formatBuyData = array => { const { locale } = this.props.settings; let newQuantity = 0; let prevQuantity = 0; let finnishedArray = array .map(e => { newQuantity = prevQuantity + e.Volume; prevQuantity = newQuantity; if (e.Price < array[0].Price * 0.05) { return { x: 0, y: newQuantity, }; } else { return { x: e.Price, y: newQuantity, label: `${__('Price')}: ${e.Price} \n ${__( 'Volume' )}: ${newQuantity}`, }; } }) .filter(e => e.x > 0); return finnishedArray; }; /** * Formats the sell data and returns it * * @param {*} array * @returns * @memberof Market */ formatSellData(array) { let newQuantity = 0; let prevQuantity = 0; let finnishedArray = array .sort((a, b) => b.Rate - a.Rate) .map(e => { newQuantity = prevQuantity + e.Volume; prevQuantity = newQuantity; if (e.Price < array[0].Price * 0.05) { return { x: 0, y: newQuantity, }; } else { return { x: e.Price, y: newQuantity, label: `${__('Price')}: ${e.Price} \n ${__( 'Volume' )}: ${newQuantity}`, }; } }) .filter(e => e.x > 0); return finnishedArray; } /** * Formats the Exchange Data * * @param {*} exchange * @returns * @memberof Market */ formatChartData(exchange) { const dataSetArray = []; switch (exchange) { case 'binanceBuy': return this.formatBuyData(this.props.binance.buy); break; case 'binanceSell': return this.formatBuyData(this.props.binance.sell); break; case 'bittrexBuy': return this.formatBuyData(this.props.bittrex.buy); break; case 'bittrexSell': return this.formatBuyData(this.props.bittrex.sell); break; default: return []; break; } } /** * Returns a Div of various market data from the Exchange Name * * @param {*} exchangeName * @returns * @memberof Market */ oneDayinfo(exchangeName) { return ( <> <div style={{ display: 'table-cell', verticalAlign: 'middle', }} > <b>{__('24hr Change')}</b> </div> <OneDay> <div> <b>{__('High')}: </b> {this.props[exchangeName].info24hr.high} {' BTC '} </div> <div> <b>{__('Price Change')}: </b> {this.props[exchangeName].info24hr.change} {' %'} </div> <div> <b>{__('Low')}: </b> {this.props[exchangeName].info24hr.low} {' BTC '} </div> <div> <b>{__('Volume')}: </b> {this.props[exchangeName].info24hr.volume} {' NXS '} </div> </OneDay> </> ); } /** * Refreshes the market data and shows a notification * * @memberof Market */ refreshMarket() { this.refresher(); showNotification(__('Refreshing market data...'), 'success'); } // Mandatory React method /** * Component's Renderable JSX * * @returns * @memberof Market */ render() { return ( <Panel controls={ <Tooltip.Trigger tooltip={__('Refresh')}> <Button square skin="primary" onClick={() => this.refreshMarket()}> <Icon icon={syncingIcon} /> </Button> </Tooltip.Trigger> } icon={chartIcon} title={__('Market Data')} > {this.props.loaded && this.props.binance.buy[0] && ( <ExchangeUnitContainer> <ExchangeLogo src={binanceLogo} onClick={() => { shell.openExternal('https://www.binance.com/en/trade/NXS_BTC'); }} /> {this.oneDayinfo('binance')} <MarketInfoContainer> <MarketDepth locale={this.props.settings.locale} chartData={this.formatChartData('binanceBuy')} chartSellData={this.formatChartData('binanceSell')} theme={this.props.theme} /> {this.props.binance.candlesticks[0] !== undefined ? ( <Candlestick locale={this.props.settings.locale} data={this.props.binance.candlesticks} theme={this.props.theme} /> ) : null} </MarketInfoContainer> </ExchangeUnitContainer> )} {this.props.loaded && this.props.bittrex.buy[0] && ( <ExchangeUnitContainer> <ExchangeLogo src={bittrexLogo} onClick={() => { shell.openExternal( 'https://bittrex.com/Market/Index?MarketName=BTC-NXS' ); }} /> {this.oneDayinfo('bittrex')} <MarketInfoContainer> <br /> <MarketDepth locale={this.props.settings.locale} chartData={this.formatChartData('bittrexBuy')} chartSellData={this.formatChartData('bittrexSell')} theme={this.props.theme} /> {this.props.bittrex.candlesticks[0] !== undefined ? ( <Candlestick locale={this.props.settings.locale} data={this.props.bittrex.candlesticks} theme={this.props.theme} /> ) : null} </MarketInfoContainer> </ExchangeUnitContainer> )} </Panel> ); } } // Mandatory React-Redux method export default connect(mapStateToProps)(Market);
24.815951
79
0.529419
6063078219bec497541ddfeb2be4eb8d4e73181e
3,031
kt
Kotlin
app/src/main/java/com/beone/bestpractice/ui/CountryFragment.kt
daisukikancolle/Corona
36916a05c90e24b352fb4d28b217e059ca5b9416
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/beone/bestpractice/ui/CountryFragment.kt
daisukikancolle/Corona
36916a05c90e24b352fb4d28b217e059ca5b9416
[ "Apache-2.0" ]
1
2021-09-24T09:36:18.000Z
2021-09-24T09:36:27.000Z
app/src/main/java/com/beone/bestpractice/ui/CountryFragment.kt
BAndersonMatjik/Corona
0d02278cf91412e86e201c48bb43d9ba53208361
[ "Apache-2.0" ]
null
null
null
package com.beone.bestpractice.ui import android.content.Intent import android.os.Bundle import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.appcompat.app.AppCompatDelegate import androidx.fragment.app.Fragment import androidx.lifecycle.Observer import com.beone.bestpractice.R import com.example.core.data.Resource import com.example.core.domain.model.Country import com.example.core.ui.CountryMultipleTypeAdapter import com.example.core.ui.OnClickItemListener import kotlinx.android.synthetic.main.country_fragment.* import org.koin.android.viewmodel.ext.android.viewModel class CountryFragment : Fragment(), OnClickItemListener { private val mViewModel: CountryViewModel by viewModel() private lateinit var countryMultipleTypeAdapter: CountryMultipleTypeAdapter override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { val v = inflater.inflate(R.layout.country_fragment, container, false) AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM) countryMultipleTypeAdapter = CountryMultipleTypeAdapter("Covid 19", requireContext(), this) return v } override fun onActivityCreated(savedInstanceState: Bundle?) { super.onActivityCreated(savedInstanceState) tv_favoriteList.setOnClickListener { val fragmentTransaction = activity?.supportFragmentManager?.beginTransaction() fragmentTransaction?.addToBackStack("favorite")?.replace(R.id.framelayout, FavoriteFragment(), null) ?.commit() } mViewModel.country.observe(viewLifecycleOwner, Observer { if (it != null) { when (it) { is Resource.Loading -> Log.d(TAG, "onViewCreated: Loading") is Resource.Success -> { Log.d(TAG, "onViewCreated: Success") countryMultipleTypeAdapter.updatedata(it.data) } is Resource.Error -> { Log.d(TAG, "onViewCreated: Error") } } } }) } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) with(recyclerview){ this?.setHasFixedSize(true) this?.adapter = countryMultipleTypeAdapter } } override fun <T> onClick(data: T) { val i = Intent(requireContext().applicationContext, Class.forName("com.example.favoritefeature.DetailActivity")) val datas: Country? = data as Country? i.putExtra("COUNTRYBUNDLE",datas) startActivity(i) } override fun onDestroyView() { recyclerview.adapter = null super.onDestroyView() } companion object { private val TAG = CountryFragment::class.java.name } }
36.963415
120
0.669746
7ab857df6228e94f4f6040cdaca17ab8ee9be679
1,667
rs
Rust
src/compiler/support.rs
PascalPrecht/vibranium
9da0008166cd6c026f2bd838f92b70b6994c6f5e
[ "MIT" ]
12
2019-04-20T16:01:24.000Z
2020-09-08T17:08:10.000Z
src/compiler/support.rs
PascalPrecht/vibranium
9da0008166cd6c026f2bd838f92b70b6994c6f5e
[ "MIT" ]
43
2019-04-06T14:08:51.000Z
2022-02-22T14:33:08.000Z
src/compiler/support.rs
PascalPrecht/vibranium
9da0008166cd6c026f2bd838f92b70b6994c6f5e
[ "MIT" ]
2
2019-08-22T09:18:54.000Z
2020-01-17T07:26:17.000Z
use super::error; use std::str::FromStr; use std::string::ToString; const SOLC_COMPILER_BINARY_UNIX: &str = "solc"; const SOLC_COMPILER_BINARY_WINDOWS: &str = "solc.exe"; const SOLC_JS_COMPILER_BINARY: &str = "solcjs"; pub enum SupportedCompilers { Solc, SolcJs, } impl SupportedCompilers { pub fn executable(&self) -> String { match self { SupportedCompilers::Solc => { if cfg!(target_os = "windows") { SOLC_COMPILER_BINARY_WINDOWS.to_string() } else { SOLC_COMPILER_BINARY_UNIX.to_string() } } SupportedCompilers::SolcJs => SOLC_JS_COMPILER_BINARY.to_string(), } } } impl FromStr for SupportedCompilers { type Err = error::CompilerError; fn from_str(s: &str) -> Result<Self, Self::Err> { match s { SOLC_COMPILER_BINARY_UNIX => Ok(SupportedCompilers::Solc), SOLC_JS_COMPILER_BINARY => Ok(SupportedCompilers::SolcJs), _ => Err(error::CompilerError::UnsupportedStrategy), } } } impl ToString for SupportedCompilers { fn to_string(&self) -> String { match self { SupportedCompilers::Solc => SOLC_COMPILER_BINARY_UNIX.to_string(), SupportedCompilers::SolcJs => SOLC_JS_COMPILER_BINARY.to_string(), } } } pub fn default_options_from(compiler: SupportedCompilers) -> Vec<String> { match compiler { SupportedCompilers::Solc => { vec![ "--abi".to_string(), "--bin".to_string(), "--overwrite".to_string(), "-o".to_string() ] }, SupportedCompilers::SolcJs => { vec![ "--abi".to_string(), "--bin".to_string(), "-o".to_string() ] }, } }
24.15942
74
0.629874
77733b3e8607ff3c82c9da06ba10dba5e11bd6e8
1,115
swift
Swift
HeartRateApp/HeartRateApp/Extensions/UIImage/UIImage+AverageColor.swift
morarivasile/PET_Heart-Rate-App
16bf13ecee0d66abca6a2c9dcc96eda6d8ed4f9c
[ "MIT" ]
null
null
null
HeartRateApp/HeartRateApp/Extensions/UIImage/UIImage+AverageColor.swift
morarivasile/PET_Heart-Rate-App
16bf13ecee0d66abca6a2c9dcc96eda6d8ed4f9c
[ "MIT" ]
null
null
null
HeartRateApp/HeartRateApp/Extensions/UIImage/UIImage+AverageColor.swift
morarivasile/PET_Heart-Rate-App
16bf13ecee0d66abca6a2c9dcc96eda6d8ed4f9c
[ "MIT" ]
1
2021-04-02T02:27:24.000Z
2021-04-02T02:27:24.000Z
// // UIImage+AverageColor.swift // HeartRateApp // // Created by Vasile Morari on 20/07/2020. // Copyright © 2020 Vasile Morari. All rights reserved. // import UIKit extension UIImage { var averageColor: UIColor? { guard let inputImage = self.ciImage ?? CIImage(image: self) else { return nil } guard let filter = CIFilter(name: "CIAreaAverage", parameters: [kCIInputImageKey: inputImage, kCIInputExtentKey: CIVector(cgRect: inputImage.extent)]) else { return nil } guard let outputImage = filter.outputImage else { return nil } var bitmap = [UInt8](repeating: 0, count: 4) let context = CIContext(options: [CIContextOption.workingColorSpace : kCFNull as Any]) let outputImageRect = CGRect(x: 0, y: 0, width: 1, height: 1) context.render(outputImage, toBitmap: &bitmap, rowBytes: 4, bounds: outputImageRect, format: CIFormat.RGBA8, colorSpace: nil) return UIColor(red: CGFloat(bitmap[0]) / 255, green: CGFloat(bitmap[1]) / 255, blue: CGFloat(bitmap[2]) / 255, alpha: CGFloat(bitmap[3]) / 255) } }
41.296296
158
0.66278
aba5c0577f2fb2cafeb18be3688b237b599098c3
160
sql
SQL
src/test/resources/aggerror.test_2.sql
jdkoren/sqlite-parser
9adf75ff5eca36f6e541594d2e062349f9ced654
[ "MIT" ]
131
2015-03-31T18:59:14.000Z
2022-03-09T09:51:06.000Z
src/test/resources/aggerror.test_2.sql
jdkoren/sqlite-parser
9adf75ff5eca36f6e541594d2e062349f9ced654
[ "MIT" ]
20
2015-03-31T21:35:38.000Z
2018-07-02T16:15:51.000Z
src/test/resources/aggerror.test_2.sql
jdkoren/sqlite-parser
9adf75ff5eca36f6e541594d2e062349f9ced654
[ "MIT" ]
43
2015-04-28T02:01:55.000Z
2021-06-06T09:33:38.000Z
-- aggerror.test -- -- execsql { -- INSERT INTO t1 VALUES(40); -- SELECT x_count(*) FROM t1; -- } INSERT INTO t1 VALUES(40); SELECT x_count(*) FROM t1;
20
33
0.60625
be56969506f630096ab16c990f4605efac6d6c4a
1,718
sql
SQL
src/main/resources/resources/evidence/sql/negativecontrols/findDrugIndications.sql
shukia/WebAPI-unsafe
aadce01f167efc5bd129cd9eddfca83f030d2bba
[ "Apache-2.0" ]
null
null
null
src/main/resources/resources/evidence/sql/negativecontrols/findDrugIndications.sql
shukia/WebAPI-unsafe
aadce01f167efc5bd129cd9eddfca83f030d2bba
[ "Apache-2.0" ]
null
null
null
src/main/resources/resources/evidence/sql/negativecontrols/findDrugIndications.sql
shukia/WebAPI-unsafe
aadce01f167efc5bd129cd9eddfca83f030d2bba
[ "Apache-2.0" ]
null
null
null
SELECT DISTINCT DESCENDANT_CONCEPT_ID AS CONCEPT_ID INTO #TEMP_COI FROM @vocabulary.CONCEPT_ANCESTOR WHERE ANCESTOR_CONCEPT_ID IN ( @conceptsOfInterest ); CREATE INDEX IDX_TEMP_COI ON #TEMP_COI (CONCEPT_ID); {@outcomeOfInterest == 'condition'}?{ SELECT DISTINCT c3.CONCEPT_ID INTO #NC_INDICATIONS FROM @vocabulary.CONCEPT c1 JOIN @vocabulary.CONCEPT_ANCESTOR ca1 ON ca1.ANCESTOR_CONCEPT_ID = c1.CONCEPT_ID JOIN @vocabulary.CONCEPT c2 ON c2.CONCEPT_ID = ca1.DESCENDANT_CONCEPT_ID AND UPPER(c2.DOMAIN_ID) = 'DRUG' JOIN #TEMP_COI coi ON coi.CONCEPT_ID = c2.CONCEPT_ID JOIN @vocabulary.CONCEPT_RELATIONSHIP cr1 ON cr1.CONCEPT_ID_1 = c1.CONCEPT_ID JOIN @vocabulary.CONCEPT c3 /*Map Indications to SNOMED*/ ON c3.CONCEPT_ID = cr1.CONCEPT_ID_2 AND UPPER(c3.DOMAIN_ID) = 'CONDITION' AND UPPER(c3.STANDARD_CONCEPT) = 'S' WHERE UPPER(c1.VOCABULARY_ID) IN ( 'INDICATION', 'IND / CI' ) AND c1.INVALID_REASON IS NULL; } {@outcomeOfInterest == 'drug'}?{ SELECT DISTINCT c3.CONCEPT_ID INTO #NC_INDICATIONS FROM #TEMP_COI coi JOIN @vocabulary.CONCEPT_RELATIONSHIP cr1 ON cr1.CONCEPT_ID_2 = coi.CONCEPT_ID JOIN @vocabulary.CONCEPT c1 ON c1.CONCEPT_ID = cr1.CONCEPT_ID_1 AND UPPER(c1.VOCABULARY_ID) IN ( 'INDICATION', 'IND / CI' ) AND c1.INVALID_REASON IS NULL JOIN @vocabulary.CONCEPT_RELATIONSHIP cr2 ON cr2.CONCEPT_ID_1 = c1.CONCEPT_ID JOIN @vocabulary.CONCEPT_ANCESTOR ca1 ON ca1.DESCENDANT_CONCEPT_ID = cr2.CONCEPT_ID_2 JOIN @vocabulary.CONCEPT c3 ON c3.CONCEPT_ID = ca1.ANCESTOR_CONCEPT_ID AND UPPER(c3.CONCEPT_CLASS_ID)= 'INGREDIENT' AND UPPER(c3.DOMAIN_ID) = 'DRUG' AND c3.STANDARD_CONCEPT = 'S'; }
35.791667
87
0.739232
befc221ae94220937570e9f42b42f3a888b81013
1,675
html
HTML
zzzphp/plugins/ad/show_up/index.html
Earth-Online/poc_test
5936f18e614c667b66be67a27a2ea29267c0014f
[ "Apache-2.0" ]
null
null
null
zzzphp/plugins/ad/show_up/index.html
Earth-Online/poc_test
5936f18e614c667b66be67a27a2ea29267c0014f
[ "Apache-2.0" ]
null
null
null
zzzphp/plugins/ad/show_up/index.html
Earth-Online/poc_test
5936f18e614c667b66be67a27a2ea29267c0014f
[ "Apache-2.0" ]
2
2019-01-29T06:31:53.000Z
2020-05-19T13:37:13.000Z
<style type="text/css"> .advbox{width:100%;margin:0 auto;} .advbox .dt_toBig, .advbox .dt_toSmall{position:absolute;left:50%;margin:5px 0px 0px 460px;width:49px;height:21px; text-align:center; background:#FFF;cursor:pointer;} .dt_toBiga{ display:block; width:100%;height:60px; background-repeat:no-repeat} .dt_toSmalla{ display:block;width:100%; height:[height]px; background-repeat:no-repeat} </style> <div class="advbox"> <div class="dt_small" style="display:none;"> <div class="dt_toBig" style="display:none;">+ 展开</div> <a href="[link]" target="_blank" style="background:url([pic]) top center;" class="dt_toBiga"></a> </div> <div class="dt_big"> <div class="dt_toSmall">× 关闭</div> <a href="[link]" target="_blank" class="dt_toSmalla">[content]</a> </div> </div> <script type="text/javascript"> function AdvClick(){ var a=1500; var b=3*1000; $(".dt_toSmall").click(function(){ $(".dt_small").delay(a).slideDown(a); $(".dt_big").stop().slideUp(a); $(".dt_toSmall").stop().fadeOut(0); $(".dt_toBig").delay(a*2).fadeIn(0) });$ (".dt_toBig").click(function(){ $(".dt_big").delay(a).slideDown(a); $(".dt_small").stop().slideUp(a); $(".dt_toBig").stop().fadeOut(0); $(".dt_toSmall").delay(a*2).fadeIn(0) }) } function AdvAuto(){ if($(".dt_big").length>0){ var a=1500; var b=3*1000; $(".dt_big").delay(b).slideUp(a,function(){ $(".dt_small").slideDown(a); $(".dt_toBig").delay(a).fadeIn(0) }); $(".dt_toSmall").delay(b).fadeOut(0) } } $(document).ready(function(){ AdvClick(); }); //顶部通览可展开收起效果 if($("#actionimg").length>0){ $("#actionimg").onload=AdvAuto(); } </script>
32.211538
167
0.625075
9b9d8004b238fe2819acc560796f82bf8eaf03ed
4,544
js
JavaScript
ForumArchive/acc/post_11959_page_2.js
doc22940/Extensions
d8dbc9be08e0b8c0bd6b72e068ef73223d2799a8
[ "Apache-2.0" ]
136
2015-01-01T17:33:35.000Z
2022-02-26T16:38:08.000Z
ForumArchive/acc/post_11959_page_2.js
doc22940/Extensions
d8dbc9be08e0b8c0bd6b72e068ef73223d2799a8
[ "Apache-2.0" ]
60
2015-06-20T00:39:16.000Z
2021-09-02T22:55:27.000Z
ForumArchive/acc/post_11959_page_2.js
doc22940/Extensions
d8dbc9be08e0b8c0bd6b72e068ef73223d2799a8
[ "Apache-2.0" ]
141
2015-04-29T09:50:11.000Z
2022-03-18T09:20:44.000Z
[{"Owner":"davrous","Date":"2015-02-02T18:12:48Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_Hi Vousk_co__lt_/p_gt__lt_p_gt_ _lt_/p_gt__lt_p_gt_ No_co_ the idea is to export from Unity to Babylon.js (like from Blender or 3DS Max). Lot of people are using Unity because it_t_s cross-platforms but also mainly because it_t_s very easy to use and have a huge assets online to start with._lt_/p_gt__lt_p_gt_ _lt_/p_gt__lt_p_gt_ Our idea is to export everything expect the Unity game logic (based on Mono)_dd_ the complete scene with meshes_co_ materials_co_ lights_co_ camera_co_ spatial sounds &amp_sm_ so on._lt_/p_gt__lt_p_gt_ _lt_/p_gt__lt_p_gt_ Babylon.js has been made for the web and has probably the best support for all platforms_co_ including mobile. The Web developer could then build the scene into Unity and finish coding the game_t_s logic in JS/TS via his favorite tools._lt_/p_gt__lt_p_gt_ _lt_/p_gt__lt_p_gt_Bye_co__lt_/p_gt__lt_p_gt_ _lt_/p_gt__lt_p_gt_David_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"gryff","Date":"2015-02-02T18:20:24Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_blockquote data-ipsquote_eq__qt__qt_ class_eq__qt_ipsQuote_qt__gt__lt_div_gt_the complete scene with meshes_co_ materials_co_ lights_co_ camera_co_ spatial sounds &amp_sm_ so on._lt_/div_gt__lt_/blockquote_gt__lt_p_gt_ _lt_/p_gt__lt_p_gt_Including shaders and shape keys David?_lt_/p_gt__lt_p_gt_ _lt_/p_gt__lt_p_gt_cheers_co_ gryff _lt_img src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_smile.png_qt_ alt_eq__qt__dd_)_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/smile@2x.png 2x_qt_ width_eq__qt_20_qt_ height_eq__qt_20_qt__gt__lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Vousk-prod.","Date":"2015-02-02T18:30:12Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_Woah great !!_lt_/p_gt__lt_p_gt_I also find that BJS is the best 3D support for multiplateform apps. It_t_s never said enough that _lt_strong_gt_BJS ROCKS !!!_lt_/strong_gt__lt_/p_gt__lt_p_gt_ _lt_/p_gt__lt_p_gt_But since Unity can now export to WebGL_co_ people starting to construct a scene in Unity will certainly also script it in Unity_co_ don_t_t you think ?_lt_/p_gt__lt_p_gt_ _lt_/p_gt__lt_p_gt_Anyway_co_ for me it could lead to sweet opportunities to extend some already existing Unity projects by porting 3D parts to BJS. Love the idea !_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Vousk-prod.","Date":"2015-04-13T19:06:37Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_I_t_ve just seen the first Git commit about the Unity exporter !! That_t_s AMAZINNGGGGG !!!!!_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Deltakosh","Date":"2015-04-13T19:40:12Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_David has an really interesting opinion about unity 5 webgl exporter_dd__lt_/p_gt__lt_p_gt__lt_a href_eq__qt_https_dd_//news.ycombinator.com/item?id_eq_9339318_qt_ rel_eq__qt_external nofollow_qt__gt_https_dd_//news.ycombinator.com/item?id_eq_9339318_lt_/a_gt__lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Vousk-prod.","Date":"2015-04-27T17:50:28Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_Hi davrous_co__lt_/p_gt__lt_p_gt_ _lt_/p_gt__lt_p_gt_I_t_ve just tested the Unity exporter with an object having a cubemap as reflexion map_co_ there are some problems _dd__lt_/p_gt__lt_p_gt_- the cubemap texture files are not exported_co_ we need to copy them by hand_lt_/p_gt__lt_p_gt_- the .babylon file also refers to a .cubemap unity file_co_ the loader is trying to get it as a picture but it_t_s not one_co_ I_t_m pretty sure this file can_t_t be used by BJS but the exporter referenced it in the produced .babylon file_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Deltakosh","Date":"2015-04-27T17:52:11Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_Hey Vousk_co_ we are looking for some help on this area. Feel free to contribute if you can fix these issues_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"}]
4,544
4,544
0.827025
a11828acca39466190d8840ccfb701c620b9f8e7
2,981
go
Go
x/gamm/client/testutil/test_helpers.go
CrackLord/osmosis
2e3966f5bfc799d9fa70f4e7faf0cb9963eda92e
[ "Apache-2.0" ]
426
2021-02-19T09:49:00.000Z
2022-03-31T01:53:18.000Z
x/gamm/client/testutil/test_helpers.go
CrackLord/osmosis
2e3966f5bfc799d9fa70f4e7faf0cb9963eda92e
[ "Apache-2.0" ]
928
2021-02-20T00:22:27.000Z
2022-03-31T22:52:28.000Z
x/gamm/client/testutil/test_helpers.go
CrackLord/osmosis
2e3966f5bfc799d9fa70f4e7faf0cb9963eda92e
[ "Apache-2.0" ]
160
2021-02-21T00:34:45.000Z
2022-03-28T01:40:15.000Z
package testutil import ( "fmt" "testing" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/testutil" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" sdk "github.com/cosmos/cosmos-sdk/types" gammcli "github.com/osmosis-labs/osmosis/x/gamm/client/cli" ) // commonArgs is args for CLI test commands var commonArgs = []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), } // MsgCreatePool broadcast a pool creation message. func MsgCreatePool( t *testing.T, clientCtx client.Context, owner fmt.Stringer, tokenWeights string, initialDeposit string, swapFee string, exitFee string, futureGovernor string, extraArgs ...string, ) (testutil.BufferWriter, error) { args := []string{} jsonFile := testutil.WriteToNewTempFile(t, fmt.Sprintf(` { "%s": "%s", "%s": "%s", "%s": "%s", "%s": "%s", "%s": "%s" } `, gammcli.PoolFileWeights, tokenWeights, gammcli.PoolFileInitialDeposit, initialDeposit, gammcli.PoolFileSwapFee, swapFee, gammcli.PoolFileExitFee, exitFee, gammcli.PoolFileExitFee, exitFee, ), ) args = append(args, fmt.Sprintf("--%s=%s", gammcli.FlagPoolFile, jsonFile.Name()), fmt.Sprintf("--%s=%s", flags.FlagFrom, owner.String()), fmt.Sprintf("--%s=%d", flags.FlagGas, 300000), ) args = append(args, commonArgs...) return clitestutil.ExecTestCLICmd(clientCtx, gammcli.NewCreatePoolCmd(), args) } // MsgJoinPool broadcast pool join message. func MsgJoinPool(clientCtx client.Context, owner fmt.Stringer, poolID uint64, shareAmtOut string, maxAmountsIn []string, extraArgs ...string) (testutil.BufferWriter, error) { args := []string{ fmt.Sprintf("--%s=%d", gammcli.FlagPoolId, poolID), fmt.Sprintf("--%s=%s", gammcli.FlagShareAmountOut, shareAmtOut), fmt.Sprintf("--%s=%s", flags.FlagFrom, owner.String()), } for _, maxAmt := range maxAmountsIn { args = append(args, fmt.Sprintf("--%s=%s", gammcli.FlagMaxAmountsIn, maxAmt)) } args = append(args, commonArgs...) return clitestutil.ExecTestCLICmd(clientCtx, gammcli.NewJoinPoolCmd(), args) } // MsgExitPool broadcast a pool exit message func MsgExitPool(clientCtx client.Context, owner fmt.Stringer, poolID uint64, shareAmtIn string, minAmountsOut []string, extraArgs ...string) (testutil.BufferWriter, error) { args := []string{ fmt.Sprintf("--%s=%d", gammcli.FlagPoolId, poolID), fmt.Sprintf("--%s=%s", gammcli.FlagShareAmountIn, shareAmtIn), fmt.Sprintf("--%s=%s", flags.FlagFrom, owner.String()), } for _, maxAmt := range minAmountsOut { args = append(args, fmt.Sprintf("--%s=%s", gammcli.FlagMinAmountsOut, maxAmt)) } args = append(args, commonArgs...) return clitestutil.ExecTestCLICmd(clientCtx, gammcli.NewExitPoolCmd(), args) }
30.418367
174
0.706474
85935346b836436ae3cd1f5a51315516120a01c1
237
js
JavaScript
node-js/node-express/HW1/hw-lior/public/dist/js.dev.js
talyaron/fullstack-int-aug20
802c0920f3a78e570a5d9fa411336f19f778eda3
[ "Artistic-2.0" ]
1
2021-01-26T13:04:04.000Z
2021-01-26T13:04:04.000Z
node-js/node-express/HW1/hw-lior/public/dist/js.dev.js
talyaron/fullstack-int-aug20
802c0920f3a78e570a5d9fa411336f19f778eda3
[ "Artistic-2.0" ]
null
null
null
node-js/node-express/HW1/hw-lior/public/dist/js.dev.js
talyaron/fullstack-int-aug20
802c0920f3a78e570a5d9fa411336f19f778eda3
[ "Artistic-2.0" ]
1
2020-11-22T12:21:19.000Z
2020-11-22T12:21:19.000Z
"use strict"; setInterval(function () { fetch('/get-jokes').then(function (response) { return response.json(); }).then(function (data) { document.getElementById('root').innerText = "".concat(data.randomJoke); }); }, 1000);
26.333333
75
0.649789
01edb56298fe98d15043545dd7b84fd617d1fbd5
2,214
rs
Rust
src/day1.rs
peterdn/advent-of-code-2020
fd820e57c591f207ceaaacd078aa9c61cc344d53
[ "BSD-2-Clause" ]
null
null
null
src/day1.rs
peterdn/advent-of-code-2020
fd820e57c591f207ceaaacd078aa9c61cc344d53
[ "BSD-2-Clause" ]
null
null
null
src/day1.rs
peterdn/advent-of-code-2020
fd820e57c591f207ceaaacd078aa9c61cc344d53
[ "BSD-2-Clause" ]
null
null
null
extern crate aoc_macros; use aoc_macros::aoc_main; mod aoc; aoc_main!(parse_expenses); fn parse_expenses(input: &str) -> Vec<u32> { let mut expenses = input .trim() .lines() .map(|line| line.trim().parse::<u32>().unwrap()) .collect::<Vec<u32>>(); expenses.sort(); expenses } fn part1(expenses: &Vec<u32>) { if let Some((lo, hi)) = find_pairwise_goal(&expenses, 2020, None) { println!("Found {}, {} = {}", lo, hi, lo * hi); } else { println!("Failed to find!"); } } fn part2(expenses: &Vec<u32>) { // Subset-sum problem; this dataset is small enough to brute-force. for i in 0..expenses.len() { let goal = 2020 - expenses[i]; if let Some((lo, hi)) = find_pairwise_goal(&expenses, goal, Some(i)) { println!( "Found {}, {}, {} = {}", lo, hi, expenses[i], lo * hi * expenses[i] ); return; } } println!("Didn't find!"); } fn find_pairwise_goal( expenses: &[u32], goal: u32, exclude_idx: Option<usize>, ) -> Option<(u32, u32)> { let mut idx_lo = 0; let mut idx_hi = expenses.len() - 1; while idx_lo < idx_hi { if exclude_idx.is_some() && idx_lo == exclude_idx.unwrap() { idx_lo += 1; } if exclude_idx.is_some() && idx_hi == exclude_idx.unwrap() { idx_hi -= 1; } let lo = expenses[idx_lo]; let hi = expenses[idx_hi]; let result = lo + hi; if result == goal { return Some((lo, hi)); } else if result > goal { idx_hi -= 1; idx_lo = 0; } else { idx_lo += 1; } } None } #[cfg(test)] mod test { use super::*; #[test] fn test_find_pairwise_goal() { // Test case from https://adventofcode.com/2020/day/1 part 1. let expenses = parse_expenses( "1721 979 366 299 675 1456", ); let goal = find_pairwise_goal(&expenses, 2020, None); assert_eq!(goal, Some((299, 1721))); } }
23.553191
78
0.485095
bcac93b63b8d137c83f12aeb51a4fce7d3845f6b
934
js
JavaScript
day4-2/route1.js
AmosZhang77/nodeJsLearnBase
a0cb3ad1377385a0e7651934b91215a16b8d7edd
[ "MIT" ]
null
null
null
day4-2/route1.js
AmosZhang77/nodeJsLearnBase
a0cb3ad1377385a0e7651934b91215a16b8d7edd
[ "MIT" ]
null
null
null
day4-2/route1.js
AmosZhang77/nodeJsLearnBase
a0cb3ad1377385a0e7651934b91215a16b8d7edd
[ "MIT" ]
null
null
null
let express = require('express') let app = express() app.listen(8070) function bodyParser(){ return function (req,res,next) { let str ='' req.on('data',function (chunk) { str += chunk }) req.on('end',function (chunk) { // console.log(str) req.body = require('querystring').parse(str) // querystring自带模块。自定义body属性用于存储。建议用第三方body-parser见route2.js next() // next 一定要放这里不能放外面,收完数据才next,否则下面的req.body拿不到。 }) } } app.use(bodyParser()) // /user/login // 未分模块子路由前 /*app.get('/login', function (req, res) { res.send('登录') }) app.get('/reg', function (req, res) { res.send('注册') })*/ // 模块化拆分子路由 let user = require('./routes/user') app.use('/user', user) // /article/ post /*app.get('/post', function (req, res) { res.send('发布文章') }) app.get('/delete', function (req, res) { res.send('删除文章') })*/ // 模块化拆分子路由 let article = require('./routes/article') app.use('/article', article)
19.87234
111
0.617773
24efa7173343b2742cfc87fe69bc835e4b083697
290
go
Go
src/group_models.go
newnius/YAO-scheduler
28533a9f6397b3079340dd5dc39571d2971cdc72
[ "Apache-2.0" ]
null
null
null
src/group_models.go
newnius/YAO-scheduler
28533a9f6397b3079340dd5dc39571d2971cdc72
[ "Apache-2.0" ]
null
null
null
src/group_models.go
newnius/YAO-scheduler
28533a9f6397b3079340dd5dc39571d2971cdc72
[ "Apache-2.0" ]
1
2021-10-19T06:58:33.000Z
2021-10-19T06:58:33.000Z
package main type Group struct { Name string `json:"name"` Weight int `json:"weight"` Reserved bool `json:"reserved"` NumGPU int `json:"quota_gpu"` MemoryGPU int `json:"quota_gpu_mem"` CPU int `json:"quota_cpu"` Memory int `json:"quota_mem"` }
24.166667
40
0.617241
0ba5476dbd46ffd166a1142eaeb53f0b271aa5d2
418
kt
Kotlin
src/Basics/Section3/Closures.kt
yavuzBahceci/KotlinLearningDocumentation
95fc673cf85917a75b1fce940ec5e66ac2aaf209
[ "Apache-2.0" ]
null
null
null
src/Basics/Section3/Closures.kt
yavuzBahceci/KotlinLearningDocumentation
95fc673cf85917a75b1fce940ec5e66ac2aaf209
[ "Apache-2.0" ]
null
null
null
src/Basics/Section3/Closures.kt
yavuzBahceci/KotlinLearningDocumentation
95fc673cf85917a75b1fce940ec5e66ac2aaf209
[ "Apache-2.0" ]
null
null
null
package Basics.Section3 // Closures are variables defined in outer scope of lambda expressions fun main(args: Array<String>) { var result = 0 println(result) val lambda: (Int, Int) -> Unit = { x, y -> result = x + y } // We can use result in lambda expression add(2,4,lambda) println(result) } fun add(x: Int, y: Int, myFunc: (Int, Int) -> Unit) { val sum = myFunc(x,y) println(sum) }
22
105
0.629187
488382a7539869c62ccd65ca1c0d267f2815ab18
3,530
swift
Swift
CSMobileBase/Classes/CSSettingsStore.swift
Mayank-Bhayana/CSMobileBase
8ff6229a030cb82c727a0fbe33a48d8c1512358d
[ "MIT" ]
null
null
null
CSMobileBase/Classes/CSSettingsStore.swift
Mayank-Bhayana/CSMobileBase
8ff6229a030cb82c727a0fbe33a48d8c1512358d
[ "MIT" ]
null
null
null
CSMobileBase/Classes/CSSettingsStore.swift
Mayank-Bhayana/CSMobileBase
8ff6229a030cb82c727a0fbe33a48d8c1512358d
[ "MIT" ]
null
null
null
// // CSSettingsStore.swift // CSMobileBase // // Created by Mayank Bhayana on 10/01/19. // import Foundation import SmartStore import SwiftyJSON public let CSSettingsChangedNotification = "CSSettingsChangedNotification" open class CSSettingsStore { open static let instance: CSSettingsStore = CSSettingsStore() fileprivate let endpoint: String = Bundle.main.object(forInfoDictionaryKey: "SFDCEndpoint") as! String fileprivate let soupName: String = "Settings" lazy var notificationCenter: NotificationCenter = NotificationCenter.default lazy var dateFormatter: DateFormatter = DateFormatter() fileprivate var smartStore: SFSmartStore { let store: SFSmartStore = SFSmartStore.sharedStore(withName: kDefaultSmartStoreName) as! SFSmartStore SFSyncState.setupSyncsSoupIfNeeded(store) if store.soupExists(soupName) == false { do { //-----Fixed by Mayank-----// var indexes = [[String:AnyObject]]() indexes = [ ["path" : CSSettings.Attribute.id.rawValue as AnyObject, "type" : kSoupIndexTypeString as AnyObject] ] let indexSpecs: [AnyObject] = SFSoupIndex.asArraySoupIndexes(indexes)! as [AnyObject] try store.registerSoup(soupName, withIndexSpecs: indexSpecs, error: ()) } catch let error as NSError { SFLogger.log(SFLogLevel.error, msg: "\(soupName) failed to register soup: \(error.localizedDescription)") } } return store } fileprivate var syncManager: SFSmartSyncSyncManager { let store: SFSmartStore = smartStore let manager: SFSmartSyncSyncManager = SFSmartSyncSyncManager.sharedInstance(for: store)! return manager } fileprivate init() {} open func read<S: CSSettings>() -> S { do { let querySpec: SFQuerySpec = SFQuerySpec.newAllQuerySpec(soupName, withOrderPath: nil, with: SFSoupQuerySortOrder.descending, withPageSize: 1) let entry: AnyObject? = try smartStore.query(with: querySpec, pageIndex: 0).first as AnyObject return S.fromStoreEntry(entry) } catch let error as NSError { SFLogger.log(SFLogLevel.error, msg: error.localizedDescription) } return S(json: JSON.null) } open func syncDownSettings<S: CSSettings>(_ onCompletion: ((S, Bool) -> Void)?) { let path: String = "/\(SFRestAPI.sharedInstance().apiVersion)/settings" let target: ApexSyncDownTarget = ApexSyncDownTarget.newSyncTarget(path, queryParams: [:]) target.endpoint = endpoint let options: SFSyncOptions = SFSyncOptions.newSyncOptions(forSyncDown: SFSyncStateMergeMode.overwrite) syncManager.syncDown(with: target, options: options, soupName: soupName) { (syncState: SFSyncState!) in if syncState.isDone() || syncState.hasFailed() { DispatchQueue.main.async { if syncState.hasFailed() { SFLogger.log(SFLogLevel.error, msg: "syncDown Settings failed") } let settings: S = self.read() self.notificationCenter.post(name: Notification.Name(rawValue: CSSettingsChangedNotification), object: settings) print(settings) onCompletion?(settings, syncState.hasFailed() == false) } } } } }
41.046512
154
0.635694
3e3aaf57b3beac61b0115aea62daca4a7fe86fd7
1,731
h
C
include/core/MicroscopeProperties.h
TASBE/ImageAnalytics
5d6fc1a64b4c17e263451fa4252c94dc86193d14
[ "CC-BY-3.0" ]
1
2019-08-29T20:48:32.000Z
2019-08-29T20:48:32.000Z
include/core/MicroscopeProperties.h
TASBE/ImageAnalytics
5d6fc1a64b4c17e263451fa4252c94dc86193d14
[ "CC-BY-3.0" ]
1
2021-11-02T18:14:21.000Z
2021-11-02T18:19:50.000Z
include/core/MicroscopeProperties.h
TASBE/ImageAnalytics
5d6fc1a64b4c17e263451fa4252c94dc86193d14
[ "CC-BY-3.0" ]
null
null
null
/* * MicrscopeProperties.h * * Created on: Jan 10, 2018 * Author: nwalczak */ #ifndef INCLUDE_CORE_MICROSCOPEPROPERTIES_H_ #define INCLUDE_CORE_MICROSCOPEPROPERTIES_H_ #include <string> #include <ostream> #include <iomanip> struct MicroscopeProperties { double pixelWidth; double pixelHeight; double pixelDepth; double imageWidth; double imageHeight; static const std::string INI_CFG_SECTION; static const std::string INI_PIXEL_WIDTH; static const std::string INI_PIXEL_HEIGHT; static const std::string INI_PIXEL_DEPTH; static const std::string INI_IMAGE_WIDTH; static const std::string INI_IMAGE_HEIGHT; std::string fileName; bool readFromXML(const std::string & propXMLPath); bool readFromINI(const std::string & propINIPath); friend std::ostream& operator << (std::ostream& os, const MicroscopeProperties& p) { os << "Microscope properties for " << p.fileName << std::endl; os << "\t" << std::left << std::setw(15) << "imageWidth: " << std::left << std::setw(15) << p.imageWidth << std::endl; os << "\t" << std::left << std::setw(15) << "imageHeight: " << std::left << std::setw(15) << p.imageHeight << std::endl; os << "\t" << std::left << std::setw(15) << "pixelWidth: " << std::left << std::setw(15) << p.pixelWidth << std::endl; os << "\t" << std::left << std::setw(15) << "pixelHeight: " << std::left << std::setw(15) << p.pixelHeight << std::endl; os << "\t" << std::left << std::setw(15) << "pixelDepth: " << std::left << std::setw(15) << p.pixelDepth << std::endl; return os; } /** * Get a multiplier to convert the given unit into micrometers. */ double getMultiplier(std::string unit); }; #endif /* INCLUDE_CORE_MICROSCOPEPROPERTIES_H_ */
29.338983
85
0.662623
6a7b4c526fe904a81e2b5afbde2ad93cb86e8ae6
108
sql
SQL
insertUserTest.sql
meganpowers3/PhotoWebsite
9791292a7149308f93ada788e1031b693583050b
[ "MIT" ]
null
null
null
insertUserTest.sql
meganpowers3/PhotoWebsite
9791292a7149308f93ada788e1031b693583050b
[ "MIT" ]
null
null
null
insertUserTest.sql
meganpowers3/PhotoWebsite
9791292a7149308f93ada788e1031b693583050b
[ "MIT" ]
null
null
null
INSERT INTO `csc317db`.`users` (`username`, `email`, `password`) VALUES ("test", "test@mail.com", "test");
10.8
30
0.638889
7a5f635df2eda24b97db87def6b9738a2a33765c
1,209
sql
SQL
sql/N184_department_highest_salary.sql
MikuSugar/LeetCode
2b87898853bf48a1f94e7b35dd0584047481801f
[ "Apache-2.0" ]
3
2019-01-19T03:01:25.000Z
2020-06-06T12:11:29.000Z
sql/N184_department_highest_salary.sql
MikuSugar/LeetCode
2b87898853bf48a1f94e7b35dd0584047481801f
[ "Apache-2.0" ]
null
null
null
sql/N184_department_highest_salary.sql
MikuSugar/LeetCode
2b87898853bf48a1f94e7b35dd0584047481801f
[ "Apache-2.0" ]
null
null
null
select d.Name as Department, e.Name as Employee, e.Salary as Salary from Employee e join Department d on e.DepartmentId=d.Id where (DepartmentId,Salary) in ( select DepartmentId,max(Salary) from Employee group by DepartmentId ) --Employee 表包含所有员工信息,每个员工有其对应的 Id, salary 和 department Id。 -- --+----+-------+--------+--------------+ --| Id | Name | Salary | DepartmentId | --+----+-------+--------+--------------+ --| 1 | Joe | 70000 | 1 | --| 2 | Henry | 80000 | 2 | --| 3 | Sam | 60000 | 2 | --| 4 | Max | 90000 | 1 | --+----+-------+--------+--------------+ --Department 表包含公司所有部门的信息。 -- --+----+----------+ --| Id | Name | --+----+----------+ --| 1 | IT | --| 2 | Sales | --+----+----------+ --编写一个 SQL 查询,找出每个部门工资最高的员工。例如,根据上述给定的表格,Max 在 IT 部门有最高工资,Henry 在 Sales 部门有最高工资。 -- --+------------+----------+--------+ --| Department | Employee | Salary | --+------------+----------+--------+ --| IT | Max | 90000 | --| Sales | Henry | 80000 | --+------------+----------+--------+ -- --来源:力扣(LeetCode) --链接:https://leetcode-cn.com/problems/department-highest-salary --著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
32.675676
80
0.445823
9c239feef4c9b523dbbf3eb8cd4b4d28593d13df
240
js
JavaScript
angular/directives/myFiles.js
adio87/taskman
4c92ae8e0764bffcd4d4b037bbc91ca088e1d9da
[ "MIT" ]
null
null
null
angular/directives/myFiles.js
adio87/taskman
4c92ae8e0764bffcd4d4b037bbc91ca088e1d9da
[ "MIT" ]
null
null
null
angular/directives/myFiles.js
adio87/taskman
4c92ae8e0764bffcd4d4b037bbc91ca088e1d9da
[ "MIT" ]
null
null
null
export function MyFilesDirective() { return (scope, elem, attrs) => { elem.on("change", function (e) { scope.$eval(attrs.myFiles + "=$files", {$files: e.target.files}); scope.$apply(); }); } }
30
77
0.516667
5ed032dfb39244f61adcce867432e4cfc1cede40
585
asm
Assembly
oeis/134/A134636.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/134/A134636.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/134/A134636.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A134636: Triangle formed by Pascal's rule given borders = 2n+1. ; Submitted by Jon Maiga ; 1,3,3,5,6,5,7,11,11,7,9,18,22,18,9,11,27,40,40,27,11,13,38,67,80,67,38,13,15,51,105,147,147,105,51,15,17,66,156,252,294,252,156,66,17,19,83,222,408,546,546,408,222,83,19,21,102,305,630,954,1092,954,630,305,102,21,23,123,407,935,1584,2046,2046,1584,935,407,123,23,25,146,530,1342,2519,3630,4092,3630,2519,1342,530,146,25,27,171,676,1872,3861,6149,7722,7722,6149 lpb $0 add $2,1 sub $0,$2 lpe mov $1,$2 bin $1,$0 add $0,1 div $1,-1 mul $1,3 add $2,2 bin $2,$0 mul $2,2 add $1,$2 mov $0,$1
30.789474
362
0.676923
9bf5f25315e73651bb35d5e8bb5f6f6ba505d4d9
1,874
js
JavaScript
src/modules/auth/login/index.js
farhadrbb/saham-time
b715699fe9efd9d42a2736fd93b8c2225c0875cd
[ "MIT" ]
null
null
null
src/modules/auth/login/index.js
farhadrbb/saham-time
b715699fe9efd9d42a2736fd93b8c2225c0875cd
[ "MIT" ]
null
null
null
src/modules/auth/login/index.js
farhadrbb/saham-time
b715699fe9efd9d42a2736fd93b8c2225c0875cd
[ "MIT" ]
null
null
null
import React, { useState } from 'react'; import Login from './components/cardLogin'; import { useFormik } from "formik"; import * as Yup from "yup"; import { login } from './../../../redux/auth/login/index'; import { useHistory } from "react-router-dom"; import { setLocalStorageLogin } from './components/localstorage'; import auth from '../../../redux/auth/login/auth'; export default function Index() { const history = useHistory(); const [loading, setLoading] = useState(false); const initialValues = { userName: "", password: "", }; const LoginSchema = Yup.object().shape({ userName: Yup.string() .required('فیلد مورد نظر را پر نمایید'), password: Yup.string() .required('فیلد مورد نظر را پر نمایید'), }); const formik = useFormik({ initialValues, validationSchema: LoginSchema, onSubmit: (values, { setStatus, setSubmitting }) => { setSubmitting(true) setLoading(true); login(values.userName, values.password) .then((res) => { if (!Object.keys(res.data.response.data).length) { setStatus(true) return; } let data = { authenticated: true, value: res.data.response.data, timestamp: 1000 * 60 * 60 * 12,//12 hours } setLocalStorageLogin( "persist:root", data, () => { auth.login( () => history.push("/dashboard") ) }) setStatus(false) }) .catch(() => { alert("در ارتباط با سرور مشکلی پیش آمده"); }) .finally(() => { setSubmitting(false); setLoading(false); }); }, }) return ( <> <Login loading={loading} formik={formik} /> </> ); }
22.309524
65
0.52508
330e3ca54e42e429e7b117d2305fd38be4387ed0
17
py
Python
pytuber/version.py
tefra/pytube.fm
d8e8d5dfe928497f69d208df4c21b049a726dbda
[ "MIT" ]
8
2019-01-27T00:52:20.000Z
2021-07-15T15:57:19.000Z
pytuber/version.py
tefra/pytube.fm
d8e8d5dfe928497f69d208df4c21b049a726dbda
[ "MIT" ]
22
2019-01-25T14:57:08.000Z
2021-12-13T19:55:04.000Z
pytuber/version.py
tefra/pytube.fm
d8e8d5dfe928497f69d208df4c21b049a726dbda
[ "MIT" ]
4
2019-02-17T09:56:30.000Z
2021-04-17T17:53:13.000Z
version = "20.1"
8.5
16
0.588235
6118e66ff0a2f7f253afabf5f52b45aa5e603fe6
330
asm
Assembly
wof/lcs/base/1CB.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
a4a0c86c200241494b3f1834cd0aef8dc02f7683
[ "Apache-2.0" ]
6
2020-10-14T15:29:10.000Z
2022-02-12T18:58:54.000Z
wof/lcs/base/1CB.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
a4a0c86c200241494b3f1834cd0aef8dc02f7683
[ "Apache-2.0" ]
null
null
null
wof/lcs/base/1CB.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
a4a0c86c200241494b3f1834cd0aef8dc02f7683
[ "Apache-2.0" ]
1
2020-12-17T08:59:10.000Z
2020-12-17T08:59:10.000Z
copyright zengfr site:http://github.com/zengfr/romhack 003C88 bne $3caa 004150 bne $4144 00544C bne $5486 01550C st ($1c9,A5) [base+1CB] 0155F0 bra $16f20 [base+1CB] 01568C move.w #$20, (-$4de,A5) [base+1CB] 01572E bra $16f20 [base+1CB] copyright zengfr site:http://github.com/zengfr/romhack
27.5
54
0.654545
7211ab5655d96dfaaf79e18408750770298c0c93
9,510
sql
SQL
demo.sql
ImShobhitPundir/LaravelCURD
c59ee01065acce87f6bbcd070d7c2d76667d75cd
[ "MIT" ]
null
null
null
demo.sql
ImShobhitPundir/LaravelCURD
c59ee01065acce87f6bbcd070d7c2d76667d75cd
[ "MIT" ]
null
null
null
demo.sql
ImShobhitPundir/LaravelCURD
c59ee01065acce87f6bbcd070d7c2d76667d75cd
[ "MIT" ]
null
null
null
-- phpMyAdmin SQL Dump -- version 4.8.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 23, 2020 at 02:48 PM -- Server version: 10.1.37-MariaDB -- PHP Version: 7.2.14 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `demo` -- -- -------------------------------------------------------- -- -- Table structure for table `categories` -- CREATE TABLE `categories` ( `id` bigint(20) UNSIGNED NOT NULL, `category_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `categories` -- INSERT INTO `categories` (`id`, `category_name`, `created_at`, `updated_at`) VALUES (8, 'Men', '2020-08-22 08:19:21', '2020-08-22 08:19:21'), (9, 'Kids', '2020-08-22 08:19:27', '2020-08-22 08:19:27'), (12, 'Women', '2020-08-23 07:03:34', '2020-08-23 07:03:34'); -- -------------------------------------------------------- -- -- Table structure for table `migrations` -- CREATE TABLE `migrations` ( `id` int(10) UNSIGNED NOT NULL, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `migrations` -- INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1, '2020_08_22_114059_create_categories_table', 1), (2, '2020_08_22_144010_create_subcategories_table', 2), (4, '2020_08_23_054944_create_products_table', 3); -- -------------------------------------------------------- -- -- Table structure for table `password_resets` -- CREATE TABLE `password_resets` ( `id` int(11) NOT NULL, `email` varchar(255) NOT NULL, `token` varchar(255) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `products` -- CREATE TABLE `products` ( `id` bigint(20) UNSIGNED NOT NULL, `category_id` int(11) NOT NULL, `sub_category_id` int(11) NOT NULL, `product_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `trade_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `finish` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `product_code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `sort_description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `weave` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `gsm` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `max_price` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `location` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `certificate` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `blend` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `length` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `width` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `height` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `user_id` int(11) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `products` -- INSERT INTO `products` (`id`, `category_id`, `sub_category_id`, `product_name`, `trade_name`, `finish`, `product_code`, `sort_description`, `description`, `weave`, `gsm`, `max_price`, `location`, `certificate`, `blend`, `length`, `width`, `height`, `image`, `user_id`, `created_at`, `updated_at`) VALUES (12, 9, 1, 'Shirt-101', 'JK', 'j', 'PR-8988', 'This is testing.', 'This is testing. This is testing.', 'KJ', 'QWE', '1000', 'Delhi', 'EC', 'jk', '100', '50', '120', '1598184343.jpeg', 1, '2020-08-23 02:39:10', '2020-08-23 06:40:43'), (13, 8, 5, 'Jean-1201', 'RT1', 'AQ', 'PR-0023', 'test', 'this is testing', 'KH', 'kkj', '2000', 'Delhi', 'jl', 'j', '120', '100', '80', '1598184123.jpeg', 1, '2020-08-23 02:57:05', '2020-08-23 06:39:57'); -- -------------------------------------------------------- -- -- Table structure for table `product_price_details` -- CREATE TABLE `product_price_details` ( `id` int(11) NOT NULL, `product_id` int(11) NOT NULL, `color` varchar(100) NOT NULL, `quantity` int(11) NOT NULL, `price` int(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `product_price_details` -- INSERT INTO `product_price_details` (`id`, `product_id`, `color`, `quantity`, `price`) VALUES (9, 13, 'Red', 50, 1900), (10, 13, 'Red', 100, 1800), (11, 13, 'Blue', 50, 1850), (15, 12, 'Red', 10, 1000), (16, 12, 'Red', 50, 900), (17, 12, 'Green', 50, 900), (18, 12, 'Blue', 100, 700); -- -------------------------------------------------------- -- -- Table structure for table `subcategories` -- CREATE TABLE `subcategories` ( `id` bigint(20) UNSIGNED NOT NULL, `category_id` bigint(20) UNSIGNED NOT NULL, `sub_category_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `subcategories` -- INSERT INTO `subcategories` (`id`, `category_id`, `sub_category_name`, `created_at`, `updated_at`) VALUES (1, 9, 'Shirt', '2020-08-22 09:35:55', '2020-08-22 09:35:55'), (3, 9, 'Jeans', '2020-08-22 22:05:03', '2020-08-22 22:05:03'), (5, 8, 'Jeans', '2020-08-23 02:54:12', '2020-08-23 02:54:12'), (6, 12, 'T-Shirt', '2020-08-23 07:03:52', '2020-08-23 07:03:52'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES (1, 'Shobhit Pundir', 'er.shobhitpundir@gmail.com', NULL, '$2y$10$0Rm0wfZeX3YivWJLXur6GOA.fR/omPnyH058MSsO.hL718rZXSPhq', 'ZVjgjoGSPpNqwo5HCGtD9m1qfkuS2U7hbAXCl6NC8YrJjKTTJ30gOxqGqxY6', '2020-08-22 00:11:34', '2020-08-22 00:30:51'), (2, 'Rahul Singh', 'rahul@gamil.com', NULL, '$2y$10$yjkCHIeUlzIBZB.ipv8RnOl/xpPYQ8dO5N1MXzRVgyxn7l07qYm7W', NULL, '2020-08-23 03:04:27', '2020-08-23 03:04:27'); -- -- Indexes for dumped tables -- -- -- Indexes for table `categories` -- ALTER TABLE `categories` ADD PRIMARY KEY (`id`); -- -- Indexes for table `migrations` -- ALTER TABLE `migrations` ADD PRIMARY KEY (`id`); -- -- Indexes for table `password_resets` -- ALTER TABLE `password_resets` ADD PRIMARY KEY (`id`); -- -- Indexes for table `products` -- ALTER TABLE `products` ADD PRIMARY KEY (`id`); -- -- Indexes for table `product_price_details` -- ALTER TABLE `product_price_details` ADD PRIMARY KEY (`id`); -- -- Indexes for table `subcategories` -- ALTER TABLE `subcategories` ADD PRIMARY KEY (`id`), ADD KEY `subcategories_category_id_foreign` (`category_id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `categories` -- ALTER TABLE `categories` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; -- -- AUTO_INCREMENT for table `migrations` -- ALTER TABLE `migrations` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `password_resets` -- ALTER TABLE `password_resets` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `products` -- ALTER TABLE `products` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; -- -- AUTO_INCREMENT for table `product_price_details` -- ALTER TABLE `product_price_details` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20; -- -- AUTO_INCREMENT for table `subcategories` -- ALTER TABLE `subcategories` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- Constraints for dumped tables -- -- -- Constraints for table `subcategories` -- ALTER TABLE `subcategories` ADD CONSTRAINT `subcategories_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
31.386139
303
0.68286
4a3f473ef512b9ce11ab519362466b1fdbec2de5
1,973
js
JavaScript
web/gui/js/mqtt.js
NuwanJ/co326-project
4dbd4766ad43a7b31d17aae5bde3e17c662d6f60
[ "Apache-2.0" ]
null
null
null
web/gui/js/mqtt.js
NuwanJ/co326-project
4dbd4766ad43a7b31d17aae5bde3e17c662d6f60
[ "Apache-2.0" ]
null
null
null
web/gui/js/mqtt.js
NuwanJ/co326-project
4dbd4766ad43a7b31d17aae5bde3e17c662d6f60
[ "Apache-2.0" ]
2
2020-10-05T15:08:13.000Z
2020-10-20T06:21:59.000Z
var client = new Paho.MQTT.Client(mqtt_server, mqtt_port,"/socket.io"); function mqttConnect(){ client.connect({onSuccess:onConnect}); const txtSendBox = document.getElementById("serialSend"); txtSendBox.innerHTML = "Trying to connect..."; } function onConnect(){ document.getElementById("serialSend").innerHTML = "Connected\n" client.onMessageArrived = onMessageArrived; client.onConnectionLost = onConnectionLost; client.subscribe(TOPIC_COM2WEB); } function sendCommand(text) { message = new Paho.MQTT.Message(text+ '\n'); message.destinationName = TOPIC_WEB2COM; client.send(message); const txtSendBox = document.getElementById("serialSend"); txtSendBox.innerHTML = text + '\n' + txtSendBox.innerHTML; } // called when the client loses its connection function onConnectionLost(responseObject) { if (responseObject.errorCode !== 0) { console.log("onConnectionLost:"+responseObject.errorMessage); const txtSendBox = document.getElementById("serialSend"); txtSendBox.innerHTML = "Connection Lost\n"+ responseObject.errorMessage+ "\n" + txtSendBox.innerHTML; } } function onMessageArrived(message) { const result = message.payloadString.trim(); const topic = message.destinationName; //if(topic == TOPIC_WEB2COM){ if(result != ""){ if(result.startsWith("<")){ console.log("Coordinate Result"); var state = result.split('|')[0].substring(1); var coordinates = result.split('|')[1].split(':')[1].split(','); console.log(coordinates); $('#lblXCord').text(coordinates[0]); $('#lblYCord').text(coordinates[1]); $('#lblZCord').text(coordinates[2]); $('#lblSatus').text(state); } document.getElementById("serialReceive").innerHTML += result; const txtReceiveBox = document.getElementById("serialReceive"); txtReceiveBox.innerHTML = result + '\n' + txtReceiveBox.innerHTML } //} }
29.014706
107
0.675621
5b4702eead5012fb237555649ecbdd9946c81c09
5,555
h
C
WebLayoutCore/Source/WebCore/html/HTMLImageElement.h
gubaojian/trylearn
74dd5c6c977f8d867d6aa360b84bc98cb82f480c
[ "MIT" ]
1
2020-05-25T16:06:49.000Z
2020-05-25T16:06:49.000Z
WebLayoutCore/Source/WebCore/html/HTMLImageElement.h
gubaojian/trylearn
74dd5c6c977f8d867d6aa360b84bc98cb82f480c
[ "MIT" ]
null
null
null
WebLayoutCore/Source/WebCore/html/HTMLImageElement.h
gubaojian/trylearn
74dd5c6c977f8d867d6aa360b84bc98cb82f480c
[ "MIT" ]
1
2018-07-10T10:53:18.000Z
2018-07-10T10:53:18.000Z
/* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * Copyright (C) 2004, 2008, 2010 Apple Inc. All rights reserved. * Copyright (C) 2010 Google Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ #pragma once #include "FormNamedItem.h" #include "GraphicsTypes.h" #include "HTMLElement.h" #include "HTMLImageLoader.h" namespace WebCore { class HTMLFormElement; struct ImageCandidate; class HTMLImageElement : public HTMLElement, public FormNamedItem { friend class HTMLFormElement; public: static Ref<HTMLImageElement> create(Document&); static Ref<HTMLImageElement> create(const QualifiedName&, Document&, HTMLFormElement*); static Ref<HTMLImageElement> createForJSConstructor(Document&, std::optional<unsigned> width, std::optional<unsigned> height); virtual ~HTMLImageElement(); WEBCORE_EXPORT unsigned width(bool ignorePendingStylesheets = false); WEBCORE_EXPORT unsigned height(bool ignorePendingStylesheets = false); WEBCORE_EXPORT int naturalWidth() const; WEBCORE_EXPORT int naturalHeight() const; const AtomicString& currentSrc() const { return m_currentSrc; } bool isServerMap() const; const AtomicString& altText() const; CompositeOperator compositeOperator() const { return m_compositeOperator; } CachedImage* cachedImage() const { return m_imageLoader.image(); } void setLoadManually(bool loadManually) { m_imageLoader.setLoadManually(loadManually); } bool matchesUsemap(const AtomicStringImpl&) const; WEBCORE_EXPORT const AtomicString& alt() const; WEBCORE_EXPORT void setHeight(unsigned); URL src() const; void setSrc(const String&); WEBCORE_EXPORT void setCrossOrigin(const AtomicString&); WEBCORE_EXPORT String crossOrigin() const; WEBCORE_EXPORT void setWidth(unsigned); WEBCORE_EXPORT int x() const; WEBCORE_EXPORT int y() const; WEBCORE_EXPORT bool complete() const; WEBCORE_EXPORT void decode(Ref<DeferredPromise>&&); #if PLATFORM(IOS) bool willRespondToMouseClickEvents() override; #endif bool hasPendingActivity() const { return m_imageLoader.hasPendingActivity(); } bool canContainRangeEndPoint() const override { return false; } const AtomicString& imageSourceURL() const override; bool hasShadowControls() const { return m_experimentalImageMenuEnabled; } HTMLPictureElement* pictureElement() const; void setPictureElement(HTMLPictureElement*); protected: HTMLImageElement(const QualifiedName&, Document&, HTMLFormElement* = 0); void didMoveToNewDocument(Document& oldDocument, Document& newDocument) override; private: void parseAttribute(const QualifiedName&, const AtomicString&) override; bool isPresentationAttribute(const QualifiedName&) const override; void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override; void didAttachRenderers() override; RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; void setBestFitURLAndDPRFromImageCandidate(const ImageCandidate&); bool canStartSelection() const override; bool isURLAttribute(const Attribute&) const override; bool attributeContainsURL(const Attribute&) const override; String completeURLsInAttributeValue(const URL& base, const Attribute&) const override; bool draggable() const override; void addSubresourceAttributeURLs(ListHashSet<URL>&) const override; InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) override; void removedFromAncestor(RemovalType, ContainerNode&) override; bool isFormAssociatedElement() const final { return false; } FormNamedItem* asFormNamedItem() final { return this; } HTMLImageElement& asHTMLElement() final { return *this; } const HTMLImageElement& asHTMLElement() const final { return *this; } void selectImageSource(); ImageCandidate bestFitSourceFromPictureElement(); HTMLImageLoader m_imageLoader; HTMLFormElement* m_form; HTMLFormElement* m_formSetByParser; CompositeOperator m_compositeOperator; AtomicString m_bestFitImageURL; AtomicString m_currentSrc; AtomicString m_parsedUsemap; float m_imageDevicePixelRatio; bool m_experimentalImageMenuEnabled; bool m_hadNameBeforeAttributeChanged { false }; // FIXME: We only need this because parseAttribute() can't see the old value. #if ENABLE(SERVICE_CONTROLS) void updateImageControls(); void tryCreateImageControls(); void destroyImageControls(); bool hasImageControls() const; bool childShouldCreateRenderer(const Node&) const override; #endif friend class HTMLPictureElement; }; } //namespace
34.937107
130
0.761116
bb7a7cab2f641d46f26cd7347d4e39d3b2d020fb
1,894
rs
Rust
xrpl_cli/src/account/balances.rs
gmosx/xrpl_sdk_rust
f45f61da1d059c4db90a52fb947740a8e9b67d84
[ "Apache-2.0" ]
3
2022-03-05T09:37:21.000Z
2022-03-07T06:50:37.000Z
xrpl_cli/src/account/balances.rs
gmosx/xrpl_sdk_rust
f45f61da1d059c4db90a52fb947740a8e9b67d84
[ "Apache-2.0" ]
null
null
null
xrpl_cli/src/account/balances.rs
gmosx/xrpl_sdk_rust
f45f61da1d059c4db90a52fb947740a8e9b67d84
[ "Apache-2.0" ]
null
null
null
use clap::ArgMatches; use std::collections::HashMap; use xrpl_sdk_jsonrpc::Client; // #TODO should be `balance` or `balances`? // #TODO add error handling pub fn account_balances(account_matches: &ArgMatches, balances_matches: &ArgMatches) { let account = account_matches.value_of("ACCOUNT").unwrap(); let rt = tokio::runtime::Runtime::new().unwrap(); rt.block_on(async { let client = Client::new(); // TODO: also use account from environment. // TODO: render as text/md, html and json. // TODO: use handlebars for formatting? let mut balances: HashMap<String, f64> = HashMap::new(); let account_info_resp = client.account_info(account).send().await; let account_lines_resp = client.account_lines(account).send().await; if let Ok(resp) = account_info_resp { let account_data = &resp.account_data; balances.insert("XRP".to_owned(), account_data.balance.parse().unwrap()); if let Ok(resp) = account_lines_resp { for line in resp.lines { let iou = format!("{}.{}", line.currency, line.account); let iou_balance: f64 = line.balance.parse().unwrap(); if iou_balance > 0.0 { balances.insert(iou, line.balance.parse().unwrap()); } } } if balances_matches.is_present("json") { if balances_matches.is_present("pretty") { println!("{}", serde_json::to_string_pretty(&balances).unwrap()); } else { println!("{}", serde_json::to_string(&balances).unwrap()); } } else { for (asset, balance) in balances { println!("{asset}: {balance}"); } } } }); }
35.735849
86
0.546463
b19ca8054d930168a0ac9f4386f5706c7a0037b8
713
h
C
KSPlayer/KSPlayer/Scripts/Custom/FFmpeg/Video/Decoder/XDXVideoDecoder.h
saeipi/KSFFmpeg
14665810f2fd5bf3b4dc78495e38b9b4f45ebfbb
[ "MIT" ]
7
2020-05-19T02:06:56.000Z
2021-06-07T08:22:35.000Z
KSPlayer/Scripts/Custom/FFmpeg/Video/Decoder/XDXVideoDecoder.h
saeipi/KSPlayer
101b042458a47e73a636cbd181e2d82023e16c75
[ "MIT" ]
null
null
null
KSPlayer/Scripts/Custom/FFmpeg/Video/Decoder/XDXVideoDecoder.h
saeipi/KSPlayer
101b042458a47e73a636cbd181e2d82023e16c75
[ "MIT" ]
2
2021-05-26T01:56:41.000Z
2021-06-07T08:22:40.000Z
// // XDXVideoDecoder.h // XDXVideoDecoder // // Created by 小东邪 on 2019/6/4. // Copyright © 2019 小东邪. All rights reserved. // #import <Foundation/Foundation.h> #import "XDXAVParseHandler.h" @protocol XDXVideoDecoderDelegate <NSObject> @optional - (void)getVideoDecodeDataCallback:(CMSampleBufferRef)sampleBuffer isFirstFrame:(BOOL)isFirstFrame; @end @interface XDXVideoDecoder : NSObject @property (nonatomic, weak) id<XDXVideoDecoderDelegate> delegate; /** Start / Stop decoder */ - (void)startDecodeVideoData:(struct XDXParseVideoDataInfo *)videoInfo; - (void)stopDecoder; /** Reset timestamp when you parse a new file (only use the decoder as global var) */ - (void)resetTimestamp; @end
20.371429
99
0.746143
987812dbd6ab2eacd1e946d4f017b4ebdb7d1e68
100
sql
SQL
springboot-mybatis-mysql/src/main/resources/schema.sql
Neyzoter/spring-example
f8479e5f8433266476f3c00138236e6cfd715a01
[ "MIT" ]
1
2020-04-28T08:32:10.000Z
2020-04-28T08:32:10.000Z
springboot-mybatis-mysql/src/main/resources/schema.sql
Neyzoter/spring-example
f8479e5f8433266476f3c00138236e6cfd715a01
[ "MIT" ]
1
2020-02-16T15:06:13.000Z
2020-02-16T15:06:13.000Z
springboot-mybatis-mysql/src/main/resources/schema.sql
Neyzoter/spring-example
f8479e5f8433266476f3c00138236e6cfd715a01
[ "MIT" ]
2
2020-08-05T03:47:58.000Z
2020-10-11T08:15:24.000Z
CREATE TABLE IF NOT EXISTS user ( userName VARCHAR(256), password VARCHAR(256), );
25
33
0.62
7a3bccf7692cdefc86706559cef0b8de8574c2df
248
rb
Ruby
2017/1230_ABC084/B.rb
kazunetakahashi/atcoder
16ce65829ccc180260b19316e276c2fcf6606c53
[ "MIT" ]
7
2019-03-24T14:06:29.000Z
2020-09-17T21:16:36.000Z
2017/1230_ABC084/B.rb
kazunetakahashi/atcoder
16ce65829ccc180260b19316e276c2fcf6606c53
[ "MIT" ]
null
null
null
2017/1230_ABC084/B.rb
kazunetakahashi/atcoder
16ce65829ccc180260b19316e276c2fcf6606c53
[ "MIT" ]
1
2020-07-22T17:27:09.000Z
2020-07-22T17:27:09.000Z
a, b = gets.chomp.split(" ").map{|i| i.to_i} s = gets.chomp ok = true for i in 0...a+b+1 if i == a if s[i] != '-' ok = false end else if s[i] == '-' ok = false end end end if ok puts "Yes" else puts "No" end
11.272727
44
0.471774
d4acc2118402344ff9c1bda51ffb16957ebe35b0
2,367
rs
Rust
src/lantern_db.rs
temochka/lantern
fb1f4e4b7df9bff58a39a210a852f0dc3670e025
[ "Apache-2.0" ]
null
null
null
src/lantern_db.rs
temochka/lantern
fb1f4e4b7df9bff58a39a210a852f0dc3670e025
[ "Apache-2.0" ]
null
null
null
src/lantern_db.rs
temochka/lantern
fb1f4e4b7df9bff58a39a210a852f0dc3670e025
[ "Apache-2.0" ]
null
null
null
use actix::{Actor}; use rusqlite::{params, Connection, OptionalExtension}; pub mod entities; pub mod queries; pub struct LanternDb { pub connection: Connection } impl LanternDb { fn create_session(&self, query: &queries::CreateSession) -> rusqlite::Result<()> { let mut stmt = self.connection.prepare("INSERT INTO lantern_sessions (session_token, started_at, expires_at) VALUES (?, ?, ?)")?; stmt.insert(params![query.session_token.clone(), query.started_at, query.expires_at])?; Ok(()) } fn lookup_active_session(&self, query: &queries::LookupActiveSession) -> rusqlite::Result<Option<entities::Session>> { let mut stmt = self.connection.prepare("SELECT id, session_token, started_at, expires_at FROM lantern_sessions WHERE session_token=? AND expires_at > ? LIMIT 1")?; stmt.query_row( params![query.session_token.clone(), query.now], |row| Ok(entities::Session { id: row.get(0)?, session_token: row.get(1)?, started_at: row.get(2)?, expires_at: row.get(3)? }) ).optional() } } impl actix::Message for queries::CreateSession { type Result = rusqlite::Result<()>; } impl actix::Message for queries::LookupActiveSession { type Result = rusqlite::Result<Option<entities::Session>>; } impl Actor for LanternDb { type Context = actix::prelude::Context<Self>; fn started(&mut self, _ctx: &mut Self::Context) { self.connection.execute( "CREATE TABLE IF NOT EXISTS lantern_sessions ( id INTEGER PRIMARY KEY AUTOINCREMENT, session_token VARCHAR(255) NOT NULL, started_at DATETIME NOT NULL, expires_at DATETIME NOT NULL )", params![], ).unwrap(); } } impl actix::Handler<queries::CreateSession> for LanternDb { type Result = rusqlite::Result<()>; fn handle(&mut self, msg: queries::CreateSession, _ctx: &mut actix::prelude::Context<Self>) -> Self::Result { self.create_session(&msg) } } impl actix::Handler<queries::LookupActiveSession> for LanternDb { type Result = rusqlite::Result<Option<entities::Session>>; fn handle(&mut self, msg: queries::LookupActiveSession, _ctx: &mut actix::prelude::Context<Self>) -> Self::Result { self.lookup_active_session(&msg) } }
34.808824
171
0.648078
2dd714ced7567586490239be637198733a1953e1
6,124
swift
Swift
Swift/Apply/Apply/FDUtils.swift
FandyLiu/SwiftDemoCollection
ea93f3b9cfe6bcf0e9993837409561631947902b
[ "MIT" ]
null
null
null
Swift/Apply/Apply/FDUtils.swift
FandyLiu/SwiftDemoCollection
ea93f3b9cfe6bcf0e9993837409561631947902b
[ "MIT" ]
null
null
null
Swift/Apply/Apply/FDUtils.swift
FandyLiu/SwiftDemoCollection
ea93f3b9cfe6bcf0e9993837409561631947902b
[ "MIT" ]
null
null
null
// // FDUtils.swift // Apply // // Created by QianTuFD on 2017/3/28. // Copyright © 2017年 fandy. All rights reserved. // import UIKit // int -> float extension Int { var f: CGFloat { return CGFloat(self) } } // 16进制颜色转换 不带透明度得到 extension UIColor { class func rgbColorWith(hexValue: Int) -> UIColor { return UIColor(red: ((hexValue & 0xFF0000) >> 16).f / 255.0, green: ((hexValue & 0xFF00) >> 8).f / 255.0, blue: (hexValue & 0xFF).f / 255.0, alpha: 1.0) } } // 字体转换( 不适合你的项目 ) extension UIFont { class func fontWith(pixel: CGFloat) -> UIFont { return UIFont.systemFont(ofSize: pixel / 96.f * 72.f) } } extension NSString { // 计算字符串 size func textSizeWith(contentSize:CGSize, font: UIFont) -> CGSize { let attrs = [NSFontAttributeName: font] return self.boundingRect(with: contentSize, options: NSStringDrawingOptions.usesLineFragmentOrigin, attributes: attrs, context: nil).size } } extension UILabel { // 不等高字体富文本 func text(contents: (text: String, font: UIFont) ...) { let textArray = contents.map{ $0.text } let attriStr = NSMutableAttributedString(string: textArray.joined()) var location = 0 for content in contents { let range = NSMakeRange(location, content.text.characters.count) attriStr.addAttribute(NSFontAttributeName, value: content.font, range: range) location += content.text.characters.count } self.attributedText = attriStr } // 文字对齐 支持大于等于与2个汉子 不带冒hao func alignmentJustify(withWidth: CGFloat) { guard let originText = self.text, originText.characters.count > 1 else { assert(false, "Label没有内容或者Lable内容长度小于2") return } let text = originText as NSString let textSize = text.textSizeWith(contentSize: CGSize(width: withWidth, height: CGFloat(MAXFLOAT)), font: self.font) let margin = (withWidth - textSize.width) / CGFloat(originText.characters.count - 1) let attriStr = NSMutableAttributedString(string: originText) attriStr.addAttribute(kCTKernAttributeName as String, value: margin, range:NSRange(location: 0, length: originText.characters.count - 1)) self.attributedText = attriStr } // 文字对齐 支持大于等于与3个汉子 带冒号 func alignmentJustify_colon(withWidth: CGFloat) { guard let originText = self.text, originText.characters.count > 2 else { assert(false, "Label没有内容或者Lable内容长度小于3") return } let text = originText as NSString let colon_W = ":".textSizeWith(contentSize: CGSize(width: withWidth, height: CGFloat(MAXFLOAT)), font: self.font).width let textSize = text.textSizeWith(contentSize: CGSize(width: withWidth, height: CGFloat(MAXFLOAT)), font: self.font) let margin = (withWidth - colon_W - textSize.width) / CGFloat((originText.characters.count - 2)) let attriStr = NSMutableAttributedString(string: originText) attriStr.addAttribute(NSKernAttributeName, value: margin, range:NSRange(location: 0, length: originText.characters.count - 2)) self.attributedText = attriStr } } extension UITextField { // 占位符号对齐 func placeholderAlignment(alignment: NSTextAlignment) { guard let placeholder = placeholder else { return } let style = NSMutableParagraphStyle() style.alignment = alignment let attriStr = NSMutableAttributedString(string: placeholder) attriStr.addAttribute(NSParagraphStyleAttributeName, value: style, range: NSRange(location: 0, length: placeholder.characters.count)) self.attributedPlaceholder = attriStr } } // cell 扩展两个属性 一个是 当前indexpath 另一个是高度(高度好像是) extension UITableViewCell { private static var currentIndexPath = "currentIndexPath" private static var cellHeight = "cellHeight" var currentIndexPath: IndexPath? { set { objc_setAssociatedObject(self, &UITableViewCell.currentIndexPath, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) } get { return objc_getAssociatedObject(self, &UITableViewCell.currentIndexPath) as? IndexPath } } var cellHeight: CGFloat? { set { objc_setAssociatedObject(self, &UITableViewCell.cellHeight, newValue, .OBJC_ASSOCIATION_ASSIGN) } get { return objc_getAssociatedObject(self, &UITableViewCell.cellHeight) as? CGFloat } } } extension UIView { func screenViewYValue() -> CGFloat { var y: CGFloat = 0.0 var supView: UIView = self while let view = supView.superview { y += view.frame.origin.y if let scrollView = view as? UIScrollView { y -= scrollView.contentOffset.y } supView = view } return y } // 得出父 cell var superCell: UITableViewCell? { var superView: UIView? = self while (superView as? UITableViewCell) == nil { superView = superView?.superview if superView == nil { return nil } } return superView as? UITableViewCell } } let COLOR_ffaf48 = UIColor.rgbColorWith(hexValue: 0xffaf48) let COLOR_666666 = UIColor.rgbColorWith(hexValue: 0x666666) let COLOR_222222 = UIColor.rgbColorWith(hexValue: 0x222222) let COLOR_c3c3c3 = UIColor.rgbColorWith(hexValue: 0xc3c3c3) let COLOR_dadada = UIColor.rgbColorWith(hexValue: 0xdadada) let COLOR_1478b8 = UIColor.rgbColorWith(hexValue: 0x1478b8) let COLOR_efefef = UIColor.rgbColorWith(hexValue: 0xefefef) //let FONT_28PX = UIFont.fontWith(pixel: 28.0) //let FONT_24PX = UIFont.fontWith(pixel: 24.0) var defautScale: CGFloat { get { return UIScreen.main.bounds.size.width / 320.0 } } let FONT_28PX = UIFont.systemFont(ofSize: 14) let FONT_24PX = UIFont.systemFont(ofSize: 12) let FONT_36PX = UIFont.systemFont(ofSize: 18)
34.022222
145
0.648596
cccc56b69fb0c53c0da6ceb892de905d6edf88b7
131
kt
Kotlin
core/src/main/java/com/android/sample/core/database/dashboard/DbLink.kt
alirezaeiii/SampleDaggerRx
2220bb35cce7cb77339f9b14b02097b152a7c1b7
[ "Unlicense" ]
4
2021-12-14T17:05:57.000Z
2022-02-28T18:35:47.000Z
core/src/main/java/com/android/sample/core/database/dashboard/DbLink.kt
alirezaeiii/Hilt-MultiModule-Cache
882deeb6f6640ea6616ef7b846b7c6aa33e8747a
[ "Unlicense" ]
null
null
null
core/src/main/java/com/android/sample/core/database/dashboard/DbLink.kt
alirezaeiii/Hilt-MultiModule-Cache
882deeb6f6640ea6616ef7b846b7c6aa33e8747a
[ "Unlicense" ]
null
null
null
package com.android.sample.core.database.dashboard class DbLink( val id: String, val title: String, val href: String )
18.714286
50
0.709924
0b50f65ab450a9b3ceab99052365e46e13aa2bac
2,726
asm
Assembly
ioctl/Cat08.asm
osfree-project/FamilyAPI
2119a95cb2bbe6716ecacff4171866f6ea51b8d7
[ "BSD-3-Clause" ]
1
2021-11-25T14:01:48.000Z
2021-11-25T14:01:48.000Z
ioctl/Cat08.asm
osfree-project/FamilyAPI
2119a95cb2bbe6716ecacff4171866f6ea51b8d7
[ "BSD-3-Clause" ]
null
null
null
ioctl/Cat08.asm
osfree-project/FamilyAPI
2119a95cb2bbe6716ecacff4171866f6ea51b8d7
[ "BSD-3-Clause" ]
2
2021-11-05T06:48:43.000Z
2021-12-06T08:07:38.000Z
;/*! ; @file ; ; @ingroup fapi ; ; @brief DosDevIOCtl Category 8 Functions ; ; (c) osFree Project 2021, <http://www.osFree.org> ; for licence see licence.txt in root directory, or project website ; ; This is Family API implementation for DOS, used with BIND tools ; to link required API ; ; @author Yuri Prokushev (yuri.prokushev@gmail.com) ; ; Documentation: http://osfree.org/doku/en:docs:fapi:dosdevioctl ; ;*/ _DATA SEGMENT BYTE PUBLIC 'DATA' USE16 DSKTABLE1: DW IODLOCK ; Function 00H Lock Drive - not supported for versions below DOS 3.2 DW IODUNLOCK ; Function 01H Unlock Drive - not supported for versions below DOS 3.2 DW IODREDETERMINE ; Function 02H Redetermine Media - not supported for versions below DOS 3.2 DW IODSETMAP ; Function 03H Set Logical Map - not supported for versions below DOS 3.2 DSKTABLE2: DW IODBLOCKREMOVABLE ; Function 20H Block Removable - not supported for versions below DOS 3.2 DW IODGETMAP ; Function 21H Get Logical Map - not supported for versions below DOS 3.2 DSKTABLE3: DW IODSETPARAM ; Function 43H Set Device Parameters - not supported for DOS 2.X and DOS 3.X DW IODWRITETRACK ; Function 44H Write Track - not supported for DOS 2.X and DOS 3.X DW IODFORMATTRACK ; Function 45H Format Track - not supported for DOS 2.X and DOS 3.X DSKTABLE4: DW IODGETPARAM ; Function 63H Get Device Parameters - not supported for DOS 2.X and DOS 3.X DW IODREADTACK ; Function 64H Read Track - not supported for DOS 2.X and DOS 3.X DW IODVERIFYTRACK ; Function 65H Verify Track - not supported for DOS 2.X and DOS 3.X. _DATA ENDS _TEXT SEGMENT BYTE PUBLIC 'CODE' USE16 ;-------------------------------------------------------- ; Category 8 Handler ;-------------------------------------------------------- IODISK PROC NEAR MOV SI, [DS:BP].ARGS.FUNCTION CMP SI, 00H ; 00H JB EXIT CMP SI, 03H ; 03H JB OK1 SUB SI, 20H ; 20H JB EXIT CMP SI, 01H ; 21H JBE OK2 SUB SI, 23H ; 43H JB EXIT CMP SI, 02H ; 45H JBE OK3 SUB SI, 20H ; 63H JB EXIT CMP SI, 02H ; 65H JBE OK4 OK1: SHL SI, 1 ; SHL SI, 1 CALL WORD PTR ES:DSKTABLE1[SI] JMP EXIT OK2: SHL SI, 1 ; SHL SI, 1 CALL WORD PTR ES:DSKTABLE2[SI] JMP EXIT OK3: SHL SI, 1 ; SHL SI, 1 CALL WORD PTR ES:DSKTABLE3[SI] JMP EXIT OK4: SHL SI, 1 ; SHL SI, 1 CALL WORD PTR ES:DSKTABLE4[SI] EXIT: RET IODISK ENDP INCLUDE IodLock.asm INCLUDE IodUnLock.asm INCLUDE IodRedetermine.asm INCLUDE IodSetMap.asm INCLUDE IodBlockRemovable.asm INCLUDE IodGetMap.asm INCLUDE IodSetParam.asm INCLUDE IodWriteTrack.asm INCLUDE IodFormatTrack.asm INCLUDE IodGetParam.asm INCLUDE IodReadTrack.asm INCLUDE IodVerifyTrack.asm _TEXT ENDS
26.211538
95
0.68562
856a1c833364df8e4fe128a23a5c6d306d8b971d
976
js
JavaScript
frontend/src/router/dashboard.routes.js
nomadicsoft/saas
94865b3e6b6ab0ae24276f12603b277173a13bde
[ "MIT" ]
1
2021-06-17T05:54:06.000Z
2021-06-17T05:54:06.000Z
frontend/src/router/dashboard.routes.js
nomadicsoft/saas
94865b3e6b6ab0ae24276f12603b277173a13bde
[ "MIT" ]
null
null
null
frontend/src/router/dashboard.routes.js
nomadicsoft/saas
94865b3e6b6ab0ae24276f12603b277173a13bde
[ "MIT" ]
null
null
null
export default [ { path: '/dashboard', name: 'dashboard.index', component: () => import('../views/dashboard/Index.vue'), meta: { auth: true } }, { path: '/dashboard/profile', name: 'dashboard.profile', component: () => import('../views/dashboard/Profile.vue'), meta: { auth: true } }, { path: '/dashboard/billing', name: 'dashboard.billing', component: () => import('../views/dashboard/billing/Index.vue'), meta: { auth: true } }, { path: '/dashboard/billing/select-plan', name: 'dashboard.billing.select-plan', component: () => import('../views/dashboard/billing/SelectPlan.vue'), meta: { auth: true } }, { path: '/dashboard/billing/checkout', name: 'dashboard.billing.checkout', component: () => import('../views/dashboard/billing/Checkout.vue'), meta: { auth: true } }, ]
28.705882
77
0.528689
5f295ae1b02cf81227d1509eedd6bb348c958ca3
888
swift
Swift
Sources/Web/Templating/Template.swift
OmnijarStudio/naamio
d8572f543c8454ea22f21552a203e3b63bd22938
[ "MIT" ]
null
null
null
Sources/Web/Templating/Template.swift
OmnijarStudio/naamio
d8572f543c8454ea22f21552a203e3b63bd22938
[ "MIT" ]
11
2016-09-17T12:26:11.000Z
2016-09-18T10:17:31.000Z
Sources/Web/Templating/Template.swift
OmnijarStudio/naamio
d8572f543c8454ea22f21552a203e3b63bd22938
[ "MIT" ]
null
null
null
import Foundation import Malline enum RouteType: String { case id = "id" case page case root = "index" } protocol TemplateCachable { var template: Template { get set } var stencil: Stencil { get set } } struct Template { var name: String { get { return NSString(string: self.fileName).deletingPathExtension } } let location: String? let fileName: String var nameWithoutExtension: String { return NSString(string: self.name).deletingPathExtension } var routeAs: RouteType { get { guard let routeAs = RouteType(rawValue: self.nameWithoutExtension) else { return .page } return routeAs } } } struct TemplateCachedItem: TemplateCachable { var template: Template var stencil: Stencil }
17.411765
85
0.591216
182eaaca430323e84363f6c435302d42e818343f
1,654
kt
Kotlin
server/src/test/kotlin/com/lsdconsulting/exceptionhandling/server/time/DefaultTimeProviderConfigurationShould.kt
lsd-consulting/spring-http-exception-handling-library
7e1f222ddc037dfe022abf23765de80ac781a2ea
[ "MIT" ]
null
null
null
server/src/test/kotlin/com/lsdconsulting/exceptionhandling/server/time/DefaultTimeProviderConfigurationShould.kt
lsd-consulting/spring-http-exception-handling-library
7e1f222ddc037dfe022abf23765de80ac781a2ea
[ "MIT" ]
null
null
null
server/src/test/kotlin/com/lsdconsulting/exceptionhandling/server/time/DefaultTimeProviderConfigurationShould.kt
lsd-consulting/spring-http-exception-handling-library
7e1f222ddc037dfe022abf23765de80ac781a2ea
[ "MIT" ]
null
null
null
package com.lsdconsulting.exceptionhandling.server.time import org.exparity.hamcrest.date.ZonedDateTimeMatchers import org.hamcrest.CoreMatchers.`is` import org.hamcrest.MatcherAssert.assertThat import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.Test import org.springframework.context.annotation.AnnotationConfigApplicationContext import java.time.LocalDateTime import java.time.ZoneId import java.time.ZonedDateTime internal class DefaultTimeProviderConfigurationShould { private val custom = ZonedDateTime.of(LocalDateTime.MIN, ZoneId.of("UTC")) private lateinit var context: AnnotationConfigApplicationContext @AfterEach fun closeContext() { context.close() } @Test fun notRegisterIfTimeProviderPresent() { context = load(true) assertThat(context.getBean(TimeProvider::class.java).get(), `is`(custom)) } @Test fun registerIfTimeProviderPresent() { context = load(false) val now = ZonedDateTime.now() assertThat(context.getBean(TimeProvider::class.java).get(), ZonedDateTimeMatchers.after(now)) } private fun load(registerTracerBean: Boolean): AnnotationConfigApplicationContext { val ctx = AnnotationConfigApplicationContext() if (registerTracerBean) { ctx.defaultListableBeanFactory.registerSingleton("timeProvider", object : TimeProvider { override fun get(): ZonedDateTime { return custom } } as TimeProvider) } ctx.register(DefaultTimeProviderConfiguration::class.java) ctx.refresh() return ctx } }
33.755102
101
0.712817
de065ca6a59822d6645155f0020916071abe09f3
1,748
rs
Rust
src/param/param_supported_extensions.rs
algesten/sctp
1b609a582a126ae564b37679449359143e6292f5
[ "Apache-2.0", "MIT" ]
null
null
null
src/param/param_supported_extensions.rs
algesten/sctp
1b609a582a126ae564b37679449359143e6292f5
[ "Apache-2.0", "MIT" ]
null
null
null
src/param/param_supported_extensions.rs
algesten/sctp
1b609a582a126ae564b37679449359143e6292f5
[ "Apache-2.0", "MIT" ]
null
null
null
use super::{param_header::*, param_type::*, *}; use crate::chunk::chunk_type::*; use anyhow::Result; use bytes::{Buf, BufMut, Bytes, BytesMut}; #[derive(Default, Debug, Clone, PartialEq)] pub(crate) struct ParamSupportedExtensions { pub(crate) chunk_types: Vec<ChunkType>, } impl fmt::Display for ParamSupportedExtensions { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "{} {}", self.header(), self.chunk_types .iter() .map(|ct| ct.to_string()) .collect::<Vec<String>>() .join(" "), ) } } impl Param for ParamSupportedExtensions { fn header(&self) -> ParamHeader { ParamHeader { typ: ParamType::SupportedExt, value_length: self.value_length() as u16, } } fn unmarshal(raw: &Bytes) -> Result<Self> { let header = ParamHeader::unmarshal(raw)?; let reader = &mut raw.slice(PARAM_HEADER_LENGTH..PARAM_HEADER_LENGTH + header.value_length()); let mut chunk_types = vec![]; while reader.has_remaining() { chunk_types.push(ChunkType(reader.get_u8())); } Ok(ParamSupportedExtensions { chunk_types }) } fn marshal_to(&self, buf: &mut BytesMut) -> Result<usize> { self.header().marshal_to(buf)?; for ct in &self.chunk_types { buf.put_u8(ct.0); } Ok(buf.len()) } fn value_length(&self) -> usize { self.chunk_types.len() } fn clone_to(&self) -> Box<dyn Param + Send + Sync> { Box::new(self.clone()) } fn as_any(&self) -> &(dyn Any + Send + Sync) { self } }
25.333333
93
0.544622
9c4fa3b46522f4cdde3b0a4a9ae7aa1d3a86f32a
754
js
JavaScript
bp/config.js
benedictDD/odrl
d6eabca248f3777de5686f56cc0a9d142cef84a8
[ "W3C-20150513" ]
9
2018-06-25T12:28:49.000Z
2021-06-07T20:28:28.000Z
bp/config.js
benedictDD/odrl
d6eabca248f3777de5686f56cc0a9d142cef84a8
[ "W3C-20150513" ]
18
2018-06-25T12:41:00.000Z
2022-03-10T13:21:39.000Z
bp/config.js
benedictDD/odrl
d6eabca248f3777de5686f56cc0a9d142cef84a8
[ "W3C-20150513" ]
5
2019-05-14T19:30:34.000Z
2021-04-12T11:18:19.000Z
var respecConfig = { specStatus: "CG-DRAFT", shortName: "odrl-bp", editors: [ { name: "Benedict Whittam Smith", company: "Thomson Reuters"}, { name: "Víctor Rodríguez-Doncel", url: "https://www.linkedin.com/in/victor-rodriguez-doncel-554b5213/en", company: "Universidad Politécnica de Madrid", companyURL: "http://www.upm.es", mailto: "vrodriguez@fi.upm.es" } ], group: "odrl", wgPublicList: "public-odrl", inlineCSS: true, noIDLIn: true, noLegacyStyle: false, noRecTrack: true, lint: true, github: { repoURL: "https://github.com/w3c/odrl/", branch: "master"} };
34.272727
98
0.533156
85f3d078a0eed7f3399498739746003d65e6836e
1,175
sql
SQL
managed/src/main/resources/db/migration/default/postgres/V128__Create_Missing_Default_Destinations.sql
bllewell/yugabyte-db
b757f8d8c0c10854754a17f63db007a0874eaf1f
[ "Apache-2.0", "CC0-1.0" ]
2,759
2017-10-05T22:15:20.000Z
2019-09-16T13:16:21.000Z
managed/src/main/resources/db/migration/default/postgres/V128__Create_Missing_Default_Destinations.sql
bllewell/yugabyte-db
b757f8d8c0c10854754a17f63db007a0874eaf1f
[ "Apache-2.0", "CC0-1.0" ]
2,195
2017-11-06T23:38:44.000Z
2019-09-16T20:24:31.000Z
managed/src/main/resources/db/migration/default/postgres/V128__Create_Missing_Default_Destinations.sql
bllewell/yugabyte-db
b757f8d8c0c10854754a17f63db007a0874eaf1f
[ "Apache-2.0", "CC0-1.0" ]
257
2017-10-06T02:23:19.000Z
2019-09-13T18:01:15.000Z
-- Copyright (c) YugaByte, Inc. DO $$ DECLARE row record; BEGIN FOR row IN SELECT uuid, gen_random_uuid() AS default_destination_uuid, gen_random_uuid() AS default_channel_uuid FROM customer LOOP -- We are going to create default destination and channel if no default destination -- exists for the customer (Bug in V94 migration) IF NOT EXISTS (SELECT uuid FROM alert_destination WHERE default_destination = true AND customer_uuid = row.uuid) THEN INSERT INTO alert_destination (uuid, customer_uuid, name, default_destination) VALUES (row.default_destination_uuid, row.uuid, 'Default Destination', true); INSERT INTO alert_channel (uuid, customer_uuid, name, params) (SELECT row.default_channel_uuid, row.uuid, 'Default Channel', '{"channelType":"Email","titleTemplate":null,"textTemplate":null,"defaultRecipients":"true","recipients":[],"smtpData":null, "defaultSmtpSettings":"true"}'); INSERT INTO alert_destination_group (destination_uuid, channel_uuid) VALUES (row.default_destination_uuid, row.default_channel_uuid); END IF; END LOOP; END $$;
39.166667
166
0.709787
ec076b8d8d406ccf24b6dd0f5e1241f981fd975d
573
kt
Kotlin
app/src/main/java/xyz/sentrionic/harmony/api/main/responses/CommentResponse.kt
sentrionic/HarmonyApp
0751148a2566ad11098ddd7f122cade7c1792dc3
[ "MIT" ]
null
null
null
app/src/main/java/xyz/sentrionic/harmony/api/main/responses/CommentResponse.kt
sentrionic/HarmonyApp
0751148a2566ad11098ddd7f122cade7c1792dc3
[ "MIT" ]
null
null
null
app/src/main/java/xyz/sentrionic/harmony/api/main/responses/CommentResponse.kt
sentrionic/HarmonyApp
0751148a2566ad11098ddd7f122cade7c1792dc3
[ "MIT" ]
null
null
null
package xyz.sentrionic.harmony.api.main.responses import com.google.gson.annotations.Expose import com.google.gson.annotations.SerializedName class CommentResponse( @SerializedName("pk") @Expose var pk: Int, @SerializedName("comment") @Expose var comment: String, @SerializedName("image") @Expose var image: String, @SerializedName("date_published") @Expose var date_published: String, @SerializedName("username") @Expose var username: String, @SerializedName("likes") @Expose var likes: Int )
18.483871
49
0.685864
2f2db1efca6598a0d50757399e4f39053085ecfc
162
sql
SQL
data/021-rresv_service.sql
cicorias/njit-dbms-final
fec77a0d5cfbcd72489a01bdea73400a9abb544a
[ "MIT" ]
null
null
null
data/021-rresv_service.sql
cicorias/njit-dbms-final
fec77a0d5cfbcd72489a01bdea73400a9abb544a
[ "MIT" ]
16
2020-11-05T02:21:43.000Z
2020-12-03T02:07:48.000Z
data/021-rresv_service.sql
cicorias/njit-dbms-final
fec77a0d5cfbcd72489a01bdea73400a9abb544a
[ "MIT" ]
null
null
null
INSERT INTO rresv_service (sprice,rr_id,sid) VALUES (2.0,1,1), (20.0,2,1), (40.0,3,3), (11.0,3,4), (99.0,3,5), (40.0,4,3), (11.0,4,4), (99.0,4,5);
18
51
0.506173
dd7d2c380795f343078a0cc81d743a15f6531724
722
go
Go
heatmap.go
chrismccluskey/rf-heatmap
d4d64044e36cfb1ea4b20845506355ca1e04e11b
[ "MIT" ]
1
2019-08-07T16:08:31.000Z
2019-08-07T16:08:31.000Z
heatmap.go
chrismccluskey/rf-heatmap
d4d64044e36cfb1ea4b20845506355ca1e04e11b
[ "MIT" ]
null
null
null
heatmap.go
chrismccluskey/rf-heatmap
d4d64044e36cfb1ea4b20845506355ca1e04e11b
[ "MIT" ]
null
null
null
package main import ( // "fmt" "image" "image/color" "image/png" "os" ) type heatmap struct { data_set DataSet config Config } func (h *heatmap) draw() { var img = image.NewRGBA(image.Rect(0, 0, int(h.data_set.hz_width), h.data_set.rows)) var col color.Color // draw x := -1 y := -1 for _, reading := range h.data_set.readings { if ( reading.hz_low == h.data_set.lowest_hz ) { x = -1 y = y+1 } for _, db := range reading.dbs { x = x+1 heat := uint8((db-h.data_set.valley_db)*h.data_set.db_multiplier) col = color.RGBA{0, heat, heat, 255} img.Set(x, y, col) } } f, err := os.Create(h.config.png_filename) if err != nil { panic(err) } defer f.Close() png.Encode(f, img) }
16.409091
85
0.613573
a5df8570f276a42683ed72cd502b62dbdd5bc3bf
9,679
sql
SQL
src/main/resources/sql/init.sql
xiaoxiao-xx/Iwater
19a625bc0c27c6ad086e3d6b34cbd04529c0bb0a
[ "MIT" ]
2
2019-11-22T06:29:53.000Z
2020-01-22T02:50:18.000Z
src/main/resources/sql/init.sql
xiaoxiao-xx/Iwater
19a625bc0c27c6ad086e3d6b34cbd04529c0bb0a
[ "MIT" ]
1
2022-03-31T21:01:16.000Z
2022-03-31T21:01:16.000Z
src/main/resources/sql/init.sql
xiaoxiao-xx/Iwater
19a625bc0c27c6ad086e3d6b34cbd04529c0bb0a
[ "MIT" ]
null
null
null
/* Navicat Premium Data Transfer Source Server : xiaoxiao Source Server Type : MySQL Source Server Version : 50725 Source Host : localhost:3306 Source Schema : iwater Target Server Type : MySQL Target Server Version : 50725 File Encoding : 65001 Date: 22/11/2019 14:23:56 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for bucket_in_out -- ---------------------------- DROP TABLE IF EXISTS `bucket_in_out`; CREATE TABLE `bucket_in_out` ( `BUCKET_IN_OUT_ID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `CUSTOMER_ID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `CUSTOMER_NUM` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `REMARKS` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `ACCOUNT_MONEY` double NULL DEFAULT NULL, `CHANGE_TIME` datetime(0) NULL DEFAULT NULL, PRIMARY KEY (`BUCKET_IN_OUT_ID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of bucket_in_out -- ---------------------------- INSERT INTO `bucket_in_out` VALUES ('2db85319-8cbc-47a4-b8e4-f0e6cddd262e', '0c60d192-8e10-4eaa-a8e5-0a70964dea34', '1', '娃哈哈(1)', 40, '2019-11-22 14:18:08'); -- ---------------------------- -- Table structure for buy_in -- ---------------------------- DROP TABLE IF EXISTS `buy_in`; CREATE TABLE `buy_in` ( `BUY_IN_ID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `GOODS_ID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `GOODS_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `BUY_NUM` int(11) NULL DEFAULT NULL, `BUY_MONEY` double NULL DEFAULT NULL, `BUY_TIME` datetime(0) NULL DEFAULT NULL, PRIMARY KEY (`BUY_IN_ID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for customer_goods -- ---------------------------- DROP TABLE IF EXISTS `customer_goods`; CREATE TABLE `customer_goods` ( `CUSTOMER_GOODS_ID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `CUSTOMER_ID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `GOODS_ID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`CUSTOMER_GOODS_ID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of customer_goods -- ---------------------------- INSERT INTO `customer_goods` VALUES ('c340aab4-4818-4a9a-9383-dd3d0f144e5a', '0c60d192-8e10-4eaa-a8e5-0a70964dea34', '22cc2c93-8c73-4f81-b3d6-134641e70578'); INSERT INTO `customer_goods` VALUES ('f73f6f40-eeb5-45ae-a714-6fd8489f4724', 'eabc58b1-720c-4cae-9198-d70e8234e4ae', '3ae38d05-dabc-4f02-9cfa-4fa3fc3d9690'); -- ---------------------------- -- Table structure for customer_table -- ---------------------------- DROP TABLE IF EXISTS `customer_table`; CREATE TABLE `customer_table` ( `CUSTOMER_ID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `CUSTOMER_NUM` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `CUSTOMER_ADDR` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `CUSTOMER_TEL` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `CUSTOMER_STATU` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `CUSTOMER_OTHERINFO` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `CUSTOMER_TIME` datetime(0) NULL DEFAULT NULL, PRIMARY KEY (`CUSTOMER_ID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of customer_table -- ---------------------------- INSERT INTO `customer_table` VALUES ('0c60d192-8e10-4eaa-a8e5-0a70964dea34', '1', '新疆乌鲁木齐', '13956898521', '活跃', '', '2019-11-22 14:12:25'); INSERT INTO `customer_table` VALUES ('eabc58b1-720c-4cae-9198-d70e8234e4ae', '2', '成都市', '17789565263', '活跃', '', '2019-11-22 14:19:36'); -- ---------------------------- -- Table structure for goods_table -- ---------------------------- DROP TABLE IF EXISTS `goods_table`; CREATE TABLE `goods_table` ( `GOODS_ID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `GOODS_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `GOODS_OUT` double NULL DEFAULT NULL, `GOODS_IN` double NULL DEFAULT NULL, `GOODS_SPECS` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `CUSTOMER_TIME` datetime(0) NULL DEFAULT NULL, PRIMARY KEY (`GOODS_ID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of goods_table -- ---------------------------- INSERT INTO `goods_table` VALUES ('22cc2c93-8c73-4f81-b3d6-134641e70578', '娃哈哈', 30, 20, '大桶', '2019-11-22 14:11:33'); INSERT INTO `goods_table` VALUES ('3ae38d05-dabc-4f02-9cfa-4fa3fc3d9690', '恒大冰泉', 16, 10, '大桶', '2019-11-22 14:11:47'); INSERT INTO `goods_table` VALUES ('b57d14cf-a3c5-4bbb-bd18-2b7b55760c99', '怡宝', 18, 12, '大桶', '2019-11-22 14:11:22'); -- ---------------------------- -- Table structure for money_manage -- ---------------------------- DROP TABLE IF EXISTS `money_manage`; CREATE TABLE `money_manage` ( `MANAGE_ID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `INCOME` double NULL DEFAULT NULL, `OUTCOME` double NULL DEFAULT NULL, `REMARKS` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `MANAGE_TIME` datetime(0) NULL DEFAULT NULL, PRIMARY KEY (`MANAGE_ID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of money_manage -- ---------------------------- INSERT INTO `money_manage` VALUES ('11d174a2-f403-47cb-b332-dd8e4ce2827b', 16, NULL, '客户(2)购买恒大冰泉[大桶](1)桶', '2019-11-22 14:19:57'); INSERT INTO `money_manage` VALUES ('2db85319-8cbc-47a4-b8e4-f0e6cddd262e', 40, NULL, '客户1号押娃哈哈(1)', '2019-11-22 14:18:08'); -- ---------------------------- -- Table structure for user -- ---------------------------- DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `ID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `USERNAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `PASSWORD` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `CREATETIME` datetime(0) NULL DEFAULT NULL, PRIMARY KEY (`ID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of user -- ---------------------------- INSERT INTO `user` VALUES ('1', 'admin', 'admin', '2019-11-22 14:04:51'); -- ---------------------------- -- Table structure for water_sale -- ---------------------------- DROP TABLE IF EXISTS `water_sale`; CREATE TABLE `water_sale` ( `WATER_SALE_ID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `CUSTOMER_ID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `CUSTOMER_NUM` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `GOODS_ID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `GOODS_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `SALE_NUM` int(11) NULL DEFAULT NULL, `SALE_MONEY` double NULL DEFAULT NULL, `TICKET_COUNT` int(11) NULL DEFAULT NULL, `REMARKS` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `SALE_STATU` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `SALE_TIME` datetime(0) NULL DEFAULT NULL, PRIMARY KEY (`WATER_SALE_ID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of water_sale -- ---------------------------- INSERT INTO `water_sale` VALUES ('03d56027-b1c8-49cb-8267-06fed3a4057c', '0c60d192-8e10-4eaa-a8e5-0a70964dea34', '1', '22cc2c93-8c73-4f81-b3d6-134641e70578', '娃哈哈[大桶]', 1, 20, 1, NULL, '1', '2019-11-22 14:18:58'); INSERT INTO `water_sale` VALUES ('461206da-25df-4f81-828a-1dd8b55da7b2', 'eabc58b1-720c-4cae-9198-d70e8234e4ae', '2', '3ae38d05-dabc-4f02-9cfa-4fa3fc3d9690', '恒大冰泉[大桶]', 1, 16, 0, NULL, '1', '2019-11-22 14:19:57'); -- ---------------------------- -- Table structure for water_ticket -- ---------------------------- DROP TABLE IF EXISTS `water_ticket`; CREATE TABLE `water_ticket` ( `WATER_TICKET_ID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `CUSTOMER_ID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `CUSTOMER_NUM` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `WATER_TICKET_COUNT` int(11) NULL DEFAULT NULL, PRIMARY KEY (`WATER_TICKET_ID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of water_ticket -- ---------------------------- INSERT INTO `water_ticket` VALUES ('9524e4f5-86e5-4a67-9e5e-9d133a4392d8', '0c60d192-8e10-4eaa-a8e5-0a70964dea34', '1', 0); INSERT INTO `water_ticket` VALUES ('d4243b48-40a1-424e-88b9-8c79954d2ec0', 'eabc58b1-720c-4cae-9198-d70e8234e4ae', '2', 0); SET FOREIGN_KEY_CHECKS = 1;
50.411458
214
0.675276
58412ea0a3fc23e0c4ddd1016bfbf0cafc836a39
801
c
C
src/mc_build/mc_build_json_generated.c
campbellhome/mc_common
71d388c28995c8e0f7d9b4d4a780f5fb820ff7dd
[ "MIT" ]
null
null
null
src/mc_build/mc_build_json_generated.c
campbellhome/mc_common
71d388c28995c8e0f7d9b4d4a780f5fb820ff7dd
[ "MIT" ]
null
null
null
src/mc_build/mc_build_json_generated.c
campbellhome/mc_common
71d388c28995c8e0f7d9b4d4a780f5fb820ff7dd
[ "MIT" ]
null
null
null
// Copyright (c) 2012-2019 Matt Campbell // MIT license (see License.txt) // AUTOGENERATED FILE - DO NOT EDIT // clang-format off #include "mc_build/mc_build_json_generated.h" #include "bb_array.h" #include "json_utils.h" #include "va.h" #include "mc_build/mc_build_commands.h" #include "mc_build/mc_build_dependencies.h" #include "sb.h" #include "sdict.h" #include "uuid_rfc4122/sysdep.h" ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
28.607143
75
0.36829
1aeb989be88c6f5ecd26710b3900038ff35a0d26
402
kt
Kotlin
src/kotlin/kt_101/Main_101.kt
iJKENNEDY/kotlin_code_101
08f08f782264b0f173eea4dc235aebe4492e4536
[ "MIT" ]
null
null
null
src/kotlin/kt_101/Main_101.kt
iJKENNEDY/kotlin_code_101
08f08f782264b0f173eea4dc235aebe4492e4536
[ "MIT" ]
null
null
null
src/kotlin/kt_101/Main_101.kt
iJKENNEDY/kotlin_code_101
08f08f782264b0f173eea4dc235aebe4492e4536
[ "MIT" ]
null
null
null
package kt_101 import Basicos_222 fun main() { val estrDatos = Estructuras_datos() //estrDatos.sepPostNegat() val lambdas111 = Lambdas_111() // lambdas111.lambda_basico() val addLambda = {a:Int, b:Int ->a+b} //lambdas111.operateOnNumbers(5,10,operation = addLambda ) val basicos222 = Basicos_222() // basicos222.basic_max_result() println("-------------------") }
22.333333
62
0.646766
9c4244bf354617d5de519c01606ec4e95a20f921
810
js
JavaScript
app/containers/Charts/Line/index.js
hurrtz/covid19dashboard
df33276baae49b35e86cd381acf5e4d2eff700e3
[ "MIT" ]
null
null
null
app/containers/Charts/Line/index.js
hurrtz/covid19dashboard
df33276baae49b35e86cd381acf5e4d2eff700e3
[ "MIT" ]
8
2020-03-26T23:47:45.000Z
2021-09-03T00:53:41.000Z
app/containers/Charts/Line/index.js
hurrtz/covid19dashboard
df33276baae49b35e86cd381acf5e4d2eff700e3
[ "MIT" ]
null
null
null
import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; import { makeCountryDataForLineChart as makeData } from 'containers/HomePage/selectors'; import ChartLineComponent from 'components/Charts/Line'; const LineChart = (props) => props.data && <ChartLineComponent {...props} />; LineChart.propTypes = { data: PropTypes.arrayOf( PropTypes.shape({ Country: PropTypes.string, Province: PropTypes.string, Lat: PropTypes.number, Lon: PropTypes.number, Date: PropTypes.string, Cases: PropTypes.number, Status: PropTypes.string, }), ), }; const mapStateToProps = createSelector([makeData()], (data) => ({ data })); export default connect(mapStateToProps)(LineChart);
27.931034
88
0.7
ed3cb575592a45df52c53d8bdd7f445d08d0793c
1,868
lua
Lua
project/Resources/Lib/CCSceneEx.lua
pigpigyyy/Dorothy
81dbf800d0e3b15c96d67e1fb72b88d3deae780f
[ "Zlib", "libtiff", "BSD-2-Clause", "Apache-2.0", "MIT", "Libpng", "curl", "BSD-3-Clause" ]
3
2020-01-29T02:22:14.000Z
2022-03-03T08:13:45.000Z
project/Resources/Lib/CCSceneEx.lua
pigpigyyy/Dorothy
81dbf800d0e3b15c96d67e1fb72b88d3deae780f
[ "Zlib", "libtiff", "BSD-2-Clause", "Apache-2.0", "MIT", "Libpng", "curl", "BSD-3-Clause" ]
null
null
null
project/Resources/Lib/CCSceneEx.lua
pigpigyyy/Dorothy
81dbf800d0e3b15c96d67e1fb72b88d3deae780f
[ "Zlib", "libtiff", "BSD-2-Clause", "Apache-2.0", "MIT", "Libpng", "curl", "BSD-3-Clause" ]
1
2021-05-20T09:04:32.000Z
2021-05-20T09:04:32.000Z
--[[ CCScene:transition("cf",{"crossFade",1,CCOrientation.Left}) CCScene:add("firstScene",CCScene()) CCScene:run("firstScene","fadeIn") CCScene:forward("firstScene","cf") CCScene:back("crossFade") CCScene:clearHistory() --]] local CCScene = require("CCScene") local CCDirector = require("CCDirector") local scenes = {} local transitions = {} local currentScene local sceneStack = {} function CCScene:transition(name,item) transitions[name] = item end function CCScene:add(name,scene) scenes[name] = scene scene:slot("Cleanup",function() scenes[name] = nil end) end function CCScene:remove(name) local scene = scenes[name] if scene then scene:cleanup() scenes[name] = nil return true end return false end local function runScene(scene,tname,cleanup) local data = tname and transitions[tname] local transition if data then local args = {data[2],scene} for i = 3,#data do args[i] = data[i] end transition = CCScene[data[1]](CCScene,unpack(args)) end if CCDirector.sceneStackSize == 0 then CCDirector:run(transition or scene) else CCDirector:replaceScene(transition or scene,cleanup) end end function CCScene:run(sname,tname) local scene = scenes[sname] if scene then if #sceneStack > 0 then sceneStack = {} end currentScene = scene runScene(scene,tname,true) end end function CCScene:forward(sname,tname) local scene = scenes[sname] if scene then table.insert(sceneStack,currentScene) currentScene = scene runScene(scene,tname,false) end end function CCScene:back(tname) local lastScene = table.remove(sceneStack) if lastScene then currentScene = lastScene runScene(lastScene,tname,false) end end function CCScene:clearHistory() currentScene = CCDirector.currentScene sceneStack = {} end return CCScene
20.988764
60
0.706638
9cf5ea645ca452c420e8cb46b2c890a94f490ef0
84
sql
SQL
src/basic_select/weather_observation_station_10.sql
djeada/Sql-HackerRank
3c96cdf4fe43db438f67fd53f121c79668a12ea2
[ "MIT" ]
null
null
null
src/basic_select/weather_observation_station_10.sql
djeada/Sql-HackerRank
3c96cdf4fe43db438f67fd53f121c79668a12ea2
[ "MIT" ]
null
null
null
src/basic_select/weather_observation_station_10.sql
djeada/Sql-HackerRank
3c96cdf4fe43db438f67fd53f121c79668a12ea2
[ "MIT" ]
null
null
null
SELECT DISTINCT CITY FROM STATION WHERE REGEXP_LIKE(CITY, '[^AEIOU]$');
10.5
33
0.642857
184bd10042f105fa2605ff557487bcbea6c7211e
2,484
css
CSS
css/vog.css
Efrgds/2
e20fad299ef7adcc88bd1974f3ee6efa8663a500
[ "MIT" ]
null
null
null
css/vog.css
Efrgds/2
e20fad299ef7adcc88bd1974f3ee6efa8663a500
[ "MIT" ]
null
null
null
css/vog.css
Efrgds/2
e20fad299ef7adcc88bd1974f3ee6efa8663a500
[ "MIT" ]
null
null
null
body { font-family: sans-serif; } .header nav{ position: fixed; top: 0; left: 0; width: 100%; background: rgba(0,0,0,.50); box-shadow: 0 3px 10px -2px rgba(0,0,0,.1); border: 1px solid rgba(0,0,0,.1); } .header nav ul{ list-style: none; position: relative; float: right; margin-right: 100px; display: inline-table; } nav ul li{ float: left; -webkit-transition: all .2s ease-in-out; -moz-transition: all .2s ease-in-out; transition: all .2s ease-in-out; } nav ul li:hover{background: rgba(0,0,0,.15);} nav ul li:hover > ul{display: block;} nav ul li{ float: left; -webkit-transition: all .2s ease-in-out; -moz-transition: all .2s ease-in-out; transition: all .2s ease-in-out; } nav ul li a{ display: block; padding: 30px 20px; color: #fff; font-size: .9em; letter-spacing: 1px; text-decoration: none; text-transform: uppercase; } nav ul ul{ display: none; background: #000; position: absolute; top: 100%; box-shadow: -3px 3px 10px -2px rgba(0,0,0,.1); border: 1px solid rgba(0,0,0,.1); } nav ul ul li{float: none; position: relative;} nav ul ul li a { padding: 15px 30px; border-bottom: 1px solid rgba(0,0,0,.5); } nav ul ul ul { position: absolute; left: 100%; top:0; } .wrapper { position: absolute; width: 100%; padding: 10%; height: 100%; left: 0; top: 0; background-color: #d5d5d5; } .card { display: flex; width: 327px; height: 420px; position: relative; perspective: 1000px; } .front, .back { position: absolute; width: 100%; height: 100%; left: 0; top: 0; transition: 1s; backface-visibility: hidden; background-color: #f8ecde; border-radius: 10px; } .front img { max-width: 100%; min-width: 100%; height: auto; border-radius: 10px; } .back { transform: rotateY(180deg); } .card:hover .front { transform: rotateY(180deg);} .card:hover .back { transform: rotateY(360deg);} h4 { text-indent: 3%; text-align : justify; padding: 0px 30px 0px 30px; }
23.214953
56
0.514895
e9025dbbce4fe091f5d3b603898ea3d6a12ac001
98
sql
SQL
layouts/db/mysql/schema/2016-02-09_15-34-14_layer_cluster_maxdistance.sql
tewksbg/kvwmap-en
92d232f70c438c5a1b9c18ef06b65382716bdc7b
[ "Naumen", "Condor-1.1", "MS-PL" ]
null
null
null
layouts/db/mysql/schema/2016-02-09_15-34-14_layer_cluster_maxdistance.sql
tewksbg/kvwmap-en
92d232f70c438c5a1b9c18ef06b65382716bdc7b
[ "Naumen", "Condor-1.1", "MS-PL" ]
null
null
null
layouts/db/mysql/schema/2016-02-09_15-34-14_layer_cluster_maxdistance.sql
tewksbg/kvwmap-en
92d232f70c438c5a1b9c18ef06b65382716bdc7b
[ "Naumen", "Condor-1.1", "MS-PL" ]
null
null
null
BEGIN; ALTER TABLE `layer` ADD `cluster_maxdistance` INT( 11 ) NULL AFTER `filteritem`; COMMIT;
16.333333
80
0.734694
11e72c1e5a3ce04a3ebc71ea0faac4ece61646c0
5,151
html
HTML
source/app/main/views/New folder/offer.html
realsungroup/KingofOffer
799e6b9ccc6b2d0be18e6efaaf16a880b8633394
[ "MIT" ]
null
null
null
source/app/main/views/New folder/offer.html
realsungroup/KingofOffer
799e6b9ccc6b2d0be18e6efaaf16a880b8633394
[ "MIT" ]
null
null
null
source/app/main/views/New folder/offer.html
realsungroup/KingofOffer
799e6b9ccc6b2d0be18e6efaaf16a880b8633394
[ "MIT" ]
null
null
null
<form id="form1" class="opp"> <table align="center"> <!--border='1'cellspacing="0" cellpadding="0"--> <input type="button" value="New Offer Proposal" class="btn btn-success mtaii fbb" onclick= "newOp()"> <thead> <tr> <th colspan="8"> <input type="button" value="clear" class="rf btn btn-warning fbb" onclick="rePage()"> <input type="button" value="filter" class="rf btn btn-success fbb" onclick="searchcf()" id="searchBtncf"> <input class="rf mini-textbox" id="searchBoxcf" name="searchBoxcf"> </th> </tr> <tr> <th class="tc">Candidate</th> <th class="tc">Job Title</th> <th class="tc">Level</th> <th class="tc">Location</th> <th class="tc">Hiring Manager</th> <th class="tc">Department</th> <th class="tc">审批状态</th> <th></th> </tr> </thead> <tbody data-bind="foreach: oList"> <tr> <td class="tc"><span data-bind="text: C3_541011395561"></span></td> <td class="tc"><span data-bind="text: C3_534181598826"></span></td> <td class="tc"><span data-bind="text: C3_534181645731"></span></td> <td class="tc"><span data-bind="text: C3_534181718652"></span></td> <td class="tc"><span data-bind="text: C3_534264776828"></span></td> <td class="tc"><span data-bind="text: C3_534181730034"></span></td> <td class="tc"><span data-bind="text: C3_544804530402"></span></td> <td class="tc"> <input type="button" value="Delete" class="btn btn-warning rf fbb" data-bind="click : offerDel.bind(),visible:($data.C3_534184252529==null||$data.C3_534184252529=='N')"> <input type="button" value="Preview" class="btn btn-primary rf fbb" data-bind="click : offerView.bind()"> <input type="button" value="Edit" class="btn btn-warning rf fbb" data-bind="click : offerEdit.bind(),visible:($data.C3_534184252529==null||$data.C3_534184252529=='N')"> <input type="button" value="Submit" class="btn btn-success rf fbb" data-bind="click : offerSubmit.bind(),visible:($data.C3_534184252529==null||$data.C3_534184252529=='N')"> </td> </tr> </tbody> <!--<thead> <tr> <th colspan="8"> <input type="button" value="New Offer Proposal" class="btn btn-success mtaii fbb" onclick= "newOp()"> </th> </tr> </thead> <tbody data-bind="foreach: oList"> <tr> <td colspan="8" class="head"> <input type="button" value="Delete" class="btn btn-warning rf fbb" data-bind="click : offerDel.bind(),visible:($data.C3_534184252529==null||$data.C3_534184252529=='N')"> <input type="button" value="Preview" class="btn btn-primary rf fbb" data-bind="click : offerView.bind()"> <input type="button" value="Edit" class="btn btn-warning rf fbb" data-bind="click : offerEdit.bind(),visible:($data.C3_534184252529==null||$data.C3_534184252529=='N')"> <input type="button" value="Submit" class="btn btn-success rf fbb" data-bind="click : offerSubmit.bind(),visible:($data.C3_534184252529==null||$data.C3_534184252529=='N')"> </td> </tr> <tr> <td class="title"> Candidate </td> <td> <b data-bind="text: C3_534181747202"></b> </td> <td class="title" width="12%"> Job Title </td> <td width="13%"> <b data-bind="text: C3_534181598826"></b> </td> <td class="title" width="12%"> Level </td> <td width="13%"> <b data-bind="text: C3_534181645731"></b> </td> <td class="title" width="12%"> Location </td> <td width="13%"> <b data-bind="text: C3_534181718652"></b> </td> </tr> <tr> <td class="title" width="12%"> Hiring Manager </td> <td width="13%"> <b data-bind="text: C3_534264776828"></b> </td> <td class="title"> Department </td> <td colspan="3"> <b data-bind="text: C3_534181730034"></b> </td> <td class="title"> RequistionNumber </td> <td> <b data-bind="text: C3_534184180284"></b> </td> </tr> </tbody>--> </table> </form>
48.59434
192
0.465541
b6d51658f20fcbb5a7f239bd7ad346e5a542c5af
691
asm
Assembly
oeis/092/A092985.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/092/A092985.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/092/A092985.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A092985: a(n) is the product of first n terms of an arithmetic progression with the first term 1 and common difference n. ; 1,1,3,28,585,22176,1339975,118514880,14454403425,2326680294400,478015854767451,122087424094272000,37947924636264267625,14105590169042424729600,6178966019176767549393375,3150334059785191453342744576,1849556085478041490537172810625,1238832248972992893599427919872000,938973574652102126542847159376533875,799582278604681926128932125293445120000,760078763365725054762804605784866082489801,801948520882734753652178908837719192371200000,934287835463606348182047460760832346982550984375 mov $2,$0 mov $3,1 mov $4,1 lpb $0 sub $0,1 mul $4,$3 add $3,$2 lpe mov $0,$4
53.153846
481
0.861071
94832f1b10f2331c6e953131dcab43ab874ba815
10,699
kt
Kotlin
src/main/kotlin/net/inherency/finances/domain/reconcile/rule/BudgetCategoryRuleService.kt
scottygaydos/finances
825dd8a5e36ce88b45aa3585871faee8734ae750
[ "Apache-2.0" ]
null
null
null
src/main/kotlin/net/inherency/finances/domain/reconcile/rule/BudgetCategoryRuleService.kt
scottygaydos/finances
825dd8a5e36ce88b45aa3585871faee8734ae750
[ "Apache-2.0" ]
null
null
null
src/main/kotlin/net/inherency/finances/domain/reconcile/rule/BudgetCategoryRuleService.kt
scottygaydos/finances
825dd8a5e36ce88b45aa3585871faee8734ae750
[ "Apache-2.0" ]
null
null
null
package net.inherency.finances.domain.reconcile.rule import me.xdrop.fuzzywuzzy.FuzzySearch import net.inherency.finances.domain.account.Account import net.inherency.finances.domain.account.AccountService import net.inherency.finances.domain.account.AccountService.Companion.GLOBAL_EXTERNAL_DEBIT_ACCOUNT_NAME import net.inherency.finances.domain.budget.category.BudgetCategoryData import net.inherency.finances.domain.budget.category.BudgetCategoryService import net.inherency.finances.domain.transaction.MintTransaction import org.slf4j.LoggerFactory import org.springframework.stereotype.Service @Service class BudgetCategoryRuleService( private val budgetCategoryRuleRepository: BudgetCategoryRuleRepository, private val accountService: AccountService, private val budgetCategoryService: BudgetCategoryService) { private var rules: List<BudgetCategoryRuleData> = emptyList() private val log = LoggerFactory.getLogger(BudgetCategoryRuleService::class.java) fun findMatchingRuleForAutoCategorization(mintTx: MintTransaction): BudgetCategoryRule? { var ruleMatch = matchBasedOnMintCategory(mintTx) if (ruleMatch == null) { queryRulesIfNeeded() val rules = budgetCategoryRuleRepository .readAll() .filter { validateRuleOnlyRoutesOneAccount(it) } ruleMatch = rules.firstOrNull { rule -> ruleDescriptionDoesMatchTransaction(rule, mintTx) } ?: rules.firstOrNull { rule -> ruleDescriptionUsesWildcardsAndDoesMatchTransaction(rule, mintTx) } ?: rules.firstOrNull { rule -> ruleDescriptionIsAnythingAndDebitAccountMatches(rule, mintTx) } ?: rules.firstOrNull { rule -> ruleDescriptionIsAnythingAndCreditAccountMatches(rule, mintTx) } } return validateRuleOrReturnNull(ruleMatch) } private fun nonBudgetCategory(categories: List<BudgetCategoryData>): BudgetCategoryData { return categories.first { it.name == "Non Budget" } } private fun matchBasedOnMintCategory(mintTx: MintTransaction): BudgetCategoryRuleData? { val accounts = accountService.readAll() val categories = budgetCategoryService.readAll() val globalExternalAccount = accounts.first { it.name == GLOBAL_EXTERNAL_DEBIT_ACCOUNT_NAME } val checkingAccount = accounts.first { it.name.contains("Checking") } val creditCardPayment = "Credit Card Payment" if (mintTx.category == creditCardPayment) { return handleMintCategoryCreditCardPayment(mintTx, creditCardPayment, accounts, categories, checkingAccount) } val food = "Food" val spending = "Spending" val savings = "Savings" val gas = "Gas" val utilities = "Utilities" val mortgage = "Mortgage" val carInsurance = "Car Insurance" val health = "Health" val car = "Car" val tax = "Tax Deductible Donation" val income = "Income" val reimbursement = "Blaine Shared Card Payment" val foodRule = QuickRule(food, globalExternalAccount, null) val spendingRule = QuickRule(spending, globalExternalAccount, null) val myCategoryAndCreditAccountByMintCategory = mapOf( "Paycheck" to QuickRule(income, checkingAccount, null), "Blaine Shared" to QuickRule(reimbursement, checkingAccount, null), "Auto Payment" to QuickRule(car, accounts.first { it.name.contains("Car Pmt") }, null), "Charity" to QuickRule(tax, globalExternalAccount, null), "Health & Fitness" to QuickRule(health, globalExternalAccount, null), "Food & Dining" to foodRule, "Groceries" to foodRule, "Restaurants" to foodRule, "Fast Food" to foodRule, "Shopping" to spendingRule, "Entertainment" to spendingRule, "Savings" to QuickRule(savings, globalExternalAccount, null), "Gas & Fuel" to QuickRule(gas, globalExternalAccount, null), "Electric" to QuickRule(utilities, accounts.first { it.name.contains("Electric") }, null), "Water" to QuickRule(utilities, accounts.first { it.name.contains("Water") }, null), "Gas" to QuickRule(utilities, accounts.first { it.name.contains("Gas") }, null), "Trash" to QuickRule(utilities, accounts.first { it.name.contains("Trash") }, null), "Mortgage & Rent" to QuickRule(mortgage, accounts.first { it.name.contains("Mortgage") }, null), "HOA" to QuickRule(mortgage, accounts.first { it.name.contains("HOA") }, null), "Auto Insurance" to QuickRule(carInsurance, accounts.first { it.name.contains("Car Ins") }, null) ) val mapResult: QuickRule? = myCategoryAndCreditAccountByMintCategory[mintTx.category] return if (mapResult != null) { val ruleCategory = categories.first { it.name == mapResult.myCategoryName } val result = BudgetCategoryRuleData("", mapResult.creditAccount?.id, mapResult.debitAccount?.id, ruleCategory.id) log.info("Using rule from mint category - ${mintTx.category}: $result") return result } else { null } } data class QuickRule ( val myCategoryName: String, val creditAccount: Account?, val debitAccount: Account? ) @Suppress("SameParameterValue") private fun handleMintCategoryCreditCardPayment(mintTx: MintTransaction, creditCardPayment: String, accounts: List<Account>, categories: List<BudgetCategoryData>, checkingAccount: Account): BudgetCategoryRuleData? { if (accounts.first { mintTx.accountName == it.mintName || mintTx.accountName == it.mintNameAlt } == checkingAccount) { val result = BudgetCategoryRuleData("", null, checkingAccount.id, nonBudgetCategory(categories).id) log.info("Using rule from mint category - ${mintTx.category}: $result") return result } val billAccount = findBestBillMatch(mintTx, accounts) return if (billAccount == null) { null } else { val category = categories.first { it.name == creditCardPayment } val result = BudgetCategoryRuleData("", billAccount.id, null, category.id) log.info("Using rule from mint category - ${mintTx.category}: $result") return result } } private fun findBestBillMatch(tx: MintTransaction, accounts: List<Account> ): Account? { val creditCardAccounts = accounts.filter { it.name.contains("CC") } val billsByMatchRatio = creditCardAccounts.associateBy { calculateMatchRatioOfBillToTransaction(it, tx) }.toSortedMap() return billsByMatchRatio[billsByMatchRatio.lastKey()] } private fun calculateMatchRatioOfBillToTransaction(acct: Account, tx: MintTransaction): Int { return if (acct.mintName == tx.accountName || acct.mintNameAlt == tx.accountName) { 100 } else { FuzzySearch.ratio(acct.description, tx.description) .coerceAtLeast(FuzzySearch.ratio(acct.description, tx.originalDescription)) .coerceAtLeast(FuzzySearch.ratio(acct.name, tx.description)) .coerceAtLeast(FuzzySearch.ratio(acct.name, tx.originalDescription)) } } private fun queryRulesIfNeeded() { if (rules.isEmpty()) { rules = budgetCategoryRuleRepository .readAll() .filter { validateRuleOnlyRoutesOneAccount(it) } } } private fun ruleDescriptionDoesMatchTransaction(rule: BudgetCategoryRuleData, mintTx: MintTransaction) = rule.descriptionToMatch == mintTx.description || rule.descriptionToMatch == mintTx.originalDescription private fun ruleDescriptionUsesWildcardsAndDoesMatchTransaction(rule: BudgetCategoryRuleData, mintTx: MintTransaction): Boolean { return if (rule.descriptionToMatch.startsWith("*") && rule.descriptionToMatch.endsWith("*") && rule.descriptionToMatch.trim().length > 1) { val description = rule.descriptionToMatch.removePrefix("*").removeSuffix("*") mintTx.description.contains(description) || mintTx.originalDescription.contentEquals(description) } else { false } } private fun ruleDescriptionIsAnythingAndDebitAccountMatches(rule: BudgetCategoryRuleData, mintTx: MintTransaction) : Boolean { if (rule.descriptionToMatch == "*") { val debitAccount = findAccount(rule.accountIdToDebit) ?: return false return listOf(debitAccount.mintName, debitAccount.mintNameAlt).contains(mintTx.getDebitAccountName()) } else { return false } } private fun ruleDescriptionIsAnythingAndCreditAccountMatches(rule: BudgetCategoryRuleData, mintTx: MintTransaction) : Boolean { if (rule.descriptionToMatch == "*") { val creditAccount = findAccount(rule.accountIdToCredit) ?: return false return listOf(creditAccount.mintName, creditAccount.mintNameAlt).contains(mintTx.getCreditAccountName()) } else { return false } } private fun validateRuleOnlyRoutesOneAccount(rule: BudgetCategoryRuleData) = (rule.accountIdToCredit != null && rule.accountIdToDebit == null) || (rule.accountIdToCredit == null && rule.accountIdToDebit != null) private fun validateRuleOrReturnNull(ruleMatch: BudgetCategoryRuleData?): BudgetCategoryRule? { if (ruleMatch == null) { return null } val creditAccount = findAccount(ruleMatch.accountIdToCredit) val debitAccount = findAccount(ruleMatch.accountIdToDebit) if (creditAccount == null && debitAccount == null) { return null } if (creditAccount != null && debitAccount != null) { return null } val category = budgetCategoryService.readAll() .firstOrNull { it.id == ruleMatch.budgetCategoryId } return if (category == null) { null } else { BudgetCategoryRule(category, debitAccount, creditAccount, ruleMatch.descriptionToMatch) } } private fun findAccount(id: Int?): Account? { return accountService.readAll().firstOrNull { it.id == id} } }
47.977578
147
0.656884
86cb2f3827df188e00e7abd1b0d34d1cb06d573e
4,907
rs
Rust
amethyst_assets/src/prefab/system.rs
Techno-coder/amethyst
4d1067cf500b823c8b72ad265ff57fd445dcfad6
[ "MIT" ]
null
null
null
amethyst_assets/src/prefab/system.rs
Techno-coder/amethyst
4d1067cf500b823c8b72ad265ff57fd445dcfad6
[ "MIT" ]
null
null
null
amethyst_assets/src/prefab/system.rs
Techno-coder/amethyst
4d1067cf500b823c8b72ad265ff57fd445dcfad6
[ "MIT" ]
null
null
null
use std::{marker::PhantomData, ops::Deref}; use amethyst_core::{ specs::{ BitSet, Entities, Entity, InsertedFlag, Join, Read, ReadExpect, ReadStorage, ReaderId, Resources, System, Write, WriteStorage, }, ArcThreadPool, Parent, Time, }; use {AssetStorage, Completion, Handle, HotReloadStrategy, ProcessingState, ResultExt}; use super::{Prefab, PrefabData, PrefabTag}; /// System that load `Prefab`s for `PrefabData` `T`. /// /// ### Type parameters: /// /// - `T`: `PrefabData` pub struct PrefabLoaderSystem<T> { _m: PhantomData<T>, entities: Vec<Entity>, finished: Vec<Entity>, to_process: BitSet, insert_reader: Option<ReaderId<InsertedFlag>>, next_tag: u64, } impl<T> Default for PrefabLoaderSystem<T> { fn default() -> Self { PrefabLoaderSystem { _m: PhantomData, entities: Vec::default(), finished: Vec::default(), to_process: BitSet::default(), insert_reader: None, next_tag: 0, } } } impl<'a, T> System<'a> for PrefabLoaderSystem<T> where T: PrefabData<'a> + Send + Sync + 'static, { type SystemData = ( Entities<'a>, Write<'a, AssetStorage<Prefab<T>>>, ReadStorage<'a, Handle<Prefab<T>>>, Read<'a, Time>, ReadExpect<'a, ArcThreadPool>, Option<Read<'a, HotReloadStrategy>>, WriteStorage<'a, Parent>, WriteStorage<'a, PrefabTag<T>>, T::SystemData, ); fn run(&mut self, data: Self::SystemData) { let ( entities, mut prefab_storage, prefab_handles, time, pool, strategy, mut parents, mut tags, mut prefab_system_data, ) = data; let strategy = strategy.as_ref().map(Deref::deref); prefab_storage.process( |mut d| { d.tag = Some(self.next_tag); self.next_tag += 1; if !d.loading() { if !d .load_sub_assets(&mut prefab_system_data) .chain_err(|| "Failed starting sub asset loading")? { return Ok(ProcessingState::Loaded(d)); } } match d.progress().complete() { Completion::Complete => Ok(ProcessingState::Loaded(d)), Completion::Failed => { error!("Failed loading sub asset: {:?}", d.progress().errors()); Err("Failed loading sub asset")? } Completion::Loading => Ok(ProcessingState::Loading(d)), } }, time.frame_number(), &**pool, strategy, ); prefab_handles .populate_inserted(self.insert_reader.as_mut().unwrap(), &mut self.to_process); self.finished.clear(); for (root_entity, handle, _) in (&*entities, &prefab_handles, &self.to_process).join() { if let Some(prefab) = prefab_storage.get(handle) { self.finished.push(root_entity); // create entities self.entities.clear(); self.entities.push(root_entity); for entity_data in prefab.entities.iter().skip(1) { let new_entity = entities.create(); self.entities.push(new_entity); if let Some(parent) = entity_data.parent { parents .insert( new_entity, Parent { entity: self.entities[parent], }, ).unwrap(); } tags.insert(new_entity, PrefabTag::new(prefab.tag.unwrap())) .unwrap(); } // create components for (index, entity_data) in prefab.entities.iter().enumerate() { if let Some(ref prefab_data) = &entity_data.data { prefab_data .add_to_entity( self.entities[index], &mut prefab_system_data, &self.entities, ).unwrap(); } } } } for entity in &self.finished { self.to_process.remove(entity.id()); } } fn setup(&mut self, res: &mut Resources) { use amethyst_core::specs::prelude::SystemData; Self::SystemData::setup(res); self.insert_reader = Some(WriteStorage::<Handle<Prefab<T>>>::fetch(&res).track_inserted()); } }
33.841379
99
0.481557
2a12b5d6c63c95ec169a271f8f57167667a87d1d
70
html
HTML
examples/browser/index.html
ssbc/ssb-tunnel
184c94b324b3ae6ace35f95d385d711741d7e631
[ "MIT" ]
13
2019-01-29T07:33:57.000Z
2022-03-19T06:01:08.000Z
examples/browser/index.html
dominictarr/ssb-tunnel
184c94b324b3ae6ace35f95d385d711741d7e631
[ "MIT" ]
10
2019-05-14T19:31:34.000Z
2019-12-05T20:13:01.000Z
examples/browser/index.html
dominictarr/ssb-tunnel
184c94b324b3ae6ace35f95d385d711741d7e631
[ "MIT" ]
2
2018-07-17T08:53:37.000Z
2018-07-24T10:59:23.000Z
<html> <script> </script> <script src=./bundle.js></script> </html>
8.75
33
0.614286
0ceb15471ca6941f1a3c2803a1bcd3575ac7f39e
5,306
py
Python
PyPowerStore/utils/helpers.py
dell/python-powerstore
04d6d73e4c926cf0d347cf68b24f8f11ff80f565
[ "Apache-2.0" ]
15
2020-05-06T23:46:44.000Z
2021-12-14T08:04:48.000Z
PyPowerStore/utils/helpers.py
dell/python-powerstore
04d6d73e4c926cf0d347cf68b24f8f11ff80f565
[ "Apache-2.0" ]
2
2020-06-09T15:19:25.000Z
2020-08-18T18:58:59.000Z
PyPowerStore/utils/helpers.py
dell/python-powerstore
04d6d73e4c926cf0d347cf68b24f8f11ff80f565
[ "Apache-2.0" ]
5
2020-05-06T23:46:22.000Z
2021-05-08T03:03:07.000Z
# -*- coding: utf-8 -*- # Copyright: (c) 2019-2021, Dell EMC """Helper module for PowerStore""" import logging from pkg_resources import parse_version provisioning_obj = None def set_provisioning_obj(val): global provisioning_obj provisioning_obj = val def prepare_querystring(*query_arguments, **kw_query_arguments): """Prepare a querystring dict containing all query_arguments and kw_query_arguments passed. :return: Querystring dict. :rtype: dict """ querystring = dict() for argument_dict in query_arguments: if isinstance(argument_dict, dict): querystring.update(argument_dict) querystring.update(kw_query_arguments) return querystring def get_logger(module_name, enable_log=False): """Return a logger with the specified name :param module_name: Name of the module :type module_name: str :param enable_log: (optional) Whether to enable log or not :type enable_log: bool :return: Logger object :rtype: logging.Logger """ LOG = logging.getLogger(module_name) LOG.setLevel(logging.DEBUG) if enable_log: LOG.disabled = False else: LOG.disabled = True return LOG def is_foot_hill_or_higher(): """Return a true if the array version is foot hill or higher. :return: True if foot hill or higher :rtype: bool """ foot_hill_version = '2.0.0.0' array_version = provisioning_obj.get_array_version() if array_version and ( parse_version(array_version) >= parse_version(foot_hill_version)): return True return False def filtered_details(filterable_keys, filter_dict, resource_list, resource_name): """ Get the filtered output. :filterable_keys: Keys on which filters are supported. :type filterable_keys: list :filter_dict: Dict containing the filters, operators and value. :type filter_dict: dict :resource_list: The response of the REST api call on which filter_dict is to be applied. :type resource_list: list :resource_name: Name of the resource :type resource_name: str :return: Dict, containing filtered values. :rtype: dict """ err_msg = "Entered key {0} is not supported for filtering. " \ "For {1}, filters can be applied only on {2}. " response = list() for resource in resource_list: count = 0 for key in filter_dict: # Check if the filters can be applied on the key or not if key not in filterable_keys: raise Exception(err_msg.format( key, resource_name, str(filterable_keys))) count = apply_operators(filter_dict, key, resource, count) if count == len(filter_dict): temp_dict = dict() temp_dict['id'] = resource['id'] # check if resource has 'name' parameter or not. if resource_name not in ["CHAP config", "service config"]: temp_dict['name'] = resource['name'] response.append(temp_dict) return response def apply_operators(filter_dict, key, resource, count): """ Returns the count for the filters applied on the keys """ split_list = filter_dict[key].split(".") if split_list[0] == 'eq' and str(resource[key]) == str(split_list[1]): count += 1 elif split_list[0] == 'neq' and str(resource[key]) != str(split_list[1]): count += 1 elif split_list[0] == 'ilike': if not isinstance(resource[key], str): raise Exception('like can be applied on string type' ' parameters only. Please enter a valid operator' ' and parameter combination') search_val = split_list[1].replace("*", "") value = resource[key] if split_list[1].startswith("*") and \ split_list[1].endswith("*") and \ value.count(search_val) > 0: count += 1 elif split_list[1].startswith("*") and \ value.endswith(search_val): count += 1 elif value.startswith(search_val): count += 1 elif split_list[0] == 'gt': if not isinstance(resource[key], (int, float)): raise Exception('greater can be applied on int type' ' parameters only. Please enter a valid operator' ' and parameter combination') if isinstance(resource[key], int) and\ int(split_list[1]) < resource[key]: count += 1 if isinstance(resource[key], float) and \ float(split_list[1]) < resource[key]: count += 1 elif split_list[0] == 'lt': if not isinstance(resource[key], (int, float)): raise Exception('lesser can be applied on int type' ' parameters only. Please enter a valid operator' ' and parameter combination') if isinstance(resource[key], int) and\ int(split_list[1]) > resource[key]: count += 1 if isinstance(resource[key], float) and \ float(split_list[1]) > resource[key]: count += 1 return count
35.373333
78
0.602714
15b5932cc63989c32839a93b49e61e708d29120f
326
rb
Ruby
app/mailers/spree/abandoned_cart_mailer.rb
reertech/spree_abandoned_carts
3de04f689ede384c09a8e1efb15e0d0dd8cd6be8
[ "BSD-3-Clause" ]
1
2021-11-29T17:07:49.000Z
2021-11-29T17:07:49.000Z
app/mailers/spree/abandoned_cart_mailer.rb
reertech/spree_abandoned_carts
3de04f689ede384c09a8e1efb15e0d0dd8cd6be8
[ "BSD-3-Clause" ]
null
null
null
app/mailers/spree/abandoned_cart_mailer.rb
reertech/spree_abandoned_carts
3de04f689ede384c09a8e1efb15e0d0dd8cd6be8
[ "BSD-3-Clause" ]
1
2020-07-03T03:26:04.000Z
2020-07-03T03:26:04.000Z
module Spree class AbandonedCartMailer < BaseMailer def abandoned_cart_email(order) if order.email.present? @order = order subject = "#{Spree::Store.current.name} - #{Spree.t(:abandoned_cart_subject)}" mail(to: order.email, from: from_address, subject: subject) end end end end
27.166667
86
0.662577
228376cc1453516a3a4eb1c4ee27cfa9aa4d80ae
1,125
html
HTML
layouts/index.html
tsingson/tsinghugo
772d33d9d4f116febceedaf59570b0dba4c5e14a
[ "MIT" ]
null
null
null
layouts/index.html
tsingson/tsinghugo
772d33d9d4f116febceedaf59570b0dba4c5e14a
[ "MIT" ]
null
null
null
layouts/index.html
tsingson/tsinghugo
772d33d9d4f116febceedaf59570b0dba4c5e14a
[ "MIT" ]
null
null
null
{{ define "header" }} {{ partial "site-navbar.html" . }} {{ partial "homepage-header.html" . }} {{ end }} {{ define "main" }} <!-- Main layout --> <div class="container-fluid"> <div class="row"> <!-- Sidebar --> <div class="col-12 col-md-3 col-lg-3 col-xl-2 bg-white"> <!-- <hr> --> {{ partial "sidebar-categories.html" . }} {{ partial "sidebar-tags.html" . }} <!-- {{ partial "sidebar-series.html" . }} --> </div> <!-- /.Sidebar --> <!-- Post list --> <div class="col-12 col-md-9 col-lg-9 col-xl-10 bg-white"> {{ $totalpostscount := len (.Data.Pages) }} {{ $latestpostscount := .Site.Params.latestpostscount | default $totalpostscount }} {{ if gt $latestpostscount 0 }} <div> {{ range (first $latestpostscount .Data.Pages.ByPublishDate.Reverse ) }} {{ partial "post-card.html" . }} {{ end }} </div> {{ end }} </div> <!-- /.Post list --> </div> </div> <!--Main layout--> {{ end }}
31.25
95
0.462222
160da5377f5b352a6f1eecaecb29030c4defff33
1,228
h
C
GeneratedModels/MSGraphConsentRequestFilterByCurrentUserOptions.h
phil1995/msgraph-sdk-objc-models
383c764009fcaf29dfdc07e7feaa59ab67b42876
[ "MIT" ]
11
2019-02-13T08:21:45.000Z
2021-11-14T15:45:25.000Z
GeneratedModels/MSGraphConsentRequestFilterByCurrentUserOptions.h
phil1995/msgraph-sdk-objc-models
383c764009fcaf29dfdc07e7feaa59ab67b42876
[ "MIT" ]
40
2019-09-10T23:25:31.000Z
2021-09-17T19:50:38.000Z
GeneratedModels/MSGraphConsentRequestFilterByCurrentUserOptions.h
phil1995/msgraph-sdk-objc-models
383c764009fcaf29dfdc07e7feaa59ab67b42876
[ "MIT" ]
7
2019-02-13T08:21:46.000Z
2021-10-10T09:41:03.000Z
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. #include <Foundation/Foundation.h> typedef NS_ENUM(NSInteger, MSGraphConsentRequestFilterByCurrentUserOptionsValue){ MSGraphConsentRequestFilterByCurrentUserOptionsReviewer = 0, MSGraphConsentRequestFilterByCurrentUserOptionsUnknownFutureValue = 1, MSGraphConsentRequestFilterByCurrentUserOptionsEndOfEnum }; @interface MSGraphConsentRequestFilterByCurrentUserOptions : NSObject +(MSGraphConsentRequestFilterByCurrentUserOptions*) reviewer; +(MSGraphConsentRequestFilterByCurrentUserOptions*) unknownFutureValue; +(MSGraphConsentRequestFilterByCurrentUserOptions*) UnknownEnumValue; +(MSGraphConsentRequestFilterByCurrentUserOptions*) consentRequestFilterByCurrentUserOptionsWithEnumValue:(MSGraphConsentRequestFilterByCurrentUserOptionsValue)val; -(NSString*) ms_toString; @property (nonatomic, readonly) MSGraphConsentRequestFilterByCurrentUserOptionsValue enumValue; @end @interface NSString (MSGraphConsentRequestFilterByCurrentUserOptions) - (MSGraphConsentRequestFilterByCurrentUserOptions*) toMSGraphConsentRequestFilterByCurrentUserOptions; @end
36.117647
164
0.874593
27cdc09af93db0427eb9d014fdf5ca73d00dcd12
15,097
css
CSS
oort/server/app/static/css/main.css
arcsecond-io/oort
9a0ffe5b45e3fced7e240b25738e6f11e00f6ce7
[ "MIT" ]
2
2020-01-22T20:34:45.000Z
2020-02-04T21:02:14.000Z
oort/server/app/static/css/main.css
arcsecond-io/oort
9a0ffe5b45e3fced7e240b25738e6f11e00f6ce7
[ "MIT" ]
10
2020-04-03T12:27:06.000Z
2022-02-22T08:42:17.000Z
oort/server/app/static/css/main.css
arcsecond-io/oort
9a0ffe5b45e3fced7e240b25738e6f11e00f6ce7
[ "MIT" ]
null
null
null
@font-face { font-family: 'DS-Digital'; src: url('../fonts/DS-DIGI.ttf') format('ttf'); font-weight: normal; font-style: normal; } html { overflow-y: hidden; } .page { margin-top: 40px; height: 100%; } .page-content { height: calc(100% - 40px); } .page-full { height: 100%; overflow: hidden; } .page-scroll { overflow-y: scroll; height: calc(100% - 40px); padding-bottom: 20px; } .full-height { height: 100%; } .full-width { width: 100%; } /*.container-fluid {*/ /* padding-left: 0;*/ /* padding-right: 0;*/ /* margin-left: 0;*/ /* margin-right: 0;*/ /* width: 100%;*/ /*}*/ img { vertical-align: -3px; } .text-aux { color: #AAA; } .text-aux-dark { color: #888; } .text-value { color: #111111; } .text-small { font-size: small; } .btn-primary { border-radius: 2px; border: 1px solid white; background: transparent; color: #4dbce9; font-weight: 700; font-size: 12px; text-transform: none; -webkit-transition: none; -o-transition: none; transition: none; } .btn-primary > span { position: relative; -webkit-transition: none; -o-transition: none; transition: none; } .btn-primary > span:first-child { left: 0; width: 12px; opacity: 1; filter: alpha(opacity=100); } .btn-primary > span:last-child { left: 0; } .btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary:active:focus { border-color: #4dbce9; background: transparent; color: #4dbce9; -webkit-box-shadow: none; box-shadow: none; outline: none; } .btn-primary:hover > span:first-child, .btn-primary:focus > span:first-child, .btn-primary:active > span:first-child, .btn-primary:active:focus > span:first-child { left: 0; opacity: 1; filter: alpha(opacity=100); } .btn-primary:hover > span:last-child, .btn-primary:focus > span:last-child, .btn-primary:active > span:last-child, .btn-primary:active:focus > span:last-child { left: 0; } .btn-default { border-radius: 2px; border: 1px solid lightgray; background: transparent; color: #7d7d7f; font-weight: 700; font-size: 12px; text-transform: none; -webkit-transition: none; -o-transition: none; transition: none; } .btn-default > span { position: relative; -webkit-transition: none; -o-transition: none; transition: none; } .btn-default > span:first-child { left: 0; width: 12px; opacity: 1; filter: alpha(opacity=100); } .btn-default > span:last-child { left: 0; } .btn-default:hover, .btn-default:focus, .btn-default:active, .btn-default:active:focus { border-color: #7d7d7f; background: transparent; color: #7d7d7f; -webkit-box-shadow: none; box-shadow: none; outline: none; } .btn-default:hover > span:first-child, .btn-default:focus > span:first-child, .btn-default:active > span:first-child, .btn-default:active:focus > span:first-child { left: 0; opacity: 1; filter: alpha(opacity=100); } .btn-default:hover > span:last-child, .btn-default:focus > span:last-child, .btn-default:active > span:last-child, .btn-default:active:focus > span:last-child { left: 0; } .btn-primary-black { color: #333333; background-color: transparent; border-color: #333333; } .btn-primary-black:disabled { color: #555555; pointer-events: none; opacity: 0.25; filter: alpha(opacity=25); } .alert { display: block; border-radius: 0; border: 0; font-weight: 500; } .default-blue-color-light { color: #4dbce9; } .default-blue-color-dark { color: #20abe3; } .default-text-color { color: #5c6d8b; } .faq { margin-left: 10%; margin-right: 10%; } .faq .question { padding-top: 30px; font-size: x-large; color: black; } .faq .answer { padding-top: 10px; font-size: large; color: #626262; } /* https://gist.github.com/01-Scripts/3010527 */ .external-link:after, a[target="_blank"]:after { content: "\f08e"; font-family: FontAwesome, sans-serif; font-weight: normal; font-style: normal; display: inline-block; text-decoration: inherit; font-size: 7pt; padding-left: 2px; color: #209fd7; } a[target="_blank"] { color: #209fd7; } /* Strip from links to own domain or with class no_icon */ a.no_icon:after { content: "" !important; padding-left: 0; } a.disabled { pointer-events: none; cursor: default; opacity: 0.6; } .vue-xeditable-value:after { content: "\f044"; font-family: FontAwesome, sans-serif; font-weight: normal; font-style: normal; display: inline-block; text-decoration: inherit; font-size: x-small; padding-left: 5px; color: transparent; } .vue-xeditable-value:hover:after { color: #7d7d7d; } .active .vue-xeditable-value:hover:after { color: white; } .auth-menu-button { background-color: transparent; } .auth-menu-button { background-color: transparent; padding-top: 10px; } .auth-menu-button:hover, .auth-menu-button:focus, .auth-menu-button.focus, .auth-menu-button:active, .auth-menu-button.active, .open > .dropdown-toggle.btn-info { color: #ffffff; background-color: transparent; border-color: #269abc; } .auth-menu-button-white { color: #4b4b4b; } .auth-menu-button-white:hover, .auth-menu-button-white:focus, .auth-menu-button-white.focus, .auth-menu-button-white:active, .auth-menu-button-white.active, .open > .dropdown-toggle.btn-info { color: #4b4b4b; border-color: #4b4b4b; } ul.no_bullet { list-style-type: none; padding: 0; } ul.no_bullet li { padding: 0; margin: 0; } ul.no_bullet.tree { background-color: rgba(220, 230, 242, 0.46); } ul.no_bullet.box { margin: 30px 10px 20px 10px; } ul.no_bullet.box li.custom { padding-left: 40px; padding-top: 3px; } ul.no_bullet li.logo { background: url('../img/logo-circle.png') no-repeat 10px 2px; background-size: 20px; } ul.no_bullet li.stars { background: url('../img/icon-star.png') no-repeat 10px 2px; background-size: 20px; } ul.no_bullet li.std { background: url('../img/icon-standard-star.png') no-repeat 10px 2px; background-size: 20px; } ul.no_bullet li.observatories { background: url('../img/icon-observing-site.png') no-repeat 10px 2px; background-size: 20px; } ul.no_bullet li.telescopes { background: url('../img/icon-telescope.png') no-repeat 10px 2px; background-size: 20px; } ul.no_bullet li.runs { background: url('../img/icon-observing-run.png') no-repeat 10px 2px; background-size: 20px; } ul.no_bullet li.converters { background: url('../img/icon-converter.png') no-repeat 10px 2px; background-size: 20px; } ul.no_bullet li.charts { background: url('../img/icon-charts-sm.png') no-repeat 10px 2px; background-size: 20px; } ul.no_bullet li.logs { background: url('../img/icon-night-log.png') no-repeat 10px 2px; background-size: 20px; } ul.no_bullet li.datasets { background: url('../img/icon-dataset.png') no-repeat 10px 2px; background-size: 20px; } ul.no_bullet li.datafiles { background: url('../img/icon-fits.png') no-repeat 10px 2px; background-size: 20px; } ul.no_bullet li.telegrams { background: url('../img/icon-telegrams.png') no-repeat 10px 2px; background-size: 20px; } ul.no_bullet li.exoplanets { background: url('../img/icon-exoplanet.png') no-repeat 10px 2px; background-size: 20px; } ul.no_bullet li.collaborations { background: url('../img/icon-collaborations.png') no-repeat 10px 2px; background-size: 20px; } ul.no_bullet li.publications { background: url('../img/icon-publication.png') no-repeat 10px 2px; background-size: 20px; } ul.no_bullet li.flake { background: url('../img/icon-flake.png') no-repeat 10px 2px; background-size: 20px; } ul.no_bullet li.asteroids { background: url('../img/icon-asteroid.png') no-repeat 10px 2px; background-size: 20px; } /* multi-pane resizers */ .custom-multipane { width: 100%; } .custom-multipane .pane { padding: 0; } .custom-multipane .resizer { margin: 0; position: relative; z-index: 100; } .custom-multipane > .resizer:before { display: block; content: ""; width: 3px; height: 40px; position: absolute; top: 50%; left: 50%; margin-top: -20px; margin-left: -1.5px; border-left: 1px solid #ccc; border-right: 1px solid #ccc; } .custom-multipane > .resizer:hover, .custom-multipane > .resizer:before { border-color: #999; } .code { /*color: #8cbde8;*/ -webkit-font-smoothing: antialiased; -webkit-user-select: text; box-sizing: border-box; color: rgb(204, 34, 85); cursor: auto; display: inline; font-family: Consolas, monaco, 'Ubuntu Mono', courier, monospace; font-size: medium !important; /* height: auto; */ line-height: 12px; tab-size: 4; text-decoration: none; white-space: normal; /* width: auto; */ word-wrap: break-word; text-shadow: 1px 1px 1px white; } /* ---- row cells ----- */ .row-cell { padding: 2px 10px; } .row-cell .title { font-size: small; color: black; } .row-cell .strong, .row-cell .value { font-weight: bold; } .row-cell .value { margin-left: 10px; } .row-cell .unit { padding-left: 8px; padding-right: 5px; } .row-cell .quality, .row-cell .bibcode { font-size: x-small; } .row-cell .quality .value, .row-cell .label .value { font-weight: bold; } .row-cell .blue { color: #1e93c8; } .row-cell .darkgray { color: #686868; } .row-cell .gray { color: darkgray; } /* ---------------------- TABS ---------------------- */ .tabs-component { margin: 1em 0 0 0; } .tabs-component-tabs { border: solid 1px #ddd; border-radius: 6px; margin-bottom: 5px; } @media (min-width: 700px) { .tabs-component-tabs { border: 0; align-items: stretch; display: flex; justify-content: flex-start; margin-bottom: -1px; } } .tabs-component-tab { color: #999; font-size: 14px; font-weight: 600; margin-right: 0; list-style: none; } .tabs-component-tab:not(:last-child) { border-bottom: dotted 1px #ddd; } .tabs-component-tab:hover { color: #666; } .tabs-component-tab.is-active { color: #000; } .tabs-component-tab.is-disabled * { color: #cdcdcd; cursor: not-allowed !important; } @media (min-width: 700px) { .tabs-component-tab { background-color: #fff; border: solid 1px #ddd; border-radius: 3px 3px 0 0; margin-right: .5em; /*transform: translateY(2px);*/ transition: transform .3s ease; } .tabs-component-tab.is-active { border-bottom: solid 1px #fff; z-index: 2; /*transform: translateY(0);*/ } } .tabs-component-tab-a { align-items: center; color: inherit; display: flex; padding: .5em 1em; text-decoration: none; } .tabs-component-panels { padding: 0; height: 100%; } @media (min-width: 700px) { .tabs-component-panels { background-color: #fff; border: solid 1px #ddd; border-radius: 0 6px 6px 6px; box-shadow: 0 0 10px rgba(0, 0, 0, .05); } } /* ---------------------- Scalendar ---------------------- */ .v-scalendar .v-scalendar-btn.active { color: white; font-weight: bold; } .v-scalendar .v-scalendar-btn:hover { background-color: #f3f3f3; border: 1px solid #f3f3f3; } .v-scalendar .v-scalendar-months .v-scalendar-btn.active { background-color: #555; /*border: 1px solid rgba(66, 128, 192, 0.16);*/ /*color: rgba(83, 163, 244, 0.91);*/ font-weight: bold; color: rgba(247, 247, 247, 0.88); } .v-scalendar .v-scalendar-days .line-weeks .v-scalendar-btn.active { background-color: rgba(66, 128, 192, 0.07); border: 1px solid rgba(66, 128, 192, 0.16); color: rgba(66, 128, 192, 0.82); } .v-scalendar .v-scalendar-days .line-days .v-scalendar-btn.active { background-color: #519cea; border: 1px solid #519cea; } .v-scalendar .line-days .v-scalendar-btn { text-transform: uppercase !important; } .v-scalendar .v-scalendar-days-overlay { margin-top: 65px; width: 100%; height: calc(100% - 65px); } /* -- new objects modal -- */ #new-object { padding: 0 20px; height: 100%; } /*#new-object img {*/ /* vertical-align: -5px;*/ /*}*/ #new-object .tabs-component { height: calc(100% - 110px); } #new-object .tabs-component-panel, #new-object .tab-core { height: 100%; } #new-object .tab-content { padding: 5px 15px; height: 100%; } #new-object .form-group { width: 100%; } #new-object .form-inline .form-control { height: 1.5em; font-size: x-large; width: calc(100% - 110px); } #new-object .form-inline input[type="text"] { height: 1.5em; font-size: x-large; } #new-object .form-group button.btn-primary { width: 80px; margin-left: 5px; } #new-object .result { padding-top: 5px; height: calc(100% - 30px); } #new-object .result.scroll { overflow-y: scroll; height: calc(100% - 50px); } #new-object .help { font-size: smaller; color: darkgray; margin: 10px 2px; } #new-object .coordinates { padding: 15px 0; } #new-object .action-buttons { position: absolute; right: 30px; bottom: 20px; } #new-object .action-buttons > input, #new-object .action-buttons > label, #new-object .action-buttons > button { margin-left: 5px; } /* circles */ .circle-block { text-align: center; vertical-align: middle; } .circle-block .title { text-transform: uppercase; color: #2d2d2d; font-weight: bold; height: 30px; } .circle-block .title h4 img { margin-right: 5px; vertical-align: -2px; } .circle-block .circle { border-radius: 100px; height: 120px; width: 120px; font-weight: bold; display: table; margin: 20px auto; } .circle-block .circle p { vertical-align: middle; display: table-cell; } .circle-block .circle p.extra-large { font-size: 32pt; } .circle-block .compact { color: #b2b2b2; padding: 0 20px 0 20px; } /* subtitle */ div.subtitle, span.subtitle { color: darkgray; font-size: small; text-transform: none; } /* modals */ .modal-container { margin: 0 20px; padding: 30px; } .modal-container .footer { margin: 20px; position: absolute; padding: 0 30px; bottom: 0; } .modal-container .footer.left { left: 0; } .modal-container .footer.right { right: 0; } /* Original Modals */ .modal-header { padding: 15px; border-bottom: 1px solid #e5e5e5; min-height: 16.42857143px; } .modal-header .close { margin-top: -2px; } .modal-title { margin: 0; line-height: 1.42857143; } .modal-body { position: relative; padding: 15px; } .modal-footer { padding: 15px; text-align: right; border-top: 1px solid #e5e5e5; } .modal-footer .btn + .btn { margin-left: 5px; margin-bottom: 0; } .modal-footer .btn-group .btn + .btn { margin-left: -1px; } .modal-footer .btn-block + .btn-block { margin-left: 0; } .modal-scrollbar-measure { position: absolute; top: -9999px; width: 50px; height: 50px; overflow: scroll; } @media (min-width: 768px) { .modal-dialog { width: 600px; margin: 30px auto; } .modal-content { -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); } .modal-sm { width: 300px; } } @media (min-width: 992px) { .modal-lg { width: 900px; } } /* --- slider --- */ .slider >>> .vue-slider-rail .vue-slider-dot-handle { border: 1px solid white !important; }
17.11678
71
0.650394
bee9569e522d5a867b980bb0749d9bc50e0437e9
263
kt
Kotlin
app/src/main/java/com/yogeshpaliyal/keypass/listener/UniversalClickListener.kt
eldad/KeyPass
879a01a3e71069817a79e11015f13ae0d2f6bc33
[ "MIT" ]
88
2021-03-01T13:34:20.000Z
2022-03-30T10:22:02.000Z
app/src/main/java/com/yogeshpaliyal/keypass/listener/UniversalClickListener.kt
eldad/KeyPass
879a01a3e71069817a79e11015f13ae0d2f6bc33
[ "MIT" ]
39
2021-03-02T03:36:10.000Z
2022-03-29T15:02:26.000Z
app/src/main/java/com/yogeshpaliyal/keypass/listener/UniversalClickListener.kt
eldad/KeyPass
879a01a3e71069817a79e11015f13ae0d2f6bc33
[ "MIT" ]
14
2021-07-05T06:59:54.000Z
2022-03-16T09:33:22.000Z
package com.yogeshpaliyal.keypass.listener import android.view.View /* * @author Yogesh Paliyal * techpaliyal@gmail.com * https://techpaliyal.com * created on 31-01-2021 09:00 */ interface UniversalClickListener<T> { fun onItemClick(view: View, model: T) }
18.785714
42
0.749049
d06864a7e5dbcd876088ea5e16c0666638542d78
650
swift
Swift
NewsAppSwiftMVVM/NewsAppSwiftMVVM/EntryViewController.swift
tjnet/NewsAppSwiftMVVM
49420cce245fc6d1755bd0a3e12872981945c14d
[ "MIT" ]
15
2016-06-06T09:35:13.000Z
2021-11-26T21:15:07.000Z
NewsAppSwiftMVVM/NewsAppSwiftMVVM/EntryViewController.swift
masakiki-take/NewsAppSwiftMVVM
49420cce245fc6d1755bd0a3e12872981945c14d
[ "MIT" ]
10
2016-02-29T14:01:51.000Z
2016-09-24T05:19:03.000Z
NewsAppSwiftMVVM/NewsAppSwiftMVVM/EntryViewController.swift
masakiki-take/NewsAppSwiftMVVM
49420cce245fc6d1755bd0a3e12872981945c14d
[ "MIT" ]
3
2016-07-08T04:34:34.000Z
2019-02-05T00:58:36.000Z
// // File.swift // NewsAppSwiftMVVM // // Created by TanakaJun on 2016/09/22. // Copyright © 2016年 edu.self. All rights reserved. // import UIKit class EntryViewController: UIViewController, UIWebViewDelegate { lazy var url: NSURL = NSURL() @IBOutlet weak var contentWeb: UIWebView! override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) contentWeb.delegate = self contentWeb.loadRequest(NSURLRequest(URL: url)) } override func viewDidLoad() { super.viewDidLoad() contentWeb.delegate = self } }
19.69697
64
0.615385
d001592636cd34479d34aee88de56da602db1ba3
41
rb
Ruby
lib/regex_sieve/version.rb
gnilrets/regex_sieve
4d1610a89636f734cb50081dcd5328a31d49256b
[ "MIT" ]
null
null
null
lib/regex_sieve/version.rb
gnilrets/regex_sieve
4d1610a89636f734cb50081dcd5328a31d49256b
[ "MIT" ]
null
null
null
lib/regex_sieve/version.rb
gnilrets/regex_sieve
4d1610a89636f734cb50081dcd5328a31d49256b
[ "MIT" ]
null
null
null
class RegexSieve VERSION = '0.1.0' end
10.25
19
0.682927
2a205fb421a74f835ad463178de2f1da504b4ae9
1,008
html
HTML
es6_aPartOfImpoertantTechnology/destructuringTest.html
hsj-xiaokang/react_study-demo
fbb87ba6c0d363ff94c8d4b2d9ad6f3c56d51505
[ "Apache-2.0" ]
null
null
null
es6_aPartOfImpoertantTechnology/destructuringTest.html
hsj-xiaokang/react_study-demo
fbb87ba6c0d363ff94c8d4b2d9ad6f3c56d51505
[ "Apache-2.0" ]
null
null
null
es6_aPartOfImpoertantTechnology/destructuringTest.html
hsj-xiaokang/react_study-demo
fbb87ba6c0d363ff94c8d4b2d9ad6f3c56d51505
[ "Apache-2.0" ]
null
null
null
<!--destructuring->es6新特性之结构语法 @author heshengjin qq:2356899074--> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>destructuring->es6新特性之结构语法</title> </head> <body> <script type="text/javascript"> //这里win在window上面,下面的<script type="text/javascript">可以拿到 var win = "win"; /** * 一般的玩法 * @type {string} */ let cat = "cat"; let dog = "dog"; let zoom = {cat:cat,dog:dog}; console.log(zoom); /** * es6解构的玩法 * @type {string} */ let name = "name"; let name_hsj = 'name_hsj'; let name_zoom = {name,name_hsj}; console.log(name_zoom); /** * 解构的玩法 * 注意的是:变量的名字一定要一一的对应,不然就会报错! * @type {{s: string, e: string}} */ let destru = {s:"d",e:"e"}; let {s,e} = destru; console.log(s,e); </script> <script type="text/javascript"> //这里拿到win console.log(win); </script> </body> </html>
21.913043
62
0.510913
0241dac1277c9b93cb329a25e5931d78270c35e5
5,487
swift
Swift
Decred Wallet/Features/History/TransactionTableViewCell.swift
itswisdomagain/dcrios
90f3e8594e48b9230500cc18229ceb5283dd534a
[ "ISC" ]
null
null
null
Decred Wallet/Features/History/TransactionTableViewCell.swift
itswisdomagain/dcrios
90f3e8594e48b9230500cc18229ceb5283dd534a
[ "ISC" ]
4
2019-05-23T15:05:21.000Z
2019-09-02T15:27:16.000Z
Decred Wallet/Features/History/TransactionTableViewCell.swift
itswisdomagain/dcrios
90f3e8594e48b9230500cc18229ceb5283dd534a
[ "ISC" ]
null
null
null
// // TransactionTableViewCell.swift // Decred Wallet // // Copyright (c) 2018-2019 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. import Foundation import UIKit class TransactionTableViewCell: BaseTableViewCell { @IBOutlet weak var dataImage: UIImageView! @IBOutlet weak var dataText: UILabel! @IBOutlet weak var status: UILabel! @IBOutlet weak var dateT: UILabel! var count = 0 override func awakeFromNib() {} override class func height() -> CGFloat { return 60 } override func setData(_ data: Any?) { if let transaction = data as? Transaction { let bestBlock = AppDelegate.walletLoader.wallet?.getBestBlock() var confirmations = 0 if(transaction.Height != -1){ confirmations = Int(bestBlock!) - transaction.Height confirmations += 1 } if (transaction.Height == -1) { self.status.textColor = UIColor(hex:"#3d659c") self.status.text = LocalizedStrings.pending } else { if (Settings.spendUnconfirmed || confirmations > 1) { self.status.textColor = UIColor(hex:"#2DD8A3") self.status.text = LocalizedStrings.confirmed } else { self.status.textColor = UIColor(hex:"#3d659c") self.status.text = LocalizedStrings.pending } } let Date2 = NSDate.init(timeIntervalSince1970: TimeInterval(transaction.Timestamp) ) let dateformater = DateFormatter() dateformater.locale = Locale(identifier: "en_US_POSIX") dateformater.dateFormat = "MMM dd, yyyy hh:mma" dateformater.amSymbol = "am" dateformater.pmSymbol = "pm" dateformater.string(from: Date2 as Date) self.dateT.text = dateformater.string(from: Date2 as Date) let amount = Decimal(transaction.Amount / 100000000.00) as NSDecimalNumber let requireConfirmation = Settings.spendUnconfirmed ? 0 : 2 if (transaction.Type.lowercased() == "regular") { if (transaction.Direction == 0) { let attributedString = NSMutableAttributedString(string: "-") attributedString.append(Utils.getAttributedString(str: amount.round(8).description, siz: 13.0, TexthexColor: GlobalConstants.Colors.TextAmount)) self.dataText.attributedText = attributedString self.dataImage?.image = UIImage(named: "debit") } else if(transaction.Direction == 1) { let attributedString = NSMutableAttributedString(string: " ") attributedString.append(Utils.getAttributedString(str: amount.round(8).description, siz: 13.0, TexthexColor: GlobalConstants.Colors.TextAmount)) self.dataText.attributedText = attributedString self.dataImage?.image = UIImage(named: "credit") } else if(transaction.Direction == 2) { let attributedString = NSMutableAttributedString(string: " ") attributedString.append(Utils.getAttributedString(str: amount.round(8).description, siz: 13.0, TexthexColor: GlobalConstants.Colors.TextAmount)) self.dataText.attributedText = attributedString self.dataImage?.image = UIImage(named: "account") } } else if(transaction.Type.lowercased() == "vote") { self.dataText.text = " \(LocalizedStrings.vote)" self.dataImage?.image = UIImage(named: "vote") } else if (transaction.Type.lowercased() == "ticket_purchase") { self.dataText.text = " \(LocalizedStrings.ticket)" self.dataImage?.image = UIImage(named: "immature") if (confirmations < requireConfirmation){ self.status.textColor = UIColor(hex:"#3d659c") self.status.text = LocalizedStrings.pending } else if (confirmations > BuildConfig.TicketMaturity) { let statusText = LocalizedStrings.confirmedLive let range = (statusText as NSString).range(of: "/") let attributedString = NSMutableAttributedString(string: statusText) attributedString.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.black , range: range) self.status.textColor = UIColor(hex:"#2DD8A3") self.status.attributedText = attributedString self.dataImage?.image = UIImage(named: "live") } else { let statusText = LocalizedStrings.confirmedImmature let range = (statusText as NSString).range(of: "/") let attributedString = NSMutableAttributedString(string: statusText) attributedString.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.black , range: range) self.status.textColor = UIColor.orange self.status.attributedText = attributedString self.dataImage?.image = UIImage(named: "immature") } } } } }
49.881818
164
0.58994
e2dd31a9057c081b1587baf21e3fb82d03abb12e
709
lua
Lua
lfframework/framework/env/convert/from_human.lua
ddouglascarr/rooset
f127cf32f560d1e31e8eaa7f712a119255fa6f8a
[ "MIT" ]
3
2017-02-06T00:44:45.000Z
2020-01-12T02:58:08.000Z
lfframework/framework/env/convert/from_human.lua
ddouglascarr/rooset
f127cf32f560d1e31e8eaa7f712a119255fa6f8a
[ "MIT" ]
37
2017-01-26T09:28:05.000Z
2022-02-26T22:19:48.000Z
lfframework/framework/env/convert/from_human.lua
ddouglascarr/rooset
f127cf32f560d1e31e8eaa7f712a119255fa6f8a
[ "MIT" ]
null
null
null
function convert.from_human(str, typ) if not typ then error("Using convert.from_human(...) to convert a human readable string to an internal data type needs a type to be specified as second parameter.") end if not str then return nil end -- TODO: decide, if an error should be raised instead local type_symbol = convert._type_symbol_mappings[typ] if not type_symbol then error("Unrecognized type reference passed to convert.from_human(...).") end local converter = convert["_from_human_to_" .. type_symbol] if not converter then error("Type reference passed to convert.from_human(...) was recognized, but the converter function is not existent.") end return converter(str) end
47.266667
152
0.750353
cb9ce067d81bf6c8c99fc622bada4bee0058280a
820
swift
Swift
Sources/AuthUser/AuthUserSupporting.swift
m-housh/auth-user
c5224a632c2a13df0a0d289302aca20077e8a295
[ "MIT" ]
null
null
null
Sources/AuthUser/AuthUserSupporting.swift
m-housh/auth-user
c5224a632c2a13df0a0d289302aca20077e8a295
[ "MIT" ]
null
null
null
Sources/AuthUser/AuthUserSupporting.swift
m-housh/auth-user
c5224a632c2a13df0a0d289302aca20077e8a295
[ "MIT" ]
null
null
null
// // AuthUserSupporting.swift // AuthUser // // Created by Michael Housh on 8/10/18. // import Vapor import Authentication import Fluent public protocol AuthUserSupporting: Model, Parameter, Content, PasswordAuthenticatable, SessionAuthenticatable { var id: UUID? { get set } var username: String { get set } var password: String { get set } static func hashPassword(_ password: String) throws -> String } extension AuthUserSupporting { /// See `PasswordAuthenticatable` public static var usernameKey: UsernameKey { return \.username } public static var passwordKey: PasswordKey { return \.password } /// See `AuthUserSupporting` public static func hashPassword(_ password: String) throws -> String { return try BCrypt.hash(password) } }
24.117647
112
0.692683
99446ca746ba9a2679d9507530c33a5ecc3a2c98
5,827
h
C
platform/mcu/haas1000/drivers/services/bt_if_enhanced/inc/avdtp_api.h
wanguojian/AliOS-Things
47fce29d4dd39d124f0bfead27998ad7beea8441
[ "Apache-2.0" ]
1
2021-04-09T03:18:41.000Z
2021-04-09T03:18:41.000Z
platform/mcu/haas1000/drivers/services/bt_if_enhanced/inc/avdtp_api.h
wanguojian/AliOS-Things
47fce29d4dd39d124f0bfead27998ad7beea8441
[ "Apache-2.0" ]
null
null
null
platform/mcu/haas1000/drivers/services/bt_if_enhanced/inc/avdtp_api.h
wanguojian/AliOS-Things
47fce29d4dd39d124f0bfead27998ad7beea8441
[ "Apache-2.0" ]
1
2021-06-20T06:43:12.000Z
2021-06-20T06:43:12.000Z
/* * Copyright (C) 2015-2020 Alibaba Group Holding Limited */ #ifndef _AVDTP_API_H #define _AVDTP_API_H #include "stdint.h" #include "bluetooth.h" /* Signal Commands */ #define BTIF_AVDTP_SIG_DISCOVER 0x01 #define BTIF_AVDTP_SIG_GET_CAPABILITIES 0x02 #define BTIF_AVDTP_SIG_SET_CONFIG 0x03 #define BTIF_AVDTP_SIG_GET_CONFIG 0x04 #define BTIF_AVDTP_SIG_RECONFIG 0x05 #define BTIF_AVDTP_SIG_OPEN 0x06 #define BTIF_AVDTP_SIG_START 0x07 #define BTIF_AVDTP_SIG_CLOSE 0x08 #define BTIF_AVDTP_SIG_SUSPEND 0x09 #define BTIF_AVDTP_SIG_ABORT 0x0A #define BTIF_AVDTP_SIG_SECURITY_CTRL 0x0B #define BTIF_AVDTP_SIG_GET_ALL_CAPABILITIES 0x0C #define BTIF_AVDTP_SIG_DELAYREPORT 0x0D #ifndef avdtp_codec_t #define avdtp_codec_t void #endif #ifndef avdtp_channel_t #define avdtp_channel_t void #endif typedef uint8_t btif_avdtp_codec_type_t; typedef uint16_t btif_avdtp_content_prot_type_t; typedef uint8_t btif_avdtp_capability_type_t; #define BTIF_AVDTP_CP_TYPE_DTCP 0x0001 #define BTIF_AVDTP_CP_TYPE_SCMS_T 0x0002 #define BTIF_AVDTP_SRV_CAT_MEDIA_TRANSPORT 0x01 #define BTIF_AVDTP_SRV_CAT_REPORTING 0x02 #define BTIF_AVDTP_SRV_CAT_RECOVERY 0x03 #define BTIF_AVDTP_SRV_CAT_CONTENT_PROTECTION 0x04 #define BTIF_AVDTP_SRV_CAT_HEADER_COMPRESSION 0x05 #define BTIF_AVDTP_SRV_CAT_MULTIPLEXING 0x06 #define BTIF_AVDTP_SRV_CAT_MEDIA_CODEC 0x07 #define BTIF_AVDTP_SRV_CAT_DELAY_REPORTING 0x08 typedef uint16_t btif_avdtp_codec_sample_rate_t; #define BTIF_AVDTP_CODEC_TYPE_SBC 0x00 #define BTIF_AVDTP_CODEC_TYPE_MPEG1_2_AUDIO 0x01 #define BTIF_AVDTP_CODEC_TYPE_MPEG2_4_AAC 0x02 #define BTIF_AVDTP_CODEC_TYPE_ATRAC 0x04 #define BTIF_AVDTP_CODEC_TYPE_OPUS 0x08 #define BTIF_AVDTP_CODEC_TYPE_H263 0x01 #define BTIF_AVDTP_CODEC_TYPE_MPEG4_VSP 0x02 #define BTIF_AVDTP_CODEC_TYPE_H263_PROF3 0x03 #define BTIF_AVDTP_CODEC_TYPE_H263_PROF8 0x04 #define BTIF_AVDTP_CODEC_TYPE_LHDC 0xFF #define BTIF_AVDTP_CODEC_TYPE_NON_A2DP 0xFF #define BTIF_AVDTP_MAX_CODEC_ELEM_SIZE 10 #define BTIF_AVDTP_MAX_CP_VALUE_SIZE 10 typedef uint8_t btif_avdtp_stream_state_t; /** The stream is idle and not configured. Streaming is not possible. */ #define BTIF_AVDTP_STRM_STATE_IDLE 0 /** A stream is configured, but not open. This state will only occur in * certain cases where a request to open the stream is rejected, and the * operation cannot be aborted. * * AVDTP_AbortStream() must be called to exit this state. */ #define BTIF_AVDTP_STRM_STATE_CONFIGURED 1 /** The stream is open and configured. Streaming can be initiated after the * stream is open by calling AVDTP_StartStream(). */ #define BTIF_AVDTP_STRM_STATE_OPEN 2 /** The stream is active. Stream data (media packets) can be sent only in * this state. */ #define BTIF_AVDTP_STRM_STATE_STREAMING 3 #define BTIF_AVDTP_STRM_STATE_CLOSING 4 #define BTIF_AVDTP_STRM_STATE_ABORTING 5 typedef U8 btif_avdtp_error_t; #define BTIF_AVDTP_ERR_NO_ERROR 0x00 #define BTIF_AVDTP_ERR_BAD_HEADER_FORMAT 0x01 #define BTIF_AVDTP_ERR_BAD_LENGTH 0x11 #define BTIF_AVDTP_ERR_BAD_ACP_SEID 0x12 #define BTIF_AVDTP_ERR_IN_USE 0x13 #define BTIF_AVDTP_ERR_NOT_IN_USE 0x14 #define BTIF_AVDTP_ERR_BAD_SERV_CATEGORY 0x17 #define BTIF_AVDTP_ERR_BAD_PAYLOAD_FORMAT 0x18 #define BTIF_AVDTP_ERR_NOT_SUPPORTED_COMMAND 0x19 #define BTIF_AVDTP_ERR_INVALID_CAPABILITIES 0x1A #define BTIF_AVDTP_ERR_BAD_RECOVERY_TYPE 0x22 #define BTIF_AVDTP_ERR_BAD_MEDIA_TRANSPORT_FORMAT 0x23 #define BTIF_AVDTP_ERR_BAD_RECOVERY_FORMAT 0x25 #define BTIF_AVDTP_ERR_BAD_ROHC_FORMAT 0x26 #define BTIF_AVDTP_ERR_BAD_CP_FORMAT 0x27 #define BTIF_AVDTP_ERR_BAD_MULTIPLEXING_FORMAT 0x28 #define BTIF_AVDTP_ERR_UNSUPPORTED_CONFIGURATION 0x29 #define BTIF_AVDTP_ERR_BAD_STATE 0x31 #define BTIF_AVDTP_ERR_NOT_SUPPORTED_CODEC_TYPE 0xC2 #define BTIF_AVDTP_ERR_UNKNOWN_ERROR 0xFF typedef struct { btif_avdtp_content_prot_type_t cpType; uint8_t dataLen; uint8_t *data; }__attribute__((packed)) btif_avdtp_content_prot_t; typedef struct { btif_avdtp_codec_type_t codecType; uint8_t elemLen; uint8_t *elements; uint8_t *pstreamflags; bool discoverable; }__attribute__((packed)) btif_avdtp_codec_t ; typedef struct { btif_avdtp_capability_type_t type; union { btif_avdtp_codec_t codec; btif_avdtp_content_prot_t cp; } p; } btif_avdtp_capability_t; typedef struct { btif_avdtp_codec_t codec; btif_avdtp_content_prot_t cp; BOOL delayReporting; } btif_avdtp_config_request_t; typedef uint8_t btif_avdtp_streamId_t; typedef uint8_t btif_avdtp_media_type; typedef uint8_t btif_avdtp_strm_endpoint_type_t; typedef struct { btif_avdtp_streamId_t id; bool inUse; btif_avdtp_media_type mediaType; btif_avdtp_strm_endpoint_type_t streamType; } btif_avdtp_stream_info_t; typedef struct { U8 version; U8 padding; U8 marker; U8 payloadType; U16 sequenceNumber; U32 timestamp; U32 ssrc; U8 csrcCount; U32 csrcList[15]; } btif_avdtp_media_header_t; typedef btif_avdtp_media_header_t btif_media_header_t; typedef void btif_avdtp_stream_t; #ifdef __cplusplus extern "C" { #endif btif_avdtp_codec_type_t btif_avdtp_get_stream_codec_type(btif_avdtp_stream_t * stream); #ifdef __cplusplus } #endif /* */ #endif /* */
27.485849
91
0.747211
d5ca7b46b02223ed21d65698a349ee3bee2e465b
170
h
C
examples/KPRCA_00003/src/dct.h
li-xin-yi/cgc-cbs
eda14dc564ab0e57b44dfcd38a77d95086fee96f
[ "MIT" ]
5
2019-06-11T13:06:42.000Z
2022-02-21T15:37:22.000Z
examples/KPRCA_00003/src/dct.h
li-xin-yi/cgc-cbs
eda14dc564ab0e57b44dfcd38a77d95086fee96f
[ "MIT" ]
1
2021-11-20T03:46:09.000Z
2021-11-22T16:42:52.000Z
examples/KPRCA_00003/src/dct.h
li-xin-yi/cgc-cbs
eda14dc564ab0e57b44dfcd38a77d95086fee96f
[ "MIT" ]
2
2020-11-06T23:16:00.000Z
2022-02-20T01:12:40.000Z
#include <stdint.h> void dct(const int8_t input[], int16_t output[], const uint8_t scaler[]); void idct(const int16_t input[], int8_t output[], const uint8_t scaler[]);
34
74
0.723529
7a350c07bb9816c4298cb5f44322428a0ae8094e
392
rb
Ruby
app/models/category.rb
jaspreet-singh-sahota/dev-blog
a16acd6c9689ff47e1aefeff94ff8cd623a6cd02
[ "MIT" ]
9
2020-06-18T17:56:42.000Z
2020-11-20T04:59:16.000Z
app/models/category.rb
jaspreet-singh-sahota/dev-blog
a16acd6c9689ff47e1aefeff94ff8cd623a6cd02
[ "MIT" ]
8
2021-03-10T22:09:49.000Z
2022-03-31T01:28:38.000Z
app/models/category.rb
jaspreet-singh-sahota/dev-blog
a16acd6c9689ff47e1aefeff94ff8cd623a6cd02
[ "MIT" ]
1
2020-11-04T03:19:10.000Z
2020-11-04T03:19:10.000Z
class Category < ApplicationRecord has_many :article_categories has_many :articles, through: :article_categories has_many :ordered_by_most_recent, -> { order(created_at: :desc).includes(:votes) }, through: :article_categories, source: :article validates :name, presence: true, uniqueness: true, length: { minimum: 2, maximum: 25 } end
39.2
85
0.668367
a837de479e223b3cd4a565b33677bec9026cbf36
787
rs
Rust
src/utils.rs
zutils/create-protocols-plugin
048f49bd9651750a5139054debbf68a98aa029d9
[ "Apache-2.0", "MIT" ]
null
null
null
src/utils.rs
zutils/create-protocols-plugin
048f49bd9651750a5139054debbf68a98aa029d9
[ "Apache-2.0", "MIT" ]
null
null
null
src/utils.rs
zutils/create-protocols-plugin
048f49bd9651750a5139054debbf68a98aa029d9
[ "Apache-2.0", "MIT" ]
null
null
null
extern crate failure; use std::path::PathBuf; use failure::Error; pub fn sleep_ms(ms: u64) { use std::{thread, time}; let time = time::Duration::from_millis(ms); thread::sleep(time); } pub fn append_to_file(new_file: &PathBuf, contents: &str) -> Result<(), Error> { use std::fs::OpenOptions; use std::io::Write; let mut file = OpenOptions::new() .write(true) .append(true) .open(new_file)?; println!("Writing to: {:?}", new_file); file.write_all(contents.as_bytes())?; Ok(()) } pub fn uppercase_first_letter(s: &str) -> String { let mut c = s.chars(); match c.next() { None => String::new(), Some(f) => f.to_uppercase().collect::<String>() + c.as_str(), } }
24.59375
80
0.559085
2ebd57a2a7742a62edd98aaad9ebdb092b7f1ee1
34
lua
Lua
openresty/lua/hello.lua
zhixin9001/2021_Nginx
ac033a005b4786c6bb34cd4dae14dfad798c131f
[ "Apache-2.0" ]
null
null
null
openresty/lua/hello.lua
zhixin9001/2021_Nginx
ac033a005b4786c6bb34cd4dae14dfad798c131f
[ "Apache-2.0" ]
null
null
null
openresty/lua/hello.lua
zhixin9001/2021_Nginx
ac033a005b4786c6bb34cd4dae14dfad798c131f
[ "Apache-2.0" ]
null
null
null
ngx.say("<p>Hello, ngx_lua1!</p>")
34
34
0.617647
c8ed539ddfb498c54fd97ce7184fadaf1afcf08c
469
asm
Assembly
mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/bright.asm
gb-archive/really-old-stuff
ffb39a518cad47e23353b3420b88e2f3521fd3d7
[ "Apache-2.0" ]
10
2016-10-27T20:46:02.000Z
2021-11-01T15:49:13.000Z
mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/bright.asm
gb-archive/really-old-stuff
ffb39a518cad47e23353b3420b88e2f3521fd3d7
[ "Apache-2.0" ]
null
null
null
mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/bright.asm
gb-archive/really-old-stuff
ffb39a518cad47e23353b3420b88e2f3521fd3d7
[ "Apache-2.0" ]
2
2015-03-11T14:28:08.000Z
2017-11-02T10:57:57.000Z
; Sets bright flag in ATTR_P permanently ; Parameter: Paper color in A register #include once <const.asm> BRIGHT: ld de, ATTR_P __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE and 1 ; # Convert to 0/1 rrca rrca ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value or b ld (de), a ret ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT
16.75
73
0.716418