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
sequencelengths
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
sequencelengths
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
sequencelengths
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
be538ac3e7f28199476c1049edf9fc29cd742244
648
ps1
PowerShell
Powershell/Windows/DeleteOSTFileForAllUsers.ps1
kimmelsg/scripts
15e8fe9e5f602488addeb77b0198fe57b97a2417
[ "MIT" ]
6
2019-09-20T03:17:01.000Z
2021-01-10T12:52:02.000Z
Powershell/Windows/DeleteOSTFileForAllUsers.ps1
kimmelsg/scripts
15e8fe9e5f602488addeb77b0198fe57b97a2417
[ "MIT" ]
null
null
null
Powershell/Windows/DeleteOSTFileForAllUsers.ps1
kimmelsg/scripts
15e8fe9e5f602488addeb77b0198fe57b97a2417
[ "MIT" ]
5
2020-01-05T02:11:16.000Z
2022-02-24T20:21:28.000Z
$Users = Get-ChildItem 'C:\Users' | Where-Object { $_.Name -notlike "Administrator" -and $_.Name -ne "Public" -and $_.Name -ne "Default"} Foreach ($User in $Users) { $Folder = "C:\users\" + $User + "\AppData\Local\Microsoft\Outlook" $Folderpath = Test-Path -Path $Folder if ($FolderPath) { Get-ChildItem $Folder -Filter *.ost | Where-Object { ($_.LastWriteTime -gt (Get-Date).AddDays(-14)) -and ($_.Length /1GB -gt 1) } | Remove-Item -ErrorAction SilentlyContinue Write-Output "Deleted OST file for $user" } else { Write-Output "OST file doesn't exist or meet deletion criteria for $user" } }
36
181
0.634259
0a4226a3e3773ff26e1751a73ac6ca080cb32209
2,008
cs
C#
Core/Program.cs
ThxSkeleton/Uriel
511609c9f31d894b8ec67299ea2a249c9fe8b134
[ "MIT" ]
null
null
null
Core/Program.cs
ThxSkeleton/Uriel
511609c9f31d894b8ec67299ea2a249c9fe8b134
[ "MIT" ]
2
2018-11-22T05:49:25.000Z
2018-11-25T02:32:47.000Z
Core/Program.cs
ThxSkeleton/Uriel
511609c9f31d894b8ec67299ea2a249c9fe8b134
[ "MIT" ]
null
null
null
using System; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Windows.Forms; using Khronos; using Uriel.DataTypes; namespace Uriel { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { UrielConfiguration editorMode = new UrielConfiguration() { ViewPortLength = 900, ViewPortHeight = 900, LockSize = true, LoggingEnabled = true, WorkflowMode = UrielWorkflowMode.EditorMode, WatchDirectory = new List<string>() { @"Z:\ShaderStore\", (Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName) + "\\ExampleShaders" } }; UrielConfiguration movieMode = new UrielConfiguration() { ViewPortLength = 900, ViewPortHeight = 900, LockSize = true, LoggingEnabled = true, WorkflowMode = UrielWorkflowMode.MovieMode, MovieModeShaderFileName = @"Z:\Uriel\Core\bin\Debug\ExampleShaders\TexTest.glsl", WatchDirectory = new List<string>() }; //UrielConfiguration config = editorMode; UrielConfiguration config = movieMode; StaticLogger.Create(config.LoggingEnabled); StaticLogger.Logger.Info("Starting Uriel Main"); StaticLogger.Logger.InfoFormat("Uriel Config: {0}", config.ToString()); KhronosApi.Log += delegate(object sender, KhronosLogEventArgs e) { StaticLogger.Logger.Info(e.ToString()); }; KhronosApi.LogEnabled = false; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new UrielForm(config)); } } }
32.387097
170
0.576693
e02bab88e4fc278917b2b3da80a2d4543f475093
39,833
c
C
src/parser.c
coderstephen/walrus
ea2309c7ebcec513ffbad42ea6b7599e81dddf11
[ "MIT" ]
3
2016-12-07T12:42:11.000Z
2021-06-03T07:16:32.000Z
src/parser.c
coderstephen/walrus
ea2309c7ebcec513ffbad42ea6b7599e81dddf11
[ "MIT" ]
null
null
null
src/parser.c
coderstephen/walrus
ea2309c7ebcec513ffbad42ea6b7599e81dddf11
[ "MIT" ]
1
2016-12-07T12:42:14.000Z
2016-12-07T12:42:14.000Z
#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "ast.h" #include "error.h" #include "lexer.h" #include "parser.h" #include "symbol_table.h" /** * Parses the tokens yielded by a given lexer. */ ASTNode* parser_parse(Lexer* lexer) { // the source file should contain a single program (duh!) ASTDecl* node; if (parser_parse_program(lexer, &node) != E_SUCCESS) { error(E_PARSE_ERROR, "Failed to parse file \"%s\".", lexer->context->file); } return (ASTNode*)node; } /** * Displays a parser error at the current token. */ Error parser_error(Lexer* lexer, char* message) { // get the current token Token token = lexer->current_node->token; // advance to the end of the statement while (token.type != T_STATEMENT_END && token.type != T_EOF) { token = lexer_next(lexer); } // display the error message return error( E_PARSE_ERROR, "in file \"%s\" near line %d, column %d:\n\t%s", token.file, token.line, token.column, message ); } /** * Tries to parse a numerical string and returns its value. */ long parser_str_to_long(char* string) { return strtol(string, NULL, 0); } /** * Creates a copy of a string with single and double quotes stripped from the * ends of the string. */ char* parser_strip_quotes(const char* string) { size_t new_length = strlen(string) - 2; char* new_string = malloc(sizeof(char) * (new_length + 1)); strncpy(new_string, string + 1, new_length); new_string[new_length] = 0; return new_string; } /** * Checks if a token is a binary operator. */ static inline bool token_is_bin_op(Token token) { return token.type == T_DIVIDE || token.type == T_IS_EQUAL || token.type == T_IS_GREATER || token.type == T_IS_GREATER_OR_EQUAL || token.type == T_IS_LESSER || token.type == T_IS_LESSER_OR_EQUAL || token.type == T_IS_NOT_EQUAL || token.type == T_LOGICAL_AND || token.type == T_LOGICAL_OR || token.type == T_MINUS || token.type == T_MODULO || token.type == T_MULTIPLY || token.type == T_PLUS; } /** * <program> -> class Program { <field_decl_list> <method_decl_list> } */ Error parser_parse_program(Lexer* lexer, ASTDecl** node) { *node = ast_create_node(AST_CLASS_DECL, lexer->context->file); (*node)->identifier = "Program"; Token token = lexer_next(lexer); if (token.type != T_CLASS) { return parser_error(lexer, "A program starts with 'class', you fool."); } // set line and column ((ASTNode*)*node)->line = token.line; ((ASTNode*)*node)->column = token.column; token = lexer_next(lexer); if (token.type != T_IDENTIFIER || strcmp(token.lexeme, "Program") != 0) { return parser_error(lexer, "Expecting 'Program'."); } token = lexer_next(lexer); if (token.type != T_BRACE_LEFT) { return parser_error(lexer, "Missing opening curly brace for class 'Program'."); } // both can be empty, so no errors unique to here parser_parse_field_decl_list(lexer, *node); parser_parse_method_decl_list(lexer, *node); token = lexer_next(lexer); if (token.type != T_BRACE_RIGHT) { return parser_error(lexer, "Missing closing curly brace for class 'Program'."); } if (lexer_next(lexer).type != T_EOF) { return parser_error(lexer, "Expected end of file."); } return E_SUCCESS; } /** * <field_decl_list> -> <field_decl> <field_decl_list> | EPSILON */ Error parser_parse_field_decl_list(Lexer* lexer, ASTDecl* program) { // do a lookahead Token token = lexer_lookahead(lexer, 1); // try to parse a field decl? if (token.type == T_BOOLEAN || token.type == T_INT) { // might be a field decl, do a further lookahead token = lexer_lookahead(lexer, 3); // start parsing fields if (token.type != T_PAREN_LEFT) { if (parser_parse_field_decl(lexer, program) != E_SUCCESS) { return E_PARSE_ERROR; } // if that worked, we must have a field_decl_list next return parser_parse_field_decl_list(lexer, program); } } // empty string works return E_SUCCESS; } /** * <method_decl_list> -> <method_decl> <method_decl_list> | EPSILON */ Error parser_parse_method_decl_list(Lexer* lexer, ASTDecl* program) { Token first_token = lexer_lookahead(lexer, 1); // epsilon if (first_token.type == T_BRACE_RIGHT) { return E_SUCCESS; } // try to parse a method decl ASTDecl* method_decl; if (parser_parse_method_decl(lexer, &method_decl) != E_SUCCESS) { return E_PARSE_ERROR; } else { ast_add_child(program, method_decl); } // if that worked, we must have a method_decl_list return parser_parse_method_decl_list(lexer, program); } /** * <field_decl> -> <type> <field_id_list> */ Error parser_parse_field_decl(Lexer* lexer, ASTDecl* program) { // determine the type of the fields listed here DataType type; if (parser_parse_type(lexer, &type) != E_SUCCESS) { return E_PARSE_ERROR; } // parse each field identifier using the given type return parser_parse_field_id_list(lexer, type, program); } /** * <field_id_list> -> <id> <array_dim_decl> <field_id_list_tail> */ Error parser_parse_field_id_list(Lexer* lexer, DataType type, ASTDecl* program) { ASTDecl* node = ast_create_node(AST_FIELD_DECL, lexer->context->file); ((ASTNode*)node)->type = type; // set line and column Token next_token = lexer_lookahead(lexer, 1); ((ASTNode*)node)->line = next_token.line; ((ASTNode*)node)->column = next_token.column; if (parser_parse_id(lexer, &node->identifier) != E_SUCCESS) { return parser_error(lexer, "Expected field name."); } // here check if is an array and set a flag if it is if (lexer_lookahead(lexer, 1).type == T_BRACKET_LEFT) { node->flags = SYMBOL_ARRAY; } if (parser_parse_array_dim_decl(lexer, &node->length) != E_SUCCESS) { return E_PARSE_ERROR; } if (parser_parse_field_id_list_tail(lexer, type, program) != E_SUCCESS) { return E_PARSE_ERROR; } ast_add_child(program, node); return E_SUCCESS; } /** * <array_dim_decl> -> [ <int_literal> ] | EPSILON */ Error parser_parse_array_dim_decl(Lexer* lexer, int* length) { Token token = lexer_lookahead(lexer, 1); if (token.type == T_BRACKET_LEFT) { lexer_next(lexer); ASTNode* int_literal; if (parser_parse_int_literal(lexer, &int_literal) != E_SUCCESS) { return parser_error(lexer, "Expected array length."); } // fetch the int value as the length *length = *(int*)(int_literal->value); token = lexer_next(lexer); if (token.type != T_BRACKET_RIGHT) { return parser_error(lexer, "Missing closing bracket in array declaration."); } } // empty string works return E_SUCCESS; } /** * <field_id_list_tail> -> , <field_id_list> | ; */ Error parser_parse_field_id_list_tail(Lexer* lexer, DataType type, ASTDecl* program) { Token token = lexer_next(lexer); if (token.type == T_COMMA) { //first derivation if (parser_parse_field_id_list(lexer, type, program) != E_SUCCESS) { return parser_error(lexer, "Expected field id list."); } } else if (token.type != T_STATEMENT_END) { return parser_error(lexer, "Missing semicolon ';' or comma ',' after field declaration."); } return E_SUCCESS; } /** * <method_decl> -> <type> <id> ( <method_param_decl_list> ) <block> | void <id> ( <method_param_decl_list> ) <block> */ Error parser_parse_method_decl(Lexer* lexer, ASTDecl** node) { *node = ast_create_node(AST_METHOD_DECL, lexer->context->file); ((ASTNode*)*node)->type = TYPE_VOID; (*node)->flags = SYMBOL_FUNCTION; // set line and column Token next_token = lexer_lookahead(lexer, 1); ((ASTNode*)*node)->line = next_token.line; ((ASTNode*)*node)->column = next_token.column; // can start with <type> or void if (next_token.type == T_VOID) { lexer_next(lexer); } else if (parser_parse_type(lexer, &((ASTNode*)*node)->type) != E_SUCCESS) { return parser_error(lexer, "Expected type name or void."); } // must have an identifier next if (parser_parse_id(lexer, &((ASTDecl*)*node)->identifier) != E_SUCCESS) { return parser_error(lexer, "Expected identifier."); } // left paren next ... if (lexer_next(lexer).type != T_PAREN_LEFT) { return parser_error(lexer, "Expected left parentheses when parsing method_decl and did not get one."); } // ... then the params ... if (parser_parse_method_param_decl_list(lexer, *node) != E_SUCCESS) { return parser_error(lexer, "Expected method argument list."); } // ... right paren next ... if (lexer_next(lexer).type != T_PAREN_RIGHT) { return parser_error(lexer, "Expected right parentheses when parsing method_decl and did not get one."); } // ... then finally a block ASTNode* block; if (parser_parse_block(lexer, &block) != E_SUCCESS) { return E_PARSE_ERROR; } else { ast_add_child(*node, block); } // we made it! return E_SUCCESS; } /** * <method_param_decl_list> -> <method_param_decl> <method_param_decl_list_tail> | EPSILON */ Error parser_parse_method_param_decl_list(Lexer* lexer, ASTDecl* method) { // epsilon if (lexer_lookahead(lexer, 1).type == T_PAREN_RIGHT) { return E_SUCCESS; } ASTDecl* param; if (parser_parse_method_param_decl(lexer, &param) != E_SUCCESS) { return parser_error(lexer, "Expected parameter declaration."); } else { ast_add_child(method, param); } if (parser_parse_method_param_decl_list_tail(lexer, method) != E_SUCCESS) { parser_error(lexer, "Expected parameter list tail."); } return E_SUCCESS; } /** * <method_param_decl_list_tail> -> , <method_param_decl> <method_param_decl_list_tail> | EPSILON */ Error parser_parse_method_param_decl_list_tail(Lexer* lexer, ASTDecl* method) { // first derivation if (lexer_lookahead(lexer, 1).type == T_COMMA) { lexer_next(lexer); ASTDecl* param; if (parser_parse_method_param_decl(lexer, &param) != E_SUCCESS) { return parser_error(lexer, "Expected method parameter declaration."); } else { ast_add_child(method, param); } if (parser_parse_method_param_decl_list_tail(lexer, method) != E_SUCCESS) { return parser_error(lexer, "Expected parameter list tail."); } } // epsilon return E_SUCCESS; } /** * <method_param_decl> -> <type> <id> */ Error parser_parse_method_param_decl(Lexer* lexer, ASTDecl** node) { *node = ast_create_node(AST_PARAM_DECL, lexer->context->file); // set line and column Token next_token = lexer_lookahead(lexer, 1); ((ASTNode*)*node)->line = next_token.line; ((ASTNode*)*node)->column = next_token.column; if (parser_parse_type(lexer, &((ASTNode*)*node)->type) != E_SUCCESS) { return parser_error(lexer, "Expected parameter type."); } if (parser_parse_id(lexer, &(*node)->identifier) != E_SUCCESS) { return parser_error(lexer, "Expected parameter identifier."); } return E_SUCCESS; } /** * <block> -> { <var_decl_list> <statement_list> } */ Error parser_parse_block(Lexer* lexer, ASTNode** node) { *node = ast_create_node(AST_BLOCK, lexer->context->file); Token token = lexer_next(lexer); if (token.type != T_BRACE_LEFT) { return parser_error(lexer, "Missing left curly brace when parsing block."); } // set line and column (*node)->line = token.line; (*node)->column = token.column; if (parser_parse_var_decl_list(lexer, *node) != E_SUCCESS) { return E_PARSE_ERROR; } if (parser_parse_statement_list(lexer, *node) != E_SUCCESS) { return E_PARSE_ERROR; } if (lexer_next(lexer).type != T_BRACE_RIGHT) { return parser_error(lexer, "Missing right curly brace when parsing block."); } return E_SUCCESS; } /** * <var_decl_list> -> <var_decl> <var_decl_list> | EPSILON */ Error parser_parse_var_decl_list(Lexer* lexer, ASTNode* parent) { Token token = lexer_lookahead(lexer, 1); // first derivation if (token.type == T_BOOLEAN || token.type == T_INT) { if (parser_parse_var_decl(lexer, parent) != E_SUCCESS) { return E_PARSE_ERROR; } if (parser_parse_var_decl_list(lexer, parent) != E_SUCCESS) { return E_PARSE_ERROR; } } // epsilon return E_SUCCESS; } /** * <statement_list> -> <statement> <statement_list> | EPSILON */ Error parser_parse_statement_list(Lexer* lexer, ASTNode* parent) { // epsilon if (lexer_lookahead(lexer, 1).type == T_BRACE_RIGHT) { return E_SUCCESS; } // first derivation ASTNode* statement; if (parser_parse_statement(lexer, &statement) != E_SUCCESS) { return E_PARSE_ERROR; } ast_add_child(parent, statement); if (parser_parse_statement_list(lexer, parent) != E_SUCCESS) { return E_PARSE_ERROR; } return E_SUCCESS; } /** * <var_decl> -> <type> <id> <var_id_list_tail> */ Error parser_parse_var_decl(Lexer* lexer, ASTNode* parent) { ASTDecl* node = ast_create_node(AST_VAR_DECL, lexer->context->file); // set line and column Token next_token = lexer_lookahead(lexer, 1); ((ASTNode*)node)->line = next_token.line; ((ASTNode*)node)->column = next_token.column; if (parser_parse_type(lexer, &((ASTNode*)node)->type) != E_SUCCESS) { return parser_error(lexer, "Expected variable type."); } if (parser_parse_id(lexer, &node->identifier) != E_SUCCESS) { return parser_error(lexer, "Expected variable name."); } ast_add_child(parent, node); return parser_parse_var_id_list_tail(lexer, ((ASTNode*)node)->type, parent); } /** * <var_id_list_tail> -> , <id> <var_id_list_tail> | ; */ Error parser_parse_var_id_list_tail(Lexer* lexer, DataType type, ASTNode* parent) { Token token = lexer_next(lexer); if (token.type == T_COMMA) { ASTDecl* node = ast_create_node(AST_VAR_DECL, lexer->context->file); ((ASTNode*)node)->type = type; // set line and column ((ASTNode*)node)->line = token.line; ((ASTNode*)node)->column = token.column; //first derivation if (parser_parse_id(lexer, &node->identifier) != E_SUCCESS) { return parser_error(lexer, "Expected identifier."); } ast_add_child(parent, node); if (parser_parse_var_id_list_tail(lexer, type, parent) != E_SUCCESS) { return parser_error(lexer, "Expected variable identifier list tail."); } } else if (token.type != T_STATEMENT_END) { return parser_error(lexer, "Missing semicolon ';' or comma ',' after variable declaration."); } return E_SUCCESS; } /** * <type> -> int | boolean */ Error parser_parse_type(Lexer* lexer, DataType* type) { Token token = lexer_next(lexer); if (token.type == T_BOOLEAN) { *type = TYPE_BOOLEAN; } else if (token.type == T_INT) { *type = TYPE_INT; } else { return E_PARSE_ERROR; } return E_SUCCESS; } /** * <statement> -> <location> <assign_op> <expr> ; * | <method_call> ; * | if ( <expr> ) <block> <else_expr> * | for <id> = <expr> , <expr> <block> * | return <expr_option> ; * | break ; * | continue ; * | <block> */ Error parser_parse_statement(Lexer* lexer, ASTNode** node) { Token token = lexer_lookahead(lexer, 1); // second derivation - method call if (token.type == T_CALLOUT || (token.type == T_IDENTIFIER && lexer_lookahead(lexer, 2).type == T_PAREN_LEFT)) { if (parser_parse_method_call(lexer, (ASTReference**)node) != E_SUCCESS) { return parser_error(lexer, "Expected method call."); } if (lexer_next(lexer).type != T_STATEMENT_END) { return parser_error(lexer, "Missing semicolon at end of statement."); } return E_SUCCESS; } // first derivation - assignment statement else if (token.type == T_IDENTIFIER) { // Parse the location first. The location will be the first child of the // assignment operation node once we parse it. ASTReference* location; if (parser_parse_location(lexer, &location) != E_SUCCESS) { return parser_error(lexer, "Expected location in statement."); } // now parse the assignment node, and add the location as the left // operand if (parser_parse_assign_op(lexer, (ASTOperation**)node) != E_SUCCESS) { return parser_error(lexer, "Expected assignment operator."); } ast_add_child(*node, location); // now parse the right operand expression ASTNode* expr; if (parser_parse_expr(lexer, &expr) != E_SUCCESS) { return parser_error(lexer, "Expected expression."); } ast_add_child(*node, expr); // semicolon if (lexer_next(lexer).type != T_STATEMENT_END) { return parser_error(lexer, "Missing semicolon at end of statement."); } return E_SUCCESS; } // eighth derivation else if (token.type == T_BRACE_LEFT) { if (parser_parse_block(lexer, node) != E_SUCCESS) { return parser_error(lexer, "Expected block."); } return E_SUCCESS; } // terminals lexer_next(lexer); // third derivation - if statement if (token.type == T_IF) { *node = ast_create_node(AST_IF_STATEMENT, lexer->context->file); // set line and column ((ASTNode*)*node)->line = token.line; ((ASTNode*)*node)->column = token.column; if (lexer_next(lexer).type != T_PAREN_LEFT) { return parser_error(lexer, "Missing opening parenthesis."); } ASTNode* expr; if (parser_parse_expr(lexer, &expr) != E_SUCCESS) { return parser_error(lexer, "Expected expression."); } ast_add_child(*node, expr); if (lexer_next(lexer).type != T_PAREN_RIGHT) { return parser_error(lexer, "Missing closing parenthesis."); } ASTNode* block; if (parser_parse_block(lexer, &block) != E_SUCCESS) { return parser_error(lexer, "Expected block."); } ast_add_child(*node, block); if (parser_parse_else_expr(lexer, *node) != E_SUCCESS) { return parser_error(lexer, "Expected else expression."); } return E_SUCCESS; } // fourth derivation else if (token.type == T_FOR) { *node = ast_create_node(AST_FOR_STATEMENT, lexer->context->file); // set line and column (*node)->line = token.line; (*node)->column = token.column; // variable used in the loop ASTDecl* var = ast_create_node(AST_VAR_DECL, lexer->context->file); // is always an int ((ASTNode*)var)->type = TYPE_INT; // set line and column Token next_token = lexer_lookahead(lexer, 1); ((ASTNode*)var)->line = next_token.line; ((ASTNode*)var)->column = next_token.column; // get the variable id if (parser_parse_id(lexer, &var->identifier) != E_SUCCESS) { return parser_error(lexer, "Expected variable name."); } ast_add_child(*node, var); // the variable is declared and assigned to in one go; create the // assignment node now ASTOperation* assignment = ast_create_node(AST_ASSIGN_OP, lexer->context->file); // get the operator Token operator_token = lexer_next(lexer); if (operator_token.type != T_EQUAL) { return parser_error(lexer, "Expected equals '=' sign."); } assignment->operator = operator_token.lexeme; ast_add_child(*node, assignment); // set line and column ((ASTNode*)assignment)->line = operator_token.line; ((ASTNode*)assignment)->column = operator_token.column; // now make the "location" node - the location assigned to ASTReference* location = ast_create_node(AST_LOCATION, lexer->context->file); // variable name is same as in declaration location->identifier = var->identifier; ast_add_child(assignment, location); // set line and column ((ASTNode*)location)->line = next_token.line; ((ASTNode*)location)->column = next_token.column; // get the assignment value expression ASTNode* expr; if (parser_parse_expr(lexer, &expr) != E_SUCCESS) { return parser_error(lexer, "Expected expression."); } ast_add_child(assignment, expr); if (lexer_next(lexer).type != T_COMMA) { return parser_error(lexer, "Expected comma ',' after expression."); } if (parser_parse_expr(lexer, &expr) != E_SUCCESS) { return parser_error(lexer, "Expected expression."); } ast_add_child(*node, expr); ASTNode* block; if (parser_parse_block(lexer, &block) != E_SUCCESS) { return parser_error(lexer, "Expected block."); } ast_add_child(*node, block); return E_SUCCESS; } // fifth derivation - return statement else if (token.type == T_RETURN) { *node = ast_create_node(AST_RETURN_STATEMENT, lexer->context->file); // set line and column (*node)->line = token.line; (*node)->column = token.column; if (parser_parse_expr_option(lexer, *node) != E_SUCCESS) { return E_PARSE_ERROR; } if (lexer_next(lexer).type != T_STATEMENT_END) { return parser_error(lexer, "Missing semicolon at end of statement."); } return E_SUCCESS; } // sixth derivation else if (token.type == T_BREAK) { *node = ast_create_node(AST_BREAK_STATEMENT, lexer->context->file); // set line and column (*node)->line = token.line; (*node)->column = token.column; if (lexer_next(lexer).type != T_STATEMENT_END) { return parser_error(lexer, "Missing semicolon at end of statement."); } return E_SUCCESS; } // seventh derivation else if (token.type == T_CONTINUE) { *node = ast_create_node(AST_CONTINUE_STATEMENT, lexer->context->file); // set line and column (*node)->line = token.line; (*node)->column = token.column; if (lexer_next(lexer).type != T_STATEMENT_END) { return parser_error(lexer, "Missing semicolon at end of statement."); } return E_SUCCESS; } return parser_error(lexer, "Invalid statement."); } /** * <else_expr> -> else <block> | EPSILON */ Error parser_parse_else_expr(Lexer* lexer, ASTNode* parent) { Token token = lexer_lookahead(lexer, 1); // first derivation if (token.type == T_ELSE) { lexer_next(lexer); // create an else node ASTNode* else_expr = ast_create_node(AST_ELSE_STATEMENT, lexer->context->file); ast_add_child(parent, else_expr); // set line and column else_expr->line = token.line; else_expr->column = token.column; // parse the else's block ASTNode* block; if (parser_parse_block(lexer, &block) != E_SUCCESS) { return parser_error(lexer, "Expected block following else statement."); } ast_add_child(else_expr, block); } // epsilon return E_SUCCESS; } /** * <expr_option> -> <expr> | EPSILON */ Error parser_parse_expr_option(Lexer* lexer, ASTNode* parent) { // epsilon if (lexer_lookahead(lexer, 1).type == T_STATEMENT_END) { return E_SUCCESS; } // expect an expression ASTNode* expr; if (parser_parse_expr(lexer, &expr) != E_SUCCESS) { return E_PARSE_ERROR; } ast_add_child(parent, expr); return E_SUCCESS; } /** * <assign_op> -> = | += | -= */ Error parser_parse_assign_op(Lexer* lexer, ASTOperation** node) { // I think I got this Token token = lexer_next(lexer); if (token.type != T_EQUAL && token.type != T_PLUS_EQUAL && token.type != T_MINUS_EQUAL) { return parser_error(lexer, "Expected an assignment operator ('=', '+=', '-=')."); } *node = ast_create_node(AST_ASSIGN_OP, lexer->context->file); (*node)->operator = token.lexeme; // set line and column ((ASTNode*)*node)->line = token.line; ((ASTNode*)*node)->column = token.column; return E_SUCCESS; } /** * <method_call> -> <method_name> ( <expr_list> ) * | callout ( <string_literal> <callout_arg_list> ) */ Error parser_parse_method_call(Lexer* lexer, ASTReference** node) { Token first_token = lexer_lookahead(lexer, 1); // library callout call if (first_token.type == T_CALLOUT) { lexer_next(lexer); *node = ast_create_node(AST_CALLOUT, lexer->context->file); // set line and column ((ASTNode*)*node)->line = first_token.line; ((ASTNode*)*node)->column = first_token.column; // we know the return type already; is always int ((ASTNode*)*node)->type = TYPE_INT; } else { // standard method call *node = ast_create_node(AST_METHOD_CALL, lexer->context->file); // set line and column ((ASTNode*)*node)->line = first_token.line; ((ASTNode*)*node)->column = first_token.column; // parse the method name if (parser_parse_method_name(lexer, &(*node)->identifier) != E_SUCCESS) { return parser_error(lexer, "Expected method name in method call."); } } // left paren if (lexer_next(lexer).type != T_PAREN_LEFT) { return parser_error(lexer, "Missing opening parenthesis in method call."); } // callout arguments if (first_token.type == T_CALLOUT) { // callout expects a string first ASTNode* string_literal; if (parser_parse_string_literal(lexer, &string_literal) != E_SUCCESS) { return parser_error(lexer, "Expected library function name in callout."); } (*node)->identifier = (char*)string_literal->value; // parse the arguments, if any if (parser_parse_callout_arg_list(lexer, *node) != E_SUCCESS) { return parser_error(lexer, "Expected argument list in callout."); } // regular method call arguments } else if (parser_parse_expr_list(lexer, (ASTNode*)*node) != E_SUCCESS) { return parser_error(lexer, "Expected argument list in method call."); } // right paren if (lexer_next(lexer).type != T_PAREN_RIGHT) { return parser_error(lexer, "Missing closing parenthesis in method call."); } return E_SUCCESS; } /** * <expr_list> -> <expr> <expr_list_tail> | EPSILON */ Error parser_parse_expr_list(Lexer* lexer, ASTNode* parent) { // epsilon if (lexer_lookahead(lexer, 1).type == T_PAREN_RIGHT) { return E_SUCCESS; } // parse an expr and add it to the parent node ASTNode* expr; if (parser_parse_expr(lexer, &expr) != E_SUCCESS) { return E_PARSE_ERROR; } ast_add_child(parent, expr); // see if there are more expressions to parse return parser_parse_expr_list_tail(lexer, parent); } /** * <expr_list_tail> -> , <expr> <expr_list_tail> | EPSILON */ Error parser_parse_expr_list_tail(Lexer* lexer, ASTNode* parent) { Token first_token = lexer_lookahead(lexer, 1); // no more commas - end of expr list if (first_token.type != T_COMMA) { // epsilon derivation return E_SUCCESS; } // consume the comma lexer_next(lexer); // parse another expr and add it to the parent ASTNode* expr; if (parser_parse_expr(lexer, &expr) != E_SUCCESS) { return parser_error(lexer, "Expected another expression following comma."); } ast_add_child(parent, expr); // see if there are more expressions to parse return parser_parse_expr_list_tail(lexer, parent); } /** * <callout_arg_list> -> , <callout_arg> <callout_arg_list> | EPSILON */ Error parser_parse_callout_arg_list(Lexer* lexer, ASTReference* parent) { Token token = lexer_lookahead(lexer, 1); // first derivation if (token.type == T_COMMA) { lexer_next(lexer); ASTNode* arg; if (parser_parse_callout_arg(lexer, &arg) != E_SUCCESS) { return parser_error(lexer, "Expected another argument in callout argument list."); } ast_add_child(parent, arg); // parse more arguments if there are any return parser_parse_callout_arg_list(lexer, parent); } // epsilon return E_SUCCESS; } /** * <method_name> -> <id> */ Error parser_parse_method_name(Lexer* lexer, char** identifier) { return parser_parse_id(lexer, identifier); } /** * <location> -> <id> <array_subscript_expr> */ Error parser_parse_location(Lexer* lexer, ASTReference** node) { *node = ast_create_node(AST_LOCATION, lexer->context->file); Token token = lexer_lookahead(lexer, 1); // set line and column ((ASTNode*)*node)->line = token.line; ((ASTNode*)*node)->column = token.column; if (parser_parse_id(lexer, &(*node)->identifier) != E_SUCCESS) { return parser_error(lexer, "Failure in parsing location - parser_parse_id failed."); } return parser_parse_array_subscript_expr(lexer, *node); } /** * <array_subscript_expr> -> [ <expr> ] | EPSILON */ Error parser_parse_array_subscript_expr(Lexer* lexer, ASTReference* parent) { Token token = lexer_lookahead(lexer, 1); if (token.type == T_BRACKET_LEFT) { // consume current token lexer_next(lexer); ASTNode* expr; if (parser_parse_expr(lexer, &expr) != E_SUCCESS) { return parser_error(lexer, "Expected expression inside array subscript."); } ast_add_child(parent, expr); if (lexer_next(lexer).type != T_BRACKET_RIGHT) { return parser_error(lexer, "Missing closing bracket in array subscript expression."); } } // epsilon return E_SUCCESS; } /** * Note that this function parses the following 2 grammar rules at once: * * <expr> -> <expr_part> <expr_end> * <expr_end> -> <bin_op> <expr> | EPSILON */ Error parser_parse_expr(Lexer* lexer, ASTNode** node) { // Create a node for the expression parsed. We don't know yet if this // expression is an operand for a binary operation or not. ASTNode* left_expr; // parse the primary expression if (parser_parse_expr_part(lexer, &left_expr) != E_SUCCESS) { return E_PARSE_ERROR; } // Now check if there is a binary operator following the above expression. // If there is, try and parse it and make it the parent node for the left // and right operand expressions. if (token_is_bin_op(lexer_lookahead(lexer, 1))) { // We do have a binary operation, so set the following operation node // as the root node of the expression. if (parser_parse_bin_op(lexer, (ASTOperation**)node) != E_SUCCESS) { return parser_error(lexer, "Expected binary operator."); } // Now add the original expression we parsed earlier as the left // operand expression. ast_add_child(*node, left_expr); // Now parse the right operand expression and add it to the parent // operation node. ASTNode* right_expr; if (parser_parse_expr(lexer, &right_expr) != E_SUCCESS) { return parser_error(lexer, "Expected expression."); } ast_add_child(*node, right_expr); } // If a binary operator was not found, the left expression is the only // expression and becomes the root node. This is equivalent to the non- // terminal <expr_end> deriving as epsilon. else { *node = left_expr; } return E_SUCCESS; } /** * Parses the primary part of an expression. * * <expr_part> -> <location> * | <method_call> * | <literal> * | - <expr> * | ! <expr> * | ( <expr> ) */ Error parser_parse_expr_part(Lexer* lexer, ASTNode** node) { Token next_token = lexer_lookahead(lexer, 1); // second derivation - method call if (next_token.type == T_CALLOUT || (next_token.type == T_IDENTIFIER && lexer_lookahead(lexer, 2).type == T_PAREN_LEFT)) { if (parser_parse_method_call(lexer, (ASTReference**)node) != E_SUCCESS) { return parser_error(lexer, "Expected method call."); } return E_SUCCESS; } // first derivation - location if (next_token.type == T_IDENTIFIER) { if (parser_parse_location(lexer, (ASTReference**)node) != E_SUCCESS) { return parser_error(lexer, "Expected location."); } return E_SUCCESS; } // fourth and fifth derivation - unary operation if (next_token.type == T_MINUS || next_token.type == T_LOGICAL_NOT) { lexer_next(lexer); // create a unary expression node *node = ast_create_node(AST_UNARY_OP, lexer->context->file); ((ASTOperation*)*node)->operator = next_token.lexeme; // set line and column (*node)->line = next_token.line; (*node)->column = next_token.column; // Parse a sub-expression and add it as the only child of the unary // operation node. ASTNode* expr; if (parser_parse_expr(lexer, &expr) != E_SUCCESS) { return parser_error(lexer, "Expected expression."); } ast_add_child(*node, expr); return E_SUCCESS; } // last derivation - a sub-expression in parenthesis if (next_token.type == T_PAREN_LEFT) { lexer_next(lexer); if (parser_parse_expr(lexer, node) != E_SUCCESS) { return parser_error(lexer, "Expected expression."); } if (lexer_next(lexer).type != T_PAREN_RIGHT) { return parser_error(lexer, "Missing closing parenthesis."); } return E_SUCCESS; } // third derivation - a simple literal if (parser_parse_literal(lexer, node) != E_SUCCESS) { return parser_error(lexer, "Expected literal expression."); } return E_SUCCESS; } /** * <callout_arg> -> <expr> | <string_literal> */ Error parser_parse_callout_arg(Lexer* lexer, ASTNode** node) { // second derivation - string literal if (lexer_lookahead(lexer, 1).type == T_STRING_LITERAL) { // parse a string and use that as the argument if (parser_parse_string_literal(lexer, node) != E_SUCCESS) { return parser_error(lexer, "Expected string literal."); } } // first derivation else if (parser_parse_expr(lexer, node) != E_SUCCESS) { return parser_error(lexer, "Expected expression."); } return E_SUCCESS; } /** * <bin_op> -> <arith_op> | <rel_op> | <eq_op> | <cond_op> */ Error parser_parse_bin_op(Lexer* lexer, ASTOperation** node) { // make sure next token is a binary operator Token token = lexer_next(lexer); if (!token_is_bin_op(token)) { return parser_error(lexer, "Invalid operator type."); } // create a binary op node *node = ast_create_node(AST_BINARY_OP, lexer->context->file); // set line and column ((ASTNode*)*node)->line = token.line; ((ASTNode*)*node)->column = token.column; // get the operator from the token lexeme (*node)->operator = token.lexeme; return E_SUCCESS; } /** * <literal> -> <int_literal> | <char_literal> | <bool_literal> */ Error parser_parse_literal(Lexer* lexer, ASTNode** node) { Token token = lexer_lookahead(lexer, 1); if (token.type == T_INT_LITERAL) { if (parser_parse_int_literal(lexer, node) != E_SUCCESS) { return parser_error(lexer, "Error in parsing literal - parsing failed at parser_parse_int_literal."); } } else if (token.type == T_CHAR_LITERAL) { if (parser_parse_char_literal(lexer, node) != E_SUCCESS) { return parser_error(lexer, "Error in parsing literal - parsing failed at parser_parse_char_literal."); } } else if (parser_parse_bool_literal(lexer, node) != E_SUCCESS) { return parser_error(lexer, "Error in parsing literal - parsing failed at parser_parse_bool_literal."); } return E_SUCCESS; } /** * <id> -> <alpha> <alpha_num_string> */ Error parser_parse_id(Lexer* lexer, char** identifier) { Token token = lexer_next(lexer); if (token.type != T_IDENTIFIER) { return E_PARSE_ERROR; } *identifier = token.lexeme; return E_SUCCESS; } /** * <int_literal> -> <decimal_literal> | <hex_literal> */ Error parser_parse_int_literal(Lexer* lexer, ASTNode** node) { Token token = lexer_next(lexer); if (token.type != T_INT_LITERAL) { return parser_error(lexer, "Expected an integer literal."); } // create a node *node = ast_create_node(AST_INT_LITERAL, lexer->context->file); (*node)->type = TYPE_INT; // set line and column (*node)->line = token.line; (*node)->column = token.column; // get the actual int value (*node)->value = malloc(sizeof(int)); *(int*)(*node)->value = parser_str_to_long(token.lexeme); return E_SUCCESS; } /** * <bool_literal> -> true | false */ Error parser_parse_bool_literal(Lexer* lexer, ASTNode** node) { Token token = lexer_next(lexer); if (token.type != T_BOOLEAN_LITERAL) { return parser_error(lexer, "Expected 'true' or 'false'."); } // create a node *node = ast_create_node(AST_BOOLEAN_LITERAL, lexer->context->file); (*node)->type = TYPE_BOOLEAN; // set line and column (*node)->line = token.line; (*node)->column = token.column; // get the actual boolean value (*node)->value = malloc(sizeof(bool)); if (strcmp(token.lexeme, "true") == 0) { *(bool*)(*node)->value = true; } else { *(bool*)(*node)->value = false; } return E_SUCCESS; } /** * <char_literal> -> ' <char> ' */ Error parser_parse_char_literal(Lexer* lexer, ASTNode** node) { Token token = lexer_next(lexer); if (token.type != T_CHAR_LITERAL) { return parser_error(lexer, "Expected a char literal."); } // create a node *node = ast_create_node(AST_CHAR_LITERAL, lexer->context->file); (*node)->type = TYPE_CHAR; // set line and column (*node)->line = token.line; (*node)->column = token.column; // get the actual value (*node)->value = parser_strip_quotes(token.lexeme); return E_SUCCESS; } /** * <string_literal> -> " <char> " */ Error parser_parse_string_literal(Lexer* lexer, ASTNode** node) { Token token = lexer_next(lexer); if (token.type != T_STRING_LITERAL) { return parser_error(lexer, "Expected a string literal."); } // create a node *node = ast_create_node(AST_STRING_LITERAL, lexer->context->file); (*node)->type = TYPE_STRING; // set line and column (*node)->line = token.line; (*node)->column = token.column; // get the actual value (*node)->value = parser_strip_quotes(token.lexeme); return E_SUCCESS; }
29.181685
126
0.626516
81494a6f6e77bf847298c0628868681b057a7ff2
1,703
rb
Ruby
spec/spec_helper.rb
AirspaceTechnologies/strong_resources
0e650aa82d327a59c52d6ded4f8ed4b7bf689272
[ "MIT" ]
7
2017-06-09T09:57:49.000Z
2020-05-04T08:35:19.000Z
spec/spec_helper.rb
AirspaceTechnologies/strong_resources
0e650aa82d327a59c52d6ded4f8ed4b7bf689272
[ "MIT" ]
10
2017-05-17T11:01:34.000Z
2018-12-04T20:31:51.000Z
spec/spec_helper.rb
AirspaceTechnologies/strong_resources
0e650aa82d327a59c52d6ded4f8ed4b7bf689272
[ "MIT" ]
14
2016-09-26T20:39:59.000Z
2021-01-04T09:50:38.000Z
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'jsonapi_compliable' require 'action_pack' require 'action_controller' module ActionController SharedTestRoutes = ActionDispatch::Routing::RouteSet.new SharedTestRoutes.draw do resources :people end class Base include ActionController::Testing include SharedTestRoutes.url_helpers end end require 'strong_resources' require 'rspec' require 'pry' require 'pry-byebug' StrongResources.configure do strong_param :pet_kind, swagger: :string, type: ActionController::Parameters.enum('Dog', 'Cat') strong_resource :person do attribute :name, :string end strong_resource :pet do attribute :name, :string attribute :kind, :pet_kind end strong_resource :company do attribute :title, :string attribute :revenue, :integer end strong_resource :state do attribute :acronym, :string end strong_resource :color do attribute :name, :string end end class PeopleController < ActionController::Base include StrongResources::Controller::Mixin include JsonapiCompliable::Base strong_resource :person do has_many :pets, only: [:kind], destroy: true has_many :siblings, resource: :person, disassociate: true belongs_to :company, except: [:revenue] do belongs_to :state end on :update do remove_attribute :name remove_relationship :company end end def create render json: strong_resource end end class ColorsController < ActionController::Base include StrongResources::Controller::Mixin include JsonapiCompliable::Base strong_resource :color def create render json: strong_resource end end
20.035294
61
0.736348
57eb97c7b5064d2bf0b639caab9ea7a25e812629
8,745
php
PHP
inc/customize-theme.php
haqueamirul/medical-wordpress-theme
9d5686188f9c904a0d05b0316f029f2b752baa8c
[ "MIT" ]
null
null
null
inc/customize-theme.php
haqueamirul/medical-wordpress-theme
9d5686188f9c904a0d05b0316f029f2b752baa8c
[ "MIT" ]
null
null
null
inc/customize-theme.php
haqueamirul/medical-wordpress-theme
9d5686188f9c904a0d05b0316f029f2b752baa8c
[ "MIT" ]
null
null
null
<?php /** * medisoft.2 functions and definitions * * @link https://soft-theme.com/medisoft/medisoft-2/ * * @package medisoft-2 */ function soft_prefix_custom_register( $wp_customize ) { $wp_customize->add_panel( 'panel_id', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( 'Theme Options', 'medisoft-2' ), 'description' => __( 'Description of what this panel does.', 'medisoft-2' ), ) ); //Costom Logo section ======================================================================= $wp_customize->add_section( 'logo_id', array( 'priority' => 15, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( 'Logo Section', 'medisoft-2' ), 'description' => '', 'panel' => 'panel_id', ) ); $wp_customize->add_setting( 'logo-image', array( 'default' => '', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'medisoft_1_2_snitize_img', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'logo-image', array( 'label' => __('Upload Your Logo','medisoft-2'), 'section' => 'logo_id', 'settings' => 'logo-image', ) ) ); // Address sections ============================================================= $wp_customize->add_setting( 'header_email', array( 'default' => '', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'medisoft_1_2_sanitize_text', ) ); $wp_customize->add_control( 'header_email', array( 'type' => 'text', 'priority' => 20, 'section' => 'logo_id', 'label' => __( 'Header Email.', 'medisoft-2' ), 'description' => 'Write your header email here.', ) ); $wp_customize->add_setting( 'header_phone', array( 'default' => '', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'medisoft_1_2_sanitize_text', ) ); $wp_customize->add_control( 'header_phone', array( 'type' => 'text', 'priority' => 20, 'section' => 'logo_id', 'label' => __( 'Header Phone Number.', 'medisoft-2' ), 'description' => 'Write your header phone number here.', ) ); // Header top section =============================================================== $wp_customize->add_section( 'header_top_section', array( 'priority' => 5, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( 'Top Section', 'medisoft-2' ), 'description' => '', 'panel' => 'panel_id', ) ); $wp_customize->add_setting( 'opening_hourse', array( 'default' => '', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'medisoft_1_2_sanitize_text', ) ); $wp_customize->add_control( 'opening_hourse', array( 'type' => 'text', 'priority' => 10, 'section' => 'header_top_section', 'label' => __( 'Opening Hours Text', 'medisoft-2' ), 'description' => 'Write your opening hours here.', ) ); // Social Section =============================================================== $wp_customize->add_section( 'social_section', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( 'Top Social Section', 'medisoft-2' ), 'description' => '', 'panel' => 'panel_id', ) ); $wp_customize->add_setting( 'show_search_box', array( 'default' => false, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'theme_slug_sanitize_checkbox', ) ); $wp_customize->add_control( 'show_search_box', array( 'settings' => 'show_search_box', 'label' => 'Show Serch Box', 'section' => 'social_section', 'type' => 'checkbox' ) ); $wp_customize->add_setting( 'facebook_link', array( 'default' => '', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'medisoft_1_2_sanitize_text', ) ); $wp_customize->add_control( 'facebook_link', array( 'type' => 'text', 'priority' => 15, 'section' => 'social_section', 'label' => __( 'Facebook Link.', 'medisoft-2' ), 'description' => 'Write your facebook link here.', ) ); $wp_customize->add_setting( 'twitter_link', array( 'default' => '', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'medisoft_1_2_sanitize_text', ) ); $wp_customize->add_control( 'twitter_link', array( 'type' => 'text', 'priority' => 20, 'section' => 'social_section', 'label' => __( 'Twitter Link.', 'medisoft-2' ), 'description' => 'Write your twitter link here.', ) ); $wp_customize->add_setting( 'google_plus_link', array( 'default' => '', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'medisoft_1_2_sanitize_text', ) ); $wp_customize->add_control( 'google_plus_link', array( 'type' => 'text', 'priority' => 20, 'section' => 'social_section', 'label' => __( 'Google Plus Link.', 'medisoft-2' ), 'description' => 'Write your google plus link here.', ) ); $wp_customize->add_setting( 'linkedin_link', array( 'default' => '', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'medisoft_1_2_sanitize_text', ) ); $wp_customize->add_control( 'linkedin_link', array( 'type' => 'text', 'priority' => 20, 'section' => 'social_section', 'label' => __( 'Linkedin Link.', 'medisoft-2' ), 'description' => 'Write your linkedin link here.', ) ); // Copyright Sections ============================================================= $wp_customize->add_section( 'copyright_section', array( 'priority' => 25, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( 'Copyright Section', 'medisoft-2' ), 'description' => '', 'panel' => 'panel_id', ) ); $wp_customize->add_setting( 'copyright_text', array( 'default' => 'copyright medisoft 2018. design by', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'medisoft_1_2_sanitize_text', ) ); $wp_customize->add_control( 'copyright_text', array( 'type' => 'text', 'priority' => 10, 'section' => 'copyright_section', 'label' => __( 'Copyright Text', 'medisoft-2' ), 'description' => 'Write your copyright text here.', ) ); $wp_customize->add_setting( 'dev_name', array( 'default' => 'Soft-theme', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'medisoft_1_2_sanitize_text', ) ); $wp_customize->add_control( 'dev_name', array( 'type' => 'text', 'priority' => 15, 'section' => 'copyright_section', 'label' => __( 'Copany Name', 'medisoft-2' ), 'description' => 'Write your name here.', ) ); $wp_customize->add_setting( 'dev_link', array( 'default' => '', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'medisoft_1_2_sanitize_text', ) ); $wp_customize->add_control( 'dev_link', array( 'type' => 'text', 'priority' => 20, 'section' => 'copyright_section', 'label' => __( 'Copany Link', 'medisoft-2' ), 'description' => 'Write your link here.', ) ); } add_action( 'customize_register', 'soft_prefix_custom_register' ); function medisoft_1_2_snitize_img( $input ){ /* default output */ $output = ''; /* check file type */ $filetype = wp_check_filetype( $input ); $mime_type = $filetype['type']; /* only mime type "image" allowed */ if ( strpos( $mime_type, 'image' ) !== false ){ $output = $input; } return $output; } function medisoft_1_2_sanitize_text( $str ) { return sanitize_text_field( $str ); } function medisoft_1_2_sanitize_textarea_field( $str ) { $filtered = _medisoft_1_2_sanitize_text_fields( $str, true ); /** * Filters a sanitized textarea field string. * * @since 4.7.0 * * @param string $filtered The sanitized string. * @param string $str The string prior to being sanitized. */ return apply_filters( 'medisoft_1_2_sanitize_textarea_field', $filtered, $str ); } //checkbox sanitization function function theme_slug_sanitize_checkbox( $input ){ //returns true if checkbox is checked return ( isset( $input ) ? true : false ); }
29.053156
94
0.573128
52f158e76fb6ecf170da90fd321a9a5c778ea598
682
rb
Ruby
lib/serialize_fu.rb
bumi/serializefu
7a7902f55e774cf74c51f2e1cce68fa29f1ba173
[ "MIT" ]
1
2016-05-08T11:12:57.000Z
2016-05-08T11:12:57.000Z
lib/serialize_fu.rb
bumi/serializefu
7a7902f55e774cf74c51f2e1cce68fa29f1ba173
[ "MIT" ]
null
null
null
lib/serialize_fu.rb
bumi/serializefu
7a7902f55e774cf74c51f2e1cce68fa29f1ba173
[ "MIT" ]
null
null
null
module Railslove module Plugins module SerializeFu def self.included(base) base.extend(ClassMethods) end module ClassMethods def serialize_fu(options={}) class_inheritable_accessor :serialize_options self.serialize_options = options include Railslove::Plugins::SerializeFu::InstanceMethods end end module InstanceMethods def to_json(options={}) super(self.serialize_options.merge(options)) end def to_xml(options={}) super(self.serialize_options.merge(options)) end end end end end
22
65
0.590909
0ada0575ef0d9366d4f92331dd325d1e1b3b8703
305
cs
C#
Photography/WebSite/Photography/Repositories/CategoryRepository.cs
sebastian-ilari/Photography
14e17414db48449109ff73267272f62032012033
[ "MIT" ]
null
null
null
Photography/WebSite/Photography/Repositories/CategoryRepository.cs
sebastian-ilari/Photography
14e17414db48449109ff73267272f62032012033
[ "MIT" ]
null
null
null
Photography/WebSite/Photography/Repositories/CategoryRepository.cs
sebastian-ilari/Photography
14e17414db48449109ff73267272f62032012033
[ "MIT" ]
null
null
null
using Photography.Interfaces; using Photography.Models; namespace Photography.Repositories { public class CategoryRepository : BaseRepository<Category> { public CategoryRepository(IPhotographyContext photographyContext) : base(photographyContext) { } } }
23.461538
101
0.701639
e2957bcbe391aa579ff4f6357b5b1063474c6561
159
rs
Rust
easy_scan_backend/src/metadata.rs
Linus045/easy_scan
55f237ec0e17b4e5dbcd927411a45b1782dc9683
[ "MIT" ]
null
null
null
easy_scan_backend/src/metadata.rs
Linus045/easy_scan
55f237ec0e17b4e5dbcd927411a45b1782dc9683
[ "MIT" ]
null
null
null
easy_scan_backend/src/metadata.rs
Linus045/easy_scan
55f237ec0e17b4e5dbcd927411a45b1782dc9683
[ "MIT" ]
null
null
null
use serde::Serialize; #[derive(Serialize)] pub struct PDFMetadata { pub name: String, pub preview_filenames: Vec<String>, pub page_count: i32 }
14.454545
39
0.691824
a46bfe3ba44197007edddd59cc0cd42e21d818a2
7,851
php
PHP
resources/views/Actividades/evaluado/actividadesAsignadasComentar.blade.php
Rddiazolivos/capitalHumano
f338b83b36e403e471d2575480c68b9024a37185
[ "MIT" ]
null
null
null
resources/views/Actividades/evaluado/actividadesAsignadasComentar.blade.php
Rddiazolivos/capitalHumano
f338b83b36e403e471d2575480c68b9024a37185
[ "MIT" ]
null
null
null
resources/views/Actividades/evaluado/actividadesAsignadasComentar.blade.php
Rddiazolivos/capitalHumano
f338b83b36e403e471d2575480c68b9024a37185
[ "MIT" ]
null
null
null
@extends('layouts.menu') @section('contenido') <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> <div class="row"> <div class="col-md-8"><strong>Nombre: </strong>{{$actividad->nombre}}</div> <div class="col-md-4"> <div class="row"> <div class="col-md-7" id="estadoTexto"><strong>Estado: </strong>{{$actividad->estado->nombre}}</div> <div class="col-md-5"> <!-- Trigger the modal with a button --> @if($actividad->estado_id == 1 && Auth::user()->rol_id === 3) <button id="btnModal" type="button" class="btn btn-link btn-xs" data-toggle="modal" data-target="#modalFinalizar">Cambiar</button> @elseif($actividad->estado_id == 2 && Auth::user()->rol_id === 3 ) <button id="btnModal" type="button" class="btn btn-link btn-xs" data-toggle="modal" data-target="#modalReanuadar">Cambiar</button> @elseif(($actividad->estado_id == 2 || $actividad->estado_id == 1) && Auth::user()->rol_id === 2 ) <button id="btnModal" type="button" class="btn btn-link btn-xs" data-toggle="modal" data-target="#modalEvaluador">Cambiar</button> @endif </div> </div> </div> </div> <div class="row"> <div class="col-md-12"><strong>Descripción: </strong>{{$actividad->descripcion}}</div> </div> <div class="row"> <div class="col-md-4"><strong>Fecha entrega: </strong>{{$actividad->fec_entrega}}</div> <div class="col-md-4"><strong>Prioridad: </strong>{{$actividad->prioridad->nombre}}</div> <div class="col-md-4"><strong>Tipo: </strong>{{$actividad->tipo->nombre}}</div> </div> </div> <div class="panel-body"> <!-- The scrollable area --> <div class="panel panel-info" id="data" style="overflow-y: scroll; height:200px;"> <div class="container-fluid"> @foreach ($actividad->comentario as $comentario) <div class="row"> <div class="col-md-2"><strong>Fecha: </strong></br> {{ \Carbon\Carbon::parse($comentario->created_at)->format('d/m/Y H:i') }} </div> <div class="col-md-10">{{$comentario->nombre}}</div> </div> </br> @endforeach </div> </div> <form method="post" action="{{ route('comentario.store') }}"> {{ csrf_field() }} <div class="form-group{{ $errors->has('nombre') ? ' has-error' : '' }}"> <label for="nombre" class="control-label">Comentar</label> <textarea rows="4" cols="50" id="nombre" type="text" class="form-control" name="nombre" required autofocus>{{ old('nombre') }}</textarea> @if ($errors->has('nombre')) <span class="help-block"> <strong>{{ $errors->first('nombre') }}</strong> </span> @endif </div> <!-- el campo oculto --> <input name="actividad_id" type="hidden" value="{{$actividad->id}}"> <input name="estadoActividad" id="campoFinalizar" type="hidden" value="{{$actividad->estado_id}}"> <div class="form-group"> <div class="col-md-6 col-md-offset-4"> <button type="submit" class="btn btn-primary"> Guardar cambios </button> </div> </div> </form> <!--<button type="button" class="btn btn-danger lol" data-dismiss="modal" id="finalizar">Finalizar</button> --> </div> </div> </div> <!-- Modal Pendiente--> <div id="modalFinalizar" class="modal fade" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">Finalizar actividad</h4> </div> <div class="modal-body"> <p>Una vez finalizada un actividad, dejara de tener acceso.</p> <small>*El cambio se reflejara al guardar los cambios.</small> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button> <button type="button" class="btn btn-danger lol" data-dismiss="modal" id="finalizar">Finalizar</button> </div> </div> </div> </div> <!-- Modal Reanuadar--> <div id="modalReanuadar" class="modal fade" role="dialog"> <div class="modal-dialog "> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">Reanuadar</h4> </div> <div class="modal-body"> <p>Reanudar la activadad dejara el estado como "Pendiente".</p> <small>*El cambio se reflejara al guardar los cambios.</small> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button> <button type="button" class="btn btn-warning lol" data-dismiss="modal" id="pendiente">Reanudar</button> </div> </div> </div> </div> <!-- Modal para el evaluador--> <div id="modalEvaluador" class="modal fade" role="dialog"> <div class="modal-dialog "> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">Cambiar estado</h4> </div> <div class="modal-body"> <p>Reanudar la activadad dejará el estado como "Pendiente".</p> <p>Finalizar la activadad dejará el estado como "Cerrada".</p> <small>*El cambio se reflejara al guardar los cambios.</small> </div> <div class="modal-footer"> <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Cancelar</button> <button type="button" class="btn btn-warning lol" data-dismiss="modal" id="pendiente">Pendiente</button> <button type="button" class="btn btn-danger lol" data-dismiss="modal" id="finalizar">Finalizar</button> </div> </div> </div> </div> <!-- div con el usuario actual --> <div id='usuarioActual' data-user='{{Auth::user()->rol_id}}'></div> @endsection
50.006369
169
0.466692
dc86cabac6639bd5452f913f477ae6c6c746a868
1,923
rb
Ruby
spec/system/user_account_registration_spec.rb
C-gyorfi/govuk-front-end-rails-app
e2cc598e03ec6605b2e0d138b632d18ab1800e9f
[ "MIT" ]
null
null
null
spec/system/user_account_registration_spec.rb
C-gyorfi/govuk-front-end-rails-app
e2cc598e03ec6605b2e0d138b632d18ab1800e9f
[ "MIT" ]
null
null
null
spec/system/user_account_registration_spec.rb
C-gyorfi/govuk-front-end-rails-app
e2cc598e03ec6605b2e0d138b632d18ab1800e9f
[ "MIT" ]
null
null
null
require 'rails_helper' RSpec.feature 'User account registration' do scenario 'User signs up' do when_i_visit_the_root_page and_i_click_on_the_registration_tab then_i_can_see_the_registration_page when_i_fill_up_the_form_by_omitting_fields and_i_click_on_the_registration the_i_can_see_field_errors when_i_fill_up_the_form and_i_click_on_the_registration the_i_can_see_the_success_page when_i_attempt_to_register_with_the_same_user_name and_i_click_on_the_registration the_i_can_see_the_name_already_taken and_phone_number_is_already_taken end def when_i_visit_the_root_page visit '/' end def and_i_click_on_the_registration_tab click_on 'Register' end def then_i_can_see_the_registration_page expect(page).to have_content('Register a new user') expect(page).to have_content('Username') expect(page).to have_content('Phone number') expect(page).to have_content('Date of Birth') end def when_i_fill_up_the_form_by_omitting_fields fill_in 'Date of Birth', with: '12/12/1212' end def the_i_can_see_field_errors expect(page).to have_content("Enter a user name") expect(page).to have_content("Enter a phone number") end def when_i_fill_up_the_form fill_in 'Username', with: 'new_user' fill_in 'Phone number', with: '0788888888' fill_in 'Date of Birth', with: '12/12/1212' end def and_i_click_on_the_registration click_button 'Register' end def the_i_can_see_the_success_page expect(page).to have_content('SUCCESSS') end def when_i_attempt_to_register_with_the_same_user_name and_i_click_on_the_registration_tab when_i_fill_up_the_form end def the_i_can_see_the_name_already_taken expect(page).to have_content('Name has already taken') end def and_phone_number_is_already_taken expect(page).to have_content('Phone has already taken') end end
25.64
59
0.782631
16d897da721fed59a9a583b079525822dd075760
96
dart
Dart
pkgs/test/test/common.dart
willdrach-wk/test
c075b7017f980f1634b8bbd55a73723150f431fa
[ "BSD-3-Clause" ]
1
2019-01-04T22:51:27.000Z
2019-01-04T22:51:27.000Z
pkgs/test/test/common.dart
willdrach-wk/test
c075b7017f980f1634b8bbd55a73723150f431fa
[ "BSD-3-Clause" ]
null
null
null
pkgs/test/test/common.dart
willdrach-wk/test
c075b7017f980f1634b8bbd55a73723150f431fa
[ "BSD-3-Clause" ]
null
null
null
import 'package:test/test.dart'; myTest(String name, Function() testFn) => test(name, testFn);
24
61
0.71875
7aabc9e6e9140b95805085449d31f087034893e4
263
cs
C#
ME/Model/OrderPointer.cs
kumarshekharroy/ME
0ef581dab2751c5f38746451b4ef561ef4573702
[ "Apache-2.0" ]
null
null
null
ME/Model/OrderPointer.cs
kumarshekharroy/ME
0ef581dab2751c5f38746451b4ef561ef4573702
[ "Apache-2.0" ]
null
null
null
ME/Model/OrderPointer.cs
kumarshekharroy/ME
0ef581dab2751c5f38746451b4ef561ef4573702
[ "Apache-2.0" ]
null
null
null
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ME.Model { class OrderPointer { public decimal Rate { get; set; } public OrderSide Side { get; set; } } }
17.533333
44
0.669202
e2887c2704e2d21ccb0a8db4f7b94c52ca40a7a9
448
py
Python
app/api/models.py
Arkaikus/MarvelFavsApi
8977bbd5a5cba7a1fecc9ceaed541112befb3540
[ "MIT" ]
null
null
null
app/api/models.py
Arkaikus/MarvelFavsApi
8977bbd5a5cba7a1fecc9ceaed541112befb3540
[ "MIT" ]
null
null
null
app/api/models.py
Arkaikus/MarvelFavsApi
8977bbd5a5cba7a1fecc9ceaed541112befb3540
[ "MIT" ]
null
null
null
from django.db import models from django.contrib.auth.models import User class Favorites(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) comicId = models.CharField(max_length=255, primary_key=True) title = models.CharField(max_length=255) thumbnail = models.URLField() description = models.TextField(default="", blank=True, null=False) class Meta: unique_together = (('user', 'comicId'), )
34.461538
70
0.723214
1ac7fc86a1e90f2887bfcdff057a6dcd7b522374
2,133
py
Python
pylabs/extensions/arakoon_ext/server/RemoteControlProtocol.py
Incubaid/arakoon
43a8d0b26e4876ef91d9657149f105c7e57e0cb0
[ "Apache-2.0" ]
41
2015-02-11T03:23:36.000Z
2020-12-27T12:13:52.000Z
ovs/extensions/db/arakoon/arakoon/RemoteControlProtocol.py
rootfs-analytics/openvstorage
6184822340faea1d2927643330a7aaa781d92d36
[ "Apache-2.0" ]
36
2015-01-04T16:58:51.000Z
2020-11-12T12:05:37.000Z
ovs/extensions/db/arakoon/arakoon/RemoteControlProtocol.py
rootfs-analytics/openvstorage
6184822340faea1d2927643330a7aaa781d92d36
[ "Apache-2.0" ]
7
2015-07-10T08:04:01.000Z
2021-09-28T08:09:23.000Z
""" Copyright (2010-2014) INCUBAID BVBA 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. """ import socket import logging import struct _COLLAPSE_TLOGS = 0x14 _SET_INTERVAL = 0x17 _DOWNLOAD_DB = 0x1b _OPTIMIZE_DB = 0x25 _DEFRAG_DB = 0x26 _DROP_MASTER = 0x30 _FLUSH_STORE = 0x42 _COPY_DB_TO_HEAD = 0x44 _MAGIC = 0xb1ff0000 _VERSION = 0x00000001 def _int_to(i): r = struct.pack("I", i) return r def _int_from(buff,pos): r = struct.unpack_from("I",buff, pos) return r[0], pos + 4 def _int64_from(buff,pos): r = struct.unpack_from("Q",buff,pos) return r[0], pos + 8 def _string_to(s): size = len(s) r = struct.pack("I%ds" % size, size, s) return r def _prologue(clusterId, sock): m = _int_to(_MAGIC) m += _int_to(_VERSION) m += _string_to(clusterId) sock.sendall(m) def _receive_all(sock,n): todo = n r = "" while todo: chunk = sock.recv(todo) if chunk == "" : raise RuntimeError("Not enough data on socket. Aborting...") todo -= len(chunk) r += chunk return r def _receive_int(sock): sizes = _receive_all(sock,4) i,_ = _int_from(sizes,0) return i def _receive_int64(sock): buf = _receive_all(sock, 8) i64,_ = _int64_from(buf,0) return i64 def _receive_string(sock): size = _receive_int(sock) s = _receive_all(sock,size) return s def check_error_code(s): rc = _receive_int(s) if rc: msg = _receive_string(s) raise Exception(rc, msg) def make_socket(ip, port): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sa = (ip, port) s.connect(sa) return s
22.935484
72
0.672761
7be6ea2e235a3c7e1f21663f18f5768eefa94172
1,936
cpp
C++
Source/FactoryGame/Buildables/FGBuildableTradingPost.cpp
iam-Legend/Project-Assembly
1ff3587704232d5e330515bc0d2aceb64ff09a7f
[ "MIT" ]
null
null
null
Source/FactoryGame/Buildables/FGBuildableTradingPost.cpp
iam-Legend/Project-Assembly
1ff3587704232d5e330515bc0d2aceb64ff09a7f
[ "MIT" ]
null
null
null
Source/FactoryGame/Buildables/FGBuildableTradingPost.cpp
iam-Legend/Project-Assembly
1ff3587704232d5e330515bc0d2aceb64ff09a7f
[ "MIT" ]
null
null
null
// This file has been automatically generated by the Unreal Header Implementation tool #include "FGBuildableTradingPost.h" AFGBuildableTradingPost::AFGBuildableTradingPost(){ } void AFGBuildableTradingPost::GetLifetimeReplicatedProps( TArray<FLifetimeProperty>& OutLifetimeProps) const{ } void AFGBuildableTradingPost::BeginPlay(){ } void AFGBuildableTradingPost::GetDismantleRefundReturns( TArray< FInventoryStack >& out_returns) const{ } void AFGBuildableTradingPost::Dismantle_Implementation(){ } void AFGBuildableTradingPost::GetDismantleRefund_Implementation( TArray< FInventoryStack >& out_refund) const{ } void AFGBuildableTradingPost::StartIsLookedAtForDismantle_Implementation( AFGCharacterPlayer* byCharacter){ } void AFGBuildableTradingPost::StopIsLookedAtForDismantle_Implementation( AFGCharacterPlayer* byCharacter){ } void AFGBuildableTradingPost::OnTradingPostUpgraded_Implementation( int32 level, bool suppressBuildEffects ){ } void AFGBuildableTradingPost::UpdateGeneratorVisibility(){ } void AFGBuildableTradingPost::UpdateStorageVisibility(){ } void AFGBuildableTradingPost::UpdateMAMVisibility(){ } int32 AFGBuildableTradingPost::GetTradingPostLevel() const{ return int32(); } void AFGBuildableTradingPost::PlayBuildEffects( AActor* inInstigator){ } void AFGBuildableTradingPost::ExecutePlayBuildEffects(){ } void AFGBuildableTradingPost::PlayBuildEffectsOnAllClients(AActor* instigator ){ } bool AFGBuildableTradingPost::AreChildBuildingsLoaded(){ return bool(); } void AFGBuildableTradingPost::OnBuildEffectFinished(){ } void AFGBuildableTradingPost::TogglePendingDismantleMaterial( bool enabled){ } void AFGBuildableTradingPost::AdjustPlayerSpawnsToGround(){ } AFGSchematicManager* AFGBuildableTradingPost::GetSchematicManager(){ return nullptr; } TArray<AActor*> AFGBuildableTradingPost::GetAllActiveSubBuildings(){ return TArray<AActor*>(); } void AFGBuildableTradingPost::OnRep_NeedPlayingBuildEffect(){ }
69.142857
112
0.845558
c4887840eda54fb39ad0b0b401ccf2d928813001
2,945
cpp
C++
src/test_hierarchical_clustering.cpp
UM-ARM-Lab/arc_utilities
e21bd5062983b25e61e33f832ec66b937540ba10
[ "BSD-2-Clause" ]
10
2017-01-09T14:37:14.000Z
2022-03-16T08:02:08.000Z
src/test_hierarchical_clustering.cpp
UM-ARM-Lab/arc_utilities
e21bd5062983b25e61e33f832ec66b937540ba10
[ "BSD-2-Clause" ]
62
2017-05-25T16:52:38.000Z
2022-03-08T20:05:09.000Z
src/test_hierarchical_clustering.cpp
UM-ARM-Lab/arc_utilities
e21bd5062983b25e61e33f832ec66b937540ba10
[ "BSD-2-Clause" ]
7
2017-08-04T13:06:17.000Z
2022-03-16T08:02:11.000Z
#include <stdio.h> #include <stdlib.h> #include <arc_utilities/abb_irb1600_145_fk_fast.hpp> #include <arc_utilities/arc_helpers.hpp> #include <arc_utilities/eigen_helpers.hpp> #include <arc_utilities/pretty_print.hpp> #include <arc_utilities/simple_hierarchical_clustering.hpp> #include <chrono> #include <fstream> #include <iostream> #include <random> int main(int argc, char** argv) { printf("%d arguments\n", argc); for (int idx = 0; idx < argc; idx++) { printf("Argument %d: %s\n", idx, argv[idx]); } const size_t num_points = (argc >= 2) ? (size_t)(atoi(argv[1])) : 1000; std::cout << "Generating " << num_points << " random points..." << std::endl; const auto seed = std::chrono::high_resolution_clock::now().time_since_epoch().count(); std::mt19937_64 prng(seed); std::uniform_real_distribution<double> dist(0.0, 10.0); EigenHelpers::VectorVector3d random_points(num_points); std::vector<size_t> indices(num_points); for (size_t idx = 0; idx < num_points; idx++) { const double x = dist(prng); const double y = dist(prng); random_points[idx] = Eigen::Vector3d(x, y, 0.0); indices[idx] = idx; } std::cout << "Clustering " << num_points << " points..." << std::endl; std::function<double(const Eigen::Vector3d&, const Eigen::Vector3d&)> distance_fn = [](const Eigen::Vector3d& v1, const Eigen::Vector3d& v2) { return EigenHelpers::Distance(v1, v2); }; const Eigen::MatrixXd distance_matrix = arc_helpers::BuildDistanceMatrixParallel(random_points, distance_fn); const std::vector<std::vector<size_t>> clusters = simple_hierarchical_clustering::SimpleHierarchicalClustering::Cluster( indices, distance_matrix, 1.0, simple_hierarchical_clustering::COMPLETE_LINK) .first; for (size_t cluster_idx = 0; cluster_idx < clusters.size(); cluster_idx++) { const std::vector<size_t>& current_cluster = clusters[cluster_idx]; const double cluster_num = 1.0 + (double)cluster_idx; for (size_t element_idx = 0; element_idx < current_cluster.size(); element_idx++) { const size_t index = current_cluster[element_idx]; random_points[index].z() = cluster_num; } } std::cout << "Saving to CSV..." << std::endl; const std::string log_file_name = (argc >= 3) ? std::string(argv[2]) : "/tmp/test_hierarchical_clustering.csv"; std::ofstream log_file(log_file_name, std::ios_base::out); if (!log_file.is_open()) { std::cerr << "\x1b[31;1m Unable to create folder/file to log to: " << log_file_name << "\x1b[0m \n"; throw std::invalid_argument("Log filename must be write-openable"); } for (size_t idx = 0; idx < num_points; idx++) { const Eigen::Vector3d& point = random_points[idx]; log_file << point.x() << "," << point.y() << "," << point.z() << std::endl; } log_file.close(); std::cout << "Done saving, you can import into matlab and draw with \"scatter3(x, y, z, 50, z, '.')\"" << std::endl; return 0; }
46.746032
118
0.678778
7f44287e8409f1f4551d98d3be52f4d84c9775df
701
asm
Assembly
oeis/164/A164311.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/164/A164311.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/164/A164311.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A164311: a(n) = 12*a(n-1) - 33*a(n-2) for n > 1; a(0) = 4, a(1) = 27. ; Submitted by Jamie Morken(s1) ; 4,27,192,1413,10620,80811,619272,4764501,36738036,283627899,2191179600,16934434533,130904287596,1012015111563,7824339848088,60495579495477,467743738958820,3616570744155099,27963305544220128,216212831973523269,1671764900723015004,12926155353549912171,99945622518739450920,772784343557726309397,5975206579574313832404,46200595617486797778747,357225330283889216875632,2762084308029606275808933,21356575796986931152811340,165130127398866166732041291,1276794527485825272741721272 mov $1,1 mov $3,4 lpb $0 sub $0,1 mul $1,3 mov $2,$3 mul $3,6 add $3,$1 mul $1,2 add $1,$2 lpe mov $0,$3
41.235294
476
0.793153
3539e33e3673284aff0c9fc054e1c62e0fa691d9
797
swift
Swift
Rocket.Chat/Views/Cells/Chat/ChatMessageAttachmentView.swift
VladimirBabiy/Rocket.Chat.iOS
3bcbdb42cde51bc90905ebbc051616b5020fcc38
[ "MIT" ]
1
2018-03-12T03:46:29.000Z
2018-03-12T03:46:29.000Z
Rocket.Chat/Views/Cells/Chat/ChatMessageAttachmentView.swift
VladimirBabiy/Rocket.Chat.iOS
3bcbdb42cde51bc90905ebbc051616b5020fcc38
[ "MIT" ]
null
null
null
Rocket.Chat/Views/Cells/Chat/ChatMessageAttachmentView.swift
VladimirBabiy/Rocket.Chat.iOS
3bcbdb42cde51bc90905ebbc051616b5020fcc38
[ "MIT" ]
null
null
null
// // ChatMessageAttachmentView.swift // Rocket.Chat // // Created by Luca Justin Zimmermann on 01/02/18. // Copyright © 2018 Rocket.Chat. All rights reserved. // class ChatMessageAttachmentView: UIView { class var defaultHeight: CGFloat { return 0 } static func heightFor(withText description: String?) -> CGFloat { guard let text = description, !text.isEmpty else { return self.defaultHeight } let attributedString = NSMutableAttributedString(string: text, attributes: [NSAttributedStringKey.font: UIFont.systemFont(ofSize: 14.0)]) let labelWidth = UIScreen.main.bounds.size.width - 55 let height = attributedString.heightForView(withWidth: labelWidth) return self.defaultHeight + (height ?? -1) + 1 } }
31.88
145
0.68256
2c6711884bcb1fbbc60a02a02db113f3442f39ee
645
py
Python
operations/functions/normalize_segmentation.py
zylamarek/dataset-tools
d0f446a6da20b7394bab86bf2253de866dbfc7be
[ "MIT" ]
null
null
null
operations/functions/normalize_segmentation.py
zylamarek/dataset-tools
d0f446a6da20b7394bab86bf2253de866dbfc7be
[ "MIT" ]
6
2021-03-19T01:18:16.000Z
2022-03-11T23:49:18.000Z
operations/functions/normalize_segmentation.py
zylamarek/dataset-tools
d0f446a6da20b7394bab86bf2253de866dbfc7be
[ "MIT" ]
null
null
null
from PIL import Image import numpy as np from .function import Function class NormalizeSegmentation(Function): def __init__(self, n_categories, *args, **kwargs): self.n_categories = int(n_categories) super(NormalizeSegmentation, self).__init__(do_analysis=False, *args, **kwargs) def apply_single(self, img, path, meta): image = Image.fromarray(img, mode='RGB') new_image = Image.eval(image, lambda x: x / (self.n_categories - 1.) * 255) img = np.asarray(new_image) return img def name(self): return super(NormalizeSegmentation, self).name() + ('_%d' % self.n_categories)
32.25
87
0.672868
24b6991b0d1f7681f458f3e6f3218903a4811fd9
1,202
php
PHP
resources/views/parqueadero/listar.blade.php
Paula717/Sprint-1--Parqueadero-capshi
1e9549599d8458c2fc54759319bb39413db67c8f
[ "MIT" ]
2
2021-02-14T19:09:28.000Z
2021-02-14T19:13:43.000Z
resources/views/parqueadero/listar.blade.php
Paula717/Sprint-1--Parqueadero-capshi
1e9549599d8458c2fc54759319bb39413db67c8f
[ "MIT" ]
null
null
null
resources/views/parqueadero/listar.blade.php
Paula717/Sprint-1--Parqueadero-capshi
1e9549599d8458c2fc54759319bb39413db67c8f
[ "MIT" ]
null
null
null
@extends('layout.master') @section('content') <h2><font color="black"><center>Listado de Clientes </center></font></h2> <div class="card-tittle"> </br><h2><center>Listado de Clientes</center></h2> </div> <br> <div class ="container"> <div class ="row"> @foreach($clientes as $p ) <div class="card mb-3" style="max-width: 540px;"> <div class="col-md-25"> <div class="card-body"> <h6 class="card-tittle">{{$p->nombre}}</h6> <p class="card-text" aling="justify"> Celuda: {{$p->cedula}}</p> <p class="card-text" aling="justify"> Celular: {{$p->celular}}</p> <p class="card-text" aling="justify"> Domicilio: {{$p->direccion}}</p> <p class="card-text" aling="justify"> correo: {{$p->correo}}</p> <br> </div> </div> </div> @endforeach </div> </div> @stop
37.5625
102
0.396839
d0a2463f0d982a1d4d8d8dbacb94b42da77542bd
791
lua
Lua
Modules/Shared/IK/Arm/FABRIKElbowConstraint.lua
Cuyler36/NevermoreEngine
863c1b673d0986819b0228f324fb8e18e616c8c9
[ "MIT" ]
null
null
null
Modules/Shared/IK/Arm/FABRIKElbowConstraint.lua
Cuyler36/NevermoreEngine
863c1b673d0986819b0228f324fb8e18e616c8c9
[ "MIT" ]
null
null
null
Modules/Shared/IK/Arm/FABRIKElbowConstraint.lua
Cuyler36/NevermoreEngine
863c1b673d0986819b0228f324fb8e18e616c8c9
[ "MIT" ]
null
null
null
--- -- @classmod FABRIKElbowConstraint -- @author Quenty local FABRIKElbowConstraint = {} FABRIKElbowConstraint.ClassName = "FABRIKElbowConstraint" FABRIKElbowConstraint.__index = FABRIKElbowConstraint function FABRIKElbowConstraint.new() local self = setmetatable({}, FABRIKElbowConstraint) return self end function FABRIKElbowConstraint:Constrain(lpoint, length) local unitlpoint = lpoint.unit local px, py, pz = unitlpoint.x, unitlpoint.y, unitlpoint.z -- -- disallow lateral movement -- if px < 0 then -- px = px * 0.2 -- if px < 0.1 then -- px = 0.05 -- end -- else -- px = px * 0.25 -- end -- if py < 0 then -- py = py * 0.5 -- elseif py <= 0.25 then -- py = py + 0.1 -- end return Vector3.new(px, py, pz).unit*length end return FABRIKElbowConstraint
20.815789
60
0.687737
2486fa5dbc54f4bacb30152633f0df762fd1b572
1,098
rs
Rust
examples/sender-udp.rs
mkindahl/tokio-examples
8a391bbe3c3935cc4a82e642fd7d83f2b528e382
[ "Apache-2.0" ]
2
2020-09-22T07:21:36.000Z
2021-01-24T12:26:27.000Z
examples/sender-udp.rs
mkindahl/tokio-examples
8a391bbe3c3935cc4a82e642fd7d83f2b528e382
[ "Apache-2.0" ]
null
null
null
examples/sender-udp.rs
mkindahl/tokio-examples
8a391bbe3c3935cc4a82e642fd7d83f2b528e382
[ "Apache-2.0" ]
null
null
null
// Copyright 2020 Mats Kindahl // // 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 // // https://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. use std::env; use std::error::Error; use std::net::SocketAddr; use tokio::net::UdpSocket; #[tokio::main] pub async fn main() -> Result<(), Box<dyn Error>> { let message = env::args() .nth(1) .unwrap_or_else(|| "hello world".to_string()); let addr: SocketAddr = "127.0.0.1:6142".parse()?; let mut socket = UdpSocket::bind("0.0.0.0:0").await?; let result = socket.send_to(message.as_bytes(), &addr).await?; println!("wrote to stream: result={:?}", result); Ok(()) }
35.419355
70
0.679417
a431e7ae36201ebecd40ee285b6b33ed4b0eab7d
470
php
PHP
framework/php/auto/load_html.php
davidosborn/portfolio-old
a8ce077726f6beee5de712fb52637622d79eb03b
[ "MIT" ]
null
null
null
framework/php/auto/load_html.php
davidosborn/portfolio-old
a8ce077726f6beee5de712fb52637622d79eb03b
[ "MIT" ]
null
null
null
framework/php/auto/load_html.php
davidosborn/portfolio-old
a8ce077726f6beee5de712fb52637622d79eb03b
[ "MIT" ]
null
null
null
<?php include_once 'file.php'; // resolve_file /** * Includes an external HTML file, if it exists. * * @return TRUE if the file was included. */ function load_html_if_exists($file) { $file = resolve_file($file, HTML_EXTENSIONS); if ($file === FALSE) return FALSE; include SITE_ROOT_DIR . '/' . $file; return TRUE; } /** * Includes an external HTML file. */ function load_html($file) { if (!load_html_if_exists($file)) die("File not found: $file"); } ?>
17.407407
48
0.665957
91dde396a0e145426f86cf550d3afbc8a3c654d2
59,419
html
HTML
images/2019-12-30/https_www.bromsgrove.gov.uk_council_policy-and-strategy_planning-policies_brownfield-land-register.aspx.png.html
digital-land/brownfield-land-screenshots
97de203a6bc91a9d915f21bbcdd741fe30705e45
[ "MIT" ]
null
null
null
images/2019-12-30/https_www.bromsgrove.gov.uk_council_policy-and-strategy_planning-policies_brownfield-land-register.aspx.png.html
digital-land/brownfield-land-screenshots
97de203a6bc91a9d915f21bbcdd741fe30705e45
[ "MIT" ]
null
null
null
images/2019-12-30/https_www.bromsgrove.gov.uk_council_policy-and-strategy_planning-policies_brownfield-land-register.aspx.png.html
digital-land/brownfield-land-screenshots
97de203a6bc91a9d915f21bbcdd741fe30705e45
[ "MIT" ]
null
null
null
<!DOCTYPE html><html lang="en" style="height: 100%;"><head><script type="text/javascript" src="https://static.quantcast.mgr.consensu.org/v27/cmpui-banner.js" crossorigin="anonymous"></script> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="shortcut icon" href="/fav_icons/BDC_Favicon.ico" type="image/icon"> <link rel="icon" href="/fav_icons/BDC_Favicon.ico" type="image/icon"> <link rel="apple-touch-icon" href="/fav_icons/BDC_Icon57x57.png" type="image/icon"> <link rel="apple-touch-icon" sizes="72x72" href="/fav_icons/BDC_Icon72x72.png" type="image/icon"> <link rel="apple-touch-icon" sizes="114x114" href="/fav_icons/BDC_Icon114x114.png" type="image/icon"> <link rel="apple-touch-icon" sizes="144x144" href="/fav_icons/BDC_Icon144x144.png" type="image/icon"> <link rel="apple-touch-icon-precomposed" href="/fav_icons/BDC_Icon57x57.png"> <title> Brownfield Land Register - bromsgrove.gov.uk </title> <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="/css/bootstrap.css"> <!--[if lt IE 9]> <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script> <![endif]--> <link rel="stylesheet" href="/css/font-awesome.css"> <link rel="stylesheet" href="/css/icon-style.css"> <link rel="stylesheet" href="/css/zozo.tabs.core.css"> <link rel="stylesheet" href="/css/zozo.tabs.min.css"> <link rel="stylesheet" href="/css/bdc_xtra.css"> <link rel="stylesheet" href="/css/layout.css"> <link rel="stylesheet" href="/umbraco/plugins/umbracocontour/css/bdc-rbc_defaultform.css"> <link rel="stylesheet" href="/css//bdc_council.css"> <!--[if lte IE 8]> <link rel="stylesheet" href="/css/font-awesome-ie7.css" /> <link rel="stylesheet" href="/css/bdc_bootstrap-ie7.css" /> <link rel="stylesheet" href="/css/bdc_layout-ie7.css" /> <![endif]--> <link rel="stylesheet" href="/css/access.css"> <!-- eGov Meta Data : Mandatory --> <!-- this will make your html5 page invalid! --> <meta name="DC.Subject" content="Bromsgrove District Council, Bromsgrove Council, Bromsgrove, Council, Worcestershire , Brownfield Land Register, Brownfield, brown, housing"> <meta name="DC.Date" content="15 October 2019"> <meta name="DC.Creator" content="[email protected]"> <meta name="DC.Publisher" content="Bromsgrove District Council"> <meta name="DC.Title" content="Brownfield Land Register"> <!-- end eGov --> <meta content="index,follow" name="robots"> <meta name="language" content="en"> <meta name="eGMS.accessibility" scheme="WCAG" content="Double-A"> <meta name="description" content="A comprehensive list of all brownfield sites within the District that are suitable for housing."> <meta name="keywords" content="Bromsgrove District Council, Bromsgrove Council, Bromsgrove, Council, Worcestershire , Brownfield Land Register, Brownfield, brown, housing"> <link type="text/css" rel="stylesheet" charset="UTF-8" href="https://translate.googleapis.com/translate_static/css/translateelement.css"><script type="text/javascript" async="" src="https://www.google-analytics.com/analytics.js"></script><script src="https://quantcast.mgr.consensu.org/cmp.js" async="" type="text/javascript"></script><script type="text/javascript" charset="UTF-8" src="https://translate.googleapis.com/translate_static/js/element/main.js"></script><style type="text/css">.qc-cmp-button { background-color: #031a31 !important; border-color: #031a31 !important; } .qc-cmp-button:hover { background-color: transparent !important; border-color: #031a31 !important; } .qc-cmp-alt-action, .qc-cmp-link { color: #031a31 !important; } .qc-cmp-button.qc-cmp-secondary-button:hover { border-color: transparent !important; background-color: #031a31 !important; } .qc-cmp-button { color: #d6d7d8 !important; } .qc-cmp-button.qc-cmp-secondary-button { color: #1a1b1b !important; } .qc-cmp-button.qc-cmp-button.qc-cmp-secondary-button:hover { color: #ffffff !important; } .qc-cmp-button.qc-cmp-secondary-button { border-color: #6f767f !important; background-color: #6f767f !important; } .qc-cmp-ui, .qc-cmp-ui .qc-cmp-main-messaging, .qc-cmp-ui .qc-cmp-messaging, .qc-cmp-ui .qc-cmp-beta-messaging, .qc-cmp-ui .qc-cmp-title, .qc-cmp-ui .qc-cmp-sub-title, .qc-cmp-ui .qc-cmp-purpose-info, .qc-cmp-ui .qc-cmp-table, .qc-cmp-ui .qc-cmp-table-header, .qc-cmp-ui .qc-cmp-vendor-list, .qc-cmp-ui .qc-cmp-vendor-list-title { color: #091332 !important; } .qc-cmp-ui a, .qc-cmp-ui .qc-cmp-alt-action, .qc-cmp-toggle-status { color: #093a77 !important; } .qc-cmp-ui { background-color: #d3d2d1 !important; } .qc-cmp-publisher-purposes-table .qc-cmp-table-header { background-color: #d3d2d1 !important; } .qc-cmp-publisher-purposes-table .qc-cmp-table-row { background-color: #d3d2d1 !important; } .qc-cmp-vendor-list .qc-cmp-vendor-row { background-color: #d3d2d1 !important; } .qc-cmp-vendor-list .qc-cmp-vendor-row-header { background-color: #d3d2d1 !important; } .qc-cmp-table { border: 1px solid #2c2d2e !important; } .qc-cmp-table-row { border-top: 1px solid #2c2d2e !important; } .qc-cmp-table-row:last-child { border-bottom: 1px solid #2c2d2e !important; } .qc-cmp-toggle-status { color: #2c2d2e !important; } .qc-cmp-arrow-down { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='#2c2d2e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E %3Cpolyline points='2 5 8 11 14 5'/%3E %3C/svg%3E") center no-repeat; } .qc-cmp-small-toggle.qc-cmp-toggle-on, .qc-cmp-toggle.qc-cmp-toggle-on { background-color: #093a77 !important; border-color: #093a77 !important; } </style><script type="text/javascript" charset="UTF-8" src="https://translate.googleapis.com/element/TE_20190916_00/e/js/element/element_main.js"></script><style type="text/css">.qc-cmp-ui-container{background:rgba(33,41,52,.85)!important;bottom:0!important;display:flex!important;left:0!important;opacity:0;overflow-y:scroll;position:fixed!important;right:0!important;top:0!important;transition:opacity .15s ease;visibility:hidden;will-change:visibility,opacity;z-index:2147483647!important;transition:background .6s;-webkit-transition:background .6s}.qc-cmp-alert-publisher-logo{height:50px;width:150px;padding:0}.qc-cmp-alert-main-messaging{padding-bottom:15px}.qc-cmp-ui-container.softOptIn{visibility:hidden;background:none}.softOptIn{overflow-y:hidden!important}.qc-cmp-ui.soft-opt-in-alert{display:flex;display:-webkit-flex;display:-ms-flexbox;visibility:visible;flex-direction:column;-ms-flex-direction:column;-webkit-flex-direction:column;justify-content:space-between;-webkit-justify-content:space-between;-ms-flex-pack:distribute;align-items:center;-webkit-align-items:center;-ms-flex-align:center;margin:auto;z-index:214748369!important;padding:60px 30px;text-align:center;overflow:hidden;top:0;width:100%;height:100%;max-width:770px;min-width:320px!important;max-height:340px!important;min-height:240px!important;box-shadow:0 1px 3px rgba(33,41,52,.75)}.soft-opt-in-alert .qc-cmp-publisher-logo{margin-top:0;margin:25px auto;padding-top:0}.soft-opt-in-alert .qc-cmp-main-messaging{margin:25px auto}.qc-cmp-ui{background-color:#368bd6;bottom:0;box-sizing:border-box;color:#fff;font-family:Arial,Verdana,sans-serif;justify-content:space-between;left:0;max-height:100vh;min-height:300px!important;opacity:0;overflow-x:hidden;overflow-y:scroll;position:fixed;right:0;visibility:hidden;will-change:visibility,opacity;-webkit-font-smoothing:antialiased}.qc-cmp-ui-content{display:flex;padding:60px;overflow-y:scroll}.qc-cmp-publisher-logo{display:block;margin:0 0 24px;max-height:90px;max-width:170px;width:auto}.qc-cmp-alert-publisher-logo-image{display:block;margin:auto;max-height:50px;width:100%;max-width:150px;box-sizing:content-box;width:auto}.qc-cmp-title{color:#fff;font-size:34px;font-weight:700;line-height:41px;margin:0 0 24px}.qc-cmp-main-messaging,.qc-cmp-messaging{font-size:14px;font-weight:400;line-height:21px;margin:0;-webkit-font-smoothing:antialiased}.qc-cmp-messaging{margin-bottom:20px}.qc-cmp-buttons{display:flex!important;align-content:center;flex-direction:column;justify-content:center;padding-left:60px}.qc-cmp-button{background-color:#fff;border:2px solid #fff;border-radius:3px;box-shadow:0 1px 1px 0 rgba(0,0,0,.2);box-sizing:border-box;color:#368bd6;cursor:pointer!important;font-family:Arial,sans-serif;font-size:14px;font-weight:600;height:55px!important;letter-spacing:2px;line-height:34px;margin:0 0 15px;padding:0 13px;text-align:center;text-decoration:none;text-transform:uppercase;transition:all .2s ease-in-out;white-space:nowrap;-webkit-font-smoothing:antialiased}.qc-cmp-button:hover{background-color:#1e4b73;color:#fff}.qc-cmp-button.qc-cmp-secondary-button{background-color:#eee;color:#999;border-color:transparent}.qc-cmp-button.qc-cmp-secondary-button:hover{background-color:#fff;color:#368bd6}.qc-cmp-buttons .qc-cmp-button{min-width:315px!important}.qc-cmp-alt-action,.qc-cmp-alt-action:not([href]):not([tabindex]){color:#fff;cursor:pointer;text-align:center;text-decoration:underline;font-size:14px;line-height:21px;margin:0 15px}.qc-cmp-alt-action:hover{opacity:.6}.qc-cmp-alt-buttons{align-self:center;margin:30px 0 0;line-height:normal}.qc-cmp-alt-buttons .qc-cmp-alt-action{margin:0}.qc-cmp-alt-buttons .qc-cmp-alt-action+.qc-cmp-alt-action{padding-left:20px;margin-left:20px;border-left:1px solid #fff}.qc-cmp-consent-content{padding:60px 60px 0}.qc-cmp-qc-link-container{position:absolute;bottom:0;right:0;font-size:10px!important;display:flex;align-items:center;padding:0 30px 30px 0}.qc-cmp-qc-link{margin-left:5px}.qc-cmp-qc-link #qcLogo{width:70px}.qc-cmp-link-text{margin:1em 0}.qc-cmp-back{font-weight:600;left:65px;position:absolute;text-align:left;text-decoration:none;top:25px}.qc-cmp-back:before{content:"";display:inline-block;position:relative;top:1px;right:6px;width:12px;height:12px;background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 5l6 6 6-6'/%3E%3C/svg%3E") 50% no-repeat;transform:rotate(90deg)}.qc-cmp-purposes-header{display:flex;justify-content:space-between}.qc-cmp-bold-messaging{margin:10px 0 20px;font-size:14px;font-weight:700;line-height:normal}.qc-cmp-button-small{flex:0 1 auto;height:40px!important;font-size:12px}.qc-cmp-google-purposes-table,.qc-cmp-vendors-purposes-table{border-bottom:1px solid #fff;margin-bottom:20px}.qc-cmp-purpose-row{border:1px solid #fff;border-bottom:none;padding:10px 20px;position:relative}.qc-cmp-purpose-info{position:relative}.qc-cmp-purpose-description{margin:10px 0;width:calc(100% - 200px);line-height:normal}.qc-cmp-purpose-actions{align-items:center;bottom:20px;display:flex;position:absolute;right:0;top:20px}.qc-cmp-show-vendors-link{font-size:12px}.qc-cmp-show-google-vendors-link{font-size:12px;text-decoration:none}.qc-cmp-toggler{display:inline-block;margin:0 0 0 20px;width:60px}.qc-cmp-toggle{background-color:#1e4b73;border:1px solid #1e4b73;border-radius:11px;cursor:pointer;display:block;height:16px;margin:0 auto;position:relative;width:34px}.qc-cmp-toggle-off{background-color:#368bd6}.qc-cmp-toggle-switch{background-color:#fff;border-radius:50%;display:inline-block;height:16px;position:absolute;right:18px;top:0;transition:all .1s ease-in-out 0ms;width:16px}.qc-cmp-toggle-on .qc-cmp-toggle-switch{right:0}.qc-cmp-toggle-status{color:#fff;font-family:Arial,Verdana,sans-serif;font-size:12px;font-weight:700;opacity:.8;margin:0;padding:6px 0 0;text-align:center}.qc-cmp-scrolling-section{border-bottom:1px solid hsla(0,0%,100%,.3);border-top:1px solid hsla(0,0%,100%,.3);height:calc(100vh - 400px);max-height:1000px;min-height:200px!important;overflow-y:scroll}.qc-cmp-scrolling-section table:first-child{border-top:none}.qc-cmp-nav-bar{display:flex;width:100%;justify-content:flex-end}.qc-cmp-table{border:1px solid hsla(0,0%,100%,.3);border-collapse:collapse;color:#fff;font-family:Arial,Verdana,sans-serif;font-size:14px;width:100%;margin:0 0 20px}.qc-cmp-table tr{background:none}.qc-cmp-table-header{color:hsla(0,0%,100%,.8);font-size:14px;font-weight:700;line-height:30px;letter-spacing:1px;margin:0;padding:0 20px;text-align:left;text-transform:uppercase;border:none}.qc-cmp-table-row{border:none;border-top:1px solid hsla(0,0%,100%,.3);padding:10px 20px}.qc-cmp-table-row:last-child{border-bottom:1px solid hsla(0,0%,100%,.3)}.qc-cmp-publisher-purposes-table{margin-bottom:20px}.qc-cmp-purposes-vendor-list{margin:20px 0 10px}.qc-hide-table{display:none}.qc-cmp-company-cell{font-weight:700;line-height:45px;padding:0 20px}.qc-cmp-enabled-cell{text-align:right;padding:0 20px}.qc-cmp-nav-bar.qc-cmp-bottom{flex-wrap:wrap}.qc-cmp-left-nav-link{flex:1 1 auto;line-height:75px;position:relative;text-align:left;white-space:nowrap}.qc-cmp-cancel{flex:0 1 100px;line-height:75px}.qc-cmp-save-and-exit{flex:1 1 200px;margin:10px 0;max-width:265px}.qc-cmp-sub-title-container{display:flex;flex:0 0 auto}.qc-cmp-sub-title{flex:1 1 auto;font-family:Arial,Verdana,sans-serif;font-size:24px;font-weight:600;line-height:24px;margin:10px 20px 20px 0}.qc-cmp-horizontal-buttons{align-content:center;display:flex!important;flex:0 1 auto!important;flex-wrap:wrap!important;justify-content:center!important;margin:-7px 0 7px!important}.qc-cmp-horizontal-buttons .qc-cmp-button{flex:1 0 auto!important;max-width:300px!important;margin:7px 7px 0!important}.qc-cmp-vendor-row{height:45px!important}.qc-cmp-on-off-column{width:50px}.qc-cmp-on-off-column .qc-cmp-table-header{padding:0}.qc-cmp-dropdown-column{width:50px}.qc-cmp-arrow-down{width:16px;height:16px;margin:auto;background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23FFF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 5l6 6 6-6'/%3E%3C/svg%3E") 50% no-repeat}.qc-cmp-flip-up{transform:rotate(180deg)}.qc-cmp-vendor-info-content{padding:0 20px 15px;line-height:16px}.qc-cmp-bold{font-weight:700}.qc-cmp-vendor-info-list-title{font-weight:700;line-height:1.5;font-size:14px;margin:12px 0 0}.qc-cmp-vendor-info-list{line-height:1.5;list-style-type:none;margin:0;padding:0}@media screen and (max-width:850px){.qc-cmp-qc-link-container{padding:0 5px 5px 0}.qc-cmp-ui-content{flex-wrap:wrap}.qc-cmp-initial-info{width:100%}.qc-cmp-buttons{width:100%;padding:60px 0 0}.qc-cmp-buttons .qc-cmp-button{width:100%}.qc-cmp-consent-content{padding:60px 30px 0}.qc-cmp-back{left:35px}}.qc-cmp-ui-showing{overflow:hidden}.qc-cmp-showing{opacity:1;visibility:visible}.qc-cmp-hidden{display:none}.qc-cmp-close-icon{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M.5.5l23 23m0-23l-23 23' fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10'/%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3C/svg%3E") 50% no-repeat;border:none;height:38px;outline:none;position:absolute;top:17px;right:24px;width:38px}.qc-cmp-close-icon-first-view{right:20px;position:absolute;top:20px}.qc-cmp-close-icon:hover{cursor:pointer}</style></head> <body style="position: relative; min-height: 100%; top: 0px;" class="qc-cmp-ui-showing" bgcolor="white"><div class="qc-cmp-ui-container qc-cmp-showing"><div class="qc-cmp-ui qc-cmp-showing" id="qcCmpUi"><div class="qc-cmp-ui-content"> <div class="qc-cmp-initial-info"> <img class="qc-cmp-publisher-logo qc-cmp-hidden" src="" alt="CAN Advertising logo" onerror="window.__cmpui(&quot;hideLogo&quot;,event)"> <p class="qc-cmp-title"> We value your privacy </p> <p class="qc-cmp-main-messaging"> We and our partners use technologies, such as cookies, and process personal data, such as IP addresses and cookie identifiers, to personalise ads and content based on your interests, measure the performance of ads and content, and derive insights about the audiences who saw ads and content. Click below to consent to the use of this technology and the processing of your personal data for these purposes. You can change your mind and change your consent choices at any time by returning to this site. </p> <div class="qc-cmp-alt-buttons"></div> </div> <div class="qc-cmp-buttons" id="qcCmpButtons"><button class="qc-cmp-button qc-cmp-secondary-button">I DO NOT ACCEPT</button> <button class="qc-cmp-button" onclick="window.__cmpui(&quot;setAndSaveAllConsent&quot;,!0)"> I ACCEPT </button> <a id="qc-cmp-purpose-button" class="qc-cmp-alt-action" onclick="window.__cmpui(&quot;updateConsentUi&quot;,2)"> Show Purposes </a> <a id="qc-cmp-vendor-button" class="qc-cmp-alt-action" onclick="window.__cmpui(&quot;updateConsentUi&quot;,3)"> See Vendors </a> </div> <div class="qc-cmp-qc-link-container" style="display:flex!important"> <p class="qc-cmp-link-text" style="color: rgb(0, 0, 0);"> Powered by </p> <a class="qc-cmp-qc-link" target="_blank"> <img id="qcLogo" alt="Quantcast - GDPR Consent Solution" style="border-style:none" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKQAAAAgCAYAAACclNOPAAAABGdBTUEAALGPC/xhBQAADHBJREFUeAHtmgmwllUZgBEJN0RFc0eQFB1XMgQVkJuOW1qjWbllc0tHrWk0oVyy1MoMMsW1RctmHNOMtFIzDUx0chfRcmdzRdyRcAvEnuf6H+bwcr7//+/l6jjd+8489zvnPe853/ne8573nHthxR4dlxU73rW7Z7cHyh5YoaxeRrsamuEwEraFDUDdQpgHs+AeuBVmQrd0e+AD8UBfRh0LD8N7TTAfm4kwArql2wOd6oEWRnsQmgnEaPMO/SaAWbSrS08c0KeA+q4ky+WHVjz1BsRAa299MmOsC11ZNuXjH4XZGTMobwFdSQbysSU/bNnICV/EwLthveBbRPsCeKuBnWPcAqtDVxUD778Q/bldF3PI4Ao/bJ/7IR4bW9H4S+iVG2Vlf2k5CnYEf7kZAnvDefASlKQF5bhSQxfRGYhu4Fysq+9K0m4/+GecGyDuZOtvwjFQ7089m9F+E5T6uwC7Q1cUM4P+y/3iCeSG7kqyOR9b8kPlSbEXHRZD7jjLOu9QaEa8vE+BOIZ19fUCmuZOF3+p2hAGwSawFjT7py5MK8VxHW8grAn1ZGMaSwvhBm5WfJ/j+B3rQ2/oiKxKJ/9kl/yxNuV4SjYzruNsVBvHefnXmEaifckPBuoSyY/mo9GWFutS9Fcs6VG/4L3Sce6CuFAj0Q2DO0GHngg6JJdfUfHiG+WrKJa6a1C/HiZHQ+rrgffgz8CW4DxWBjeW83sWboera08eS4lzjBtQ+4kwGMaA2d73uJivwTS4ACZBklEU3OT94GNJWXva7wR4EV6Ci2AR5KKP9oeDYAjoK3VvwFzQj5fDbVBP3IQHwn6wNTifVcD36Y85cC/oj5vB5FESv+EA+BK4Fs5Hv3o/fh2egBvhSnDMJI388B0M9cPLoA/bxOjVsTGz+XfF9uzktsH4cX5hLMc+q2ZgJn2+YKPTSnItyji37xcMD0P3VME29rX+LvwOPg65HEkl2l+IbjQYCLEt1V3gMZDkFAqprd7zSexWSp1qTwNnCtTrZ5vfcAmsDiXRn49Do3FSu34eUBhoELqbmxznGezyDd2sH56mnxuuTdyJaVL50wl2RHamkwuUj2X5bjA7mPJnQWzfB11JJqKMticFw6OoLy7YxX6xfit93CBJWilEG7OQuz7qY91sMRwUM2BsL9UfwS4PSO9ULk7Jtkp3HfZmvVzMim9DVZ8q/YP0MfsnccP+C6rsS3rX/uDaAM364THsexscikdCSVysjshDdHqu0HEQOlO9gdOZshWDnQ0rhEENkKkwCR4AM0qUXVEcHZWhPoq6d69G4rGWxrLcjOSB5F3sMujfTMfMxkz47ay+MWWzeh7oNvv9+kF/6Jd3IIobwmM0yVgK26ZK7alf7wPHcUNF8XeFn8HqkGIs2sR67ocev6W1FOn7xl7tqN9WGHMhOoPH1NyZGfKCwrvc1cMgOaQX5RaYAfFb70KX7FoL7cn+Ktr2gJ3gh1DKQI+i9/s+DeeAvvW70xg+DYzL4Gw4EZybUpVNPHZPBYP9YngT8vEsew9Lme2UQvtsdM4pvcvvHQoGaBxrOjrvh2I5b3+Wuhs0+UubVijN6TD0I0A/XAoLIR8r98NJtBnIbfInfuaGqexgHZU/0zGNkz91gtmjswLSxZ9ZeFcLupLsj3Ix5HPSyWYnpRXytlS+wsYg51FP7en5MroUGJr3h7hYLsxmNmbiNcZjK42Tnv9Gt35mZ/EIcDGTTXoeaiPiBku69DyorWXZH66xGS/Z+fSXFE8E574A8rbrqZckXav0rXNzzAszQ7N2yQ+bZzZLdosvLEk8Aks2Vbq0g6raO0vve86FPtmAfriLUpI7UM6HNbJGd2a9I9ajbVxmn4rXUDg2VWpPj0mzRpKljqKk5Bn1Q9ANztpT8QwKc1Ol9ryc52lgwOQykoobx2z0l6xhEeWbsnpevJfKHBiQKV13fZICMWvq0ULlZPA9T0OKneMoT4CUBQ3IeZAkfm9R36umfTW1hqf3vY6IH1Tq62TdccsT6HE+Hpse2VXSmwYDxEDRKQOhvaLjHy90Mhv6TTGYO/J9OzBO7Oe6TIEobpBjIGbOmTXDi2OHrO5c9UeiH+UUVJlZ25H8Aoq5kGfz1aifCSeAPjGDez0ysKfBW9BhSQHp8VmSbVDmO61kU9KtiXLTQoMO9iPdfR+EGHQ7w2jwIu4x0Rc8DsVF0MYgbY+YUd3xUUoZJNo0Wx9UMHwO3SsFvaobKvS5Wj8PA/1hBjajujbJH25QfVHyR0/0Br5H8ckQxXGG10htz1CYBL+A+5KyPc8UkPdXdNoN/Y8r2uqp3e1x92o/HeaBDuls2Z8BT4GhnT3whzSev5FG8S7ncdsR2Z1OPwA3qMHVUTmLjqPA60AjMeC/BofA6fBTaJekiU6l14uFnrug266gb6RqxSAeP/a5GUrHg231pFGfb9D5amgUjB7vbggv3h81afSN7ZnvFzC+HkZAWuNSfzOg/qgX9K/R/jk4Fyw3I2be8XBwM8a5TcqQL6G8Eb6SN1L2iDsV/MAopnl3gLsiF+8oe+aKWtkj75qCPldVLYofWCWb0TAOouM9PrxueMd5AfzGV8Ej+xZYCz5KYjaM4hz158LYUKe+Lm3ng2uXiwlHfzwAz0Pyh3e+v4N+rBID8XiYAK5tC2wPm0BfqBL7/BHqBfxSfVNAqvw5mGp1QC4HUhkLZ+dKygbYbDgu6Kuqf6PBy289Kd1lnGPpPprG2ZtCPO5movPIeioZZc91KH8UM+SMbI6pOIDCxqCfo+yDYmhQTqHeDzYIeoNRfzwU9FZXhGb98TS2v65hnPieLWA3aIV4TRuMzg0yB5qSPCDvpsfv4fBCTzOhC+nT3ZLkPAoHwOikqHi6C3+Utb1HueSEIeivzewsjgI/ukoGFhruQFcKRk3d1TGA1X/Y8m544b3U1RkgSfpQ8Nj7SVLUnq7bWbB10JtQ1g46q2bFUjDaZsCvZyHI29T3hRPA9UriON8Es7YBKpPAE3Yy5DFleSWoJ0v5oWewPJn6k0FnVbuT4B4YDwah95PdYDo0Eh06NTPyY1/O6ql4JIVtUoWnDr8Q8o/MmtuKOibKVijikaXNRmCmL2Vi2z8sMegGhJd5tZgWdFYNCAMjyaoUzoAYjCaKm6B0d/8E+rUgitl0AqwRG2p112lXMOEkXKNhEMXAi++eh85rUpWU/LCMrRNwIHfF8mL0XwbxGoCq8n8EvUKbWfKvoJOr5uAGUQ6Hks0/0LdCC3wWzgSzZsn2efQps7QWbO5DF52Nqu2fQd8J9v+hPhCS9KfwOsT3eq+9EX4DaYMcVrCzn5tuCkyEhyGOZf0iUPaEUrsn4FFgEtkHToPHoGQ7H70nyWowq2AzB913YQ/wyvQ9UBfHcu2TmAxKfngRvX64FEpxgvr9F5VeEF/YqG5geySUZChK76GNxrBdB0W7FJAeNwZUbK+qL8LWoMnbP8iAXIV3zQjvy989kzazi2LG8NqUtzdTdqMlP/eh/Eg7x4j+tT4QFIO4mTlEG4NvWweoiX54AqJdqs+mbcn/9qn1WfKYRMmd5C8iyyMeBcdUDGDWGVfRlqvNdJfkilo5ZawXqH8LzCKNxGA8HqYFw55ZPY2bqYrZMbXnfdXFuvfnen9dMMMmeZfC0VDPPtmmp5vpUHi2pljA81jw2YycjtEtwTD/Bn0/PrQ3qhqMR4DXkCTt8UPqs8zTiX0evJv4gSmaq546NLY5uS2gJC7+WNCpsZ9137sujIE3AvbLZT8q90NpHHXef9NdbDLlfDyPpX6gfBnyNsv/hFKgbonea0Vu7wYZALmsScUgK81tNvqVcmPKveDr8DCU+qjznX8A51CSXVHeAVX9H6TtkFpHx8m/YS71AbW29DAObod6p5pr7bXik1CSen54ig69S04uDaRuMHiZ3Rr6g0eDWck733S4G3aEcyDKVSgOjsqsviHl0bAN9AU/7E4wIM1qfojkYiBol8vKVHYB5+GYbhAzh8EoOlPZAPIg0O45WAx+1zqQi/28wkTxzuN7cj8aAI7lvHNxc48Efej7e8N88Hi9Enx3lFVRfAp2gI3Aun1mgMHmHbCeGNg7ge90zZyn3zEV7G/WUtaDVdpK7/+o+gavFB7DzmlT8ARMMfAEZcd1c9cT/TACnJO+i35A1Xni4C68HxTZq/Ne0z3S/6sHjPjOFDPNbBgOZrBXa1juB9dBKROg7pZuDyx91HSmPzw682PMsU3Vb4KZs1u6PVD0wP8ARf3Y76F3EOQAAAAASUVORK5CYII=" class="logo-black"> </a> </div> </div> </div></div> <nav> <a tabindex="1" id="Skip to content Brownfield Land Register" class="skiplinks" href="#main" alt="Skip to content" aria-label="Skip to content">Skip to content</a> </nav> <div class="container" aria-label="Out of date browser warning"> <!--[if lte IE 8]> <div class="row"> <div class="col-sm-12 browser"> This Site is best viewed in the latest browser, please select a browser. <BR /> <ul style="text-align: center;"> <li><img src="/css/images/Chrome.png" alt="Google Chrome Logo" width="50px"/><br /> <a href="https://www.google.com/chrome/browser/" target="_blank"><strong>Download Google Chrome</strong></a></li> <li><img src="/css/images/mozilla.png" alt="Firefox Logo" width="50px"/><br /> <a href="http://www.mozilla.com/en-US/firefox/new/" target="_blank"><strong>Download Mozilla Firefox</strong></a></li> <li><img src="/css/images/Opera.png" alt="Opera Logo" width="50px"/><br /> <a href="http://www.opera.com/" target="_blank"><strong>Download Opera</strong></a></li> <li><img src="/css/images/ie.png" alt="IE Logo" width="50px"/><br /> <a href="http://windows.microsoft.com/en-us/internet-explorer/products/ie/home" target="_blank"><strong>Download Internet Explorer</strong></a></li> </ul> </div> </div> <![endif]--> </div> <div class="container"> <div class="row"> <div class="col-sm-3 sitename"> <header><a tabindex="1" alt="Site title and home page link" title="Welcome to bromsgrove.gov.uk" href="/">bromsgrove.gov.uk</a></header> </div> <div class="col-lg-5 sitename"> <ul class="nav nav-tabs" role="navigation" aria-label="Links to all 4 areas of the website"> <li class="active-resident"> <a tabindex="2" class="" href="/" title="Residents" alt="Link to Residents Section Pages" aria-label="Link to Residents Section Pages">Residents</a> </li> <li class="active-business"> <a tabindex="3" class="business.aspx" href="/business.aspx" title="Business" alt="Link to Business Section Pages" aria-label="Link to Business Section Pages">Business</a> </li> <li class="active-council"> <a tabindex="4" class="council.aspx" href="/council.aspx" title="Council" alt="Link to Council Section Pages" aria-label="Link to Council Section Pages">Council</a> </li> <li class="active-visit"> <a tabindex="5" class="things-to-do.aspx" href="/things-to-do.aspx" title="Link to Things to do" alt="Things to do Section Pages" aria-label="Things to do Section Pages">Things to do</a> </li> </ul> </div> <div class="col-sm-3 sitename pull-right"> <div class="search-box"> <form class="form-search" method="get" action="/search" role="search"> <input type="text" class="input-medium search-query" name="q" placeholder="Search" title="type search text and press enter" aria-label="type search text and press enter" tabindex="6"> <button title="Press GO to search" tabindex="6" value="Search" type="submit" aria-label="Press GO to search">GO</button> </form> </div> </div> </div> </div> <div class="container"> <div class="row"> <div class="col-lg-12"> <div class="visible-lg visible-md"> <ul class="nav nav-pills mega-menu"> <li class="mega-item"> <a tabindex="7" alt="Corporate dropdown menu" href="/council/corporate.aspx">Corporate</a> <div class="menu-drop"> <ul> <li> <a href="/council/corporate/council-organisation.aspx">Council Organisation</a> </li> <li> <a href="/council/corporate/the-council-plan.aspx">The Council Plan</a> </li> <li> <a href="/council/corporate/we-want-your-feedback.aspx">We want your feedback</a> </li> <li> <a href="/council/corporate/your-access-to-information.aspx">Your Access to Information</a> </li> <li> <a href="/council/corporate/better-bromsgrove-together.aspx">Better Bromsgrove Together</a> </li> <li> <a href="/council/corporate/internal-audit.aspx">Internal Audit</a> </li> <li> <a href="/council/corporate/bromsgrove-extra.aspx">Bromsgrove Extra </a> </li> <li> <a href="/council/corporate/corporate-peer-challenge-feedback.aspx">Corporate Peer Challenge feedback</a> </li> </ul> </div> </li> <li class="mega-item"> <a tabindex="7" alt="Elections dropdown menu" href="/council/elections.aspx">Elections</a> <div class="menu-drop"> <ul> <li> <a href="/council/elections/current-elections.aspx">Current elections and referendums</a> </li> <li> <a href="/council/elections/previous-election-results.aspx">Previous Election Results</a> </li> <li> <a href="/council/elections/electoral-register.aspx">Electoral register</a> </li> <li> <a href="/council/elections/voting.aspx">Voting</a> </li> <li> <a href="/council/elections/polling-districts,-places-stations-review-2019.aspx">Polling Districts, Places &amp; Stations Review 2019</a> </li> <li> <a href="/council/elections/annual-canvass-2019.aspx">Annual canvass 2019</a> </li> <li> <a href="/council/elections/community-governance-review-2014.aspx">Community Governance Review 2014</a> </li> <li> <a href="/council/elections/other-information.aspx">Other Information</a> </li> <li> <a href="/council/elections/elections-staffing-and-recruitment.aspx">Elections Staffing and Recruitment</a> </li> </ul> </div> </li> <li class="mega-item"> <a tabindex="7" alt="Finance dropdown menu" href="/council/finance.aspx">Finance</a> <div class="menu-drop"> <ul> <li> <a href="/council/finance/community-right-to-bid.aspx">Community Right to Bid</a> </li> <li> <a href="/council/finance/council-budgets-and-spending.aspx">Council budgets and spending</a> </li> <li> <a href="/council/finance/council-tax.aspx">Council Tax</a> </li> <li> <a href="/council/finance/housing-and-council-tax-benefits.aspx">Housing and Council Tax Benefits</a> </li> <li> <a href="/council/finance/make-an-online-payment.aspx">Make an online payment</a> </li> <li> <a href="/council/finance/non-domestic-rates-(br).aspx">Non-Domestic Rates (BR)</a> </li> <li> <a href="/council/finance/property-and-land-sales.aspx">Property and Land sales</a> </li> <li> <a href="/council/finance/supplier-payments-over-£500.aspx">Supplier Payments over £500</a> </li> <li> <a href="/council/finance/supplier-payments-over-£5000.aspx">Supplier Payments over £5000</a> </li> </ul> </div> </li> <li class="mega-item"> <a tabindex="7" alt="Policy and strategy dropdown menu" href="/council/policy-and-strategy.aspx">Policy and strategy</a> <div class="menu-drop"> <ul> <li> <a href="/council/policy-and-strategy/bromsgrove-partnership.aspx">Bromsgrove Partnership</a> </li> <li> <a href="/council/policy-and-strategy/consultations.aspx">Consultations</a> </li> <li> <a href="/council/policy-and-strategy/performance-strategy.aspx">Performance Strategy </a> </li> <li> <a href="/council/policy-and-strategy/council-tax-support-scheme.aspx">Council Tax Support Scheme</a> </li> <li> <a href="/council/policy-and-strategy/planning-policies.aspx">Planning Policies and Other Planning Information</a> </li> <li> <a href="/council/policy-and-strategy/business-begins-in-bromsgrove.aspx">Business Begins in Bromsgrove</a> </li> <li> <a href="/council/policy-and-strategy/private-sector-housing-policy.aspx">Private sector housing assistance policy</a> </li> <li> <a href="/council/policy-and-strategy/homelessness-strategy-for-worcestershire.aspx">Homelessness strategy for Worcestershire </a> </li> <li> <a href="/council/policy-and-strategy/the-worcestershire-housing-partnership-plan.aspx">The Worcestershire Housing Partnership Plan</a> </li> <li> <a href="/council/policy-and-strategy/customer-service-principles.aspx">Customer Service Principles</a> </li> <li> <a href="/council/policy-and-strategy/engagement-and-equalities.aspx">Engagement and Equalities</a> </li> </ul> </div> </li> <li class="mega-item"> <a tabindex="7" alt="The council dropdown menu" href="/council/the-council.aspx">The council</a> <div class="menu-drop"> <ul> <li> <a href="/council/the-council/your-councillors,-mp-and-meps.aspx">Your councillors, MP and MEPs</a> </li> <li> <a href="/council/the-council/meetings,-minutes-and-agendas.aspx">Meetings, minutes and agendas</a> </li> <li> <a href="/council/the-council/public-participation-at-meetings.aspx">Public Participation at meetings</a> </li> <li> <a href="/council/the-council/constitution-of-bromsgrove-district-council.aspx">Constitution of Bromsgrove District Council</a> </li> <li> <a href="/council/the-council/petitions.aspx">Petitions</a> </li> <li> <a href="/council/the-council/overview-and-scrutiny.aspx">Overview and Scrutiny</a> </li> <li> <a href="/council/the-council/cabinet-work-programme.aspx">Cabinet Work Programme</a> </li> <li> <a href="/council/the-council/parish-councils.aspx">Parish councils</a> </li> <li> <a href="/council/the-council/filming-and-recording-committee-meetings.aspx">Filming and Recording Committee Meetings</a> </li> </ul> </div> </li> </ul> </div> <ul class="breadcrumb"> <li><a href="/">Home</a></li> <li><a href="/council.aspx">Council</a></li> <li><a href="/council/policy-and-strategy.aspx">Policy and strategy</a></li> <li><a href="/council/policy-and-strategy/planning-policies.aspx">Planning Policies and Other Planning Information</a></li> <li class="active">Brownfield Land Register</li> </ul> </div> </div> </div> <div class="container"> <div class="row"> <div class="col-lg-12 hidden-xs"> <div class="leaderboard" alt=""> <div id="counciladvertising-leaderboard"></div> <script async="" src="//ads.counciladvertising.net/code/bromsgrovedc/leaderboard/public" data-can-ad=""></script> </div> </div> </div> <main id="main" aria-label="Top of main content on the page" title="Brownfield Land Register page"> <div class="container"> <div class="row"> <div class="col-lg-4 report pull-right"> <p><a href="/system/out-of-date.aspx?title=/council/policy-and-strategy/planning-policies/brownfield-land-register.aspx" title="report this page as being out of date" alt="report this page as being out of date">Report this page as out of date or incorrect</a></p> </div> </div> <div class="row"> <div class="col-lg-8"> <h1>Brownfield Land Register</h1> <p>The Government has introduced a requirement for all Local Planning Authorities (LPA’s) to publish a Brownfield land Register (BLR) by 31st December 2017. The BLR is a comprehensive list of all brownfield sites in a local authority area that are suitable for housing. The registers will help house builders identify suitable sites quickly, speeding up the construction of new homes.</p> <p>The Council will have the final say on which sites are on the register and which sites will have permission in principle.</p> <p>The BLR is compiled in two parts;</p> <p>Part 1 will include sites categorised as previously developed land which are suitable, available and achievable for residential development</p> <p>Part 2 will allow LPAs to select sites from Part 1 and grant permission in principle (PiP) for housing led development. There are currently no sites that have been put forward for Part 2.</p> <p>In order to be entered onto the Brownfield Land Register, sites must qualify as Previously Developed Land (PDL) (see Annex 2 of the National Planning Policy Framework) and be:</p> <ul> <li> <p>A minimum of 0.25 hectares or be capable of accommodating at least 5 dwellings</p> </li> <li> <p>Suitable for Residential- sites must be appropriate for residential use or a residential-led mixed use scheme, and must comply with national and local planning policies</p> </li> <li> <p>Available - there must be a demonstrable landowner/developer intention to sell or develop the site</p> </li> <li> <p>Achievable - sites must be developable within the next 15 years</p> </li> </ul> <p>The register can include sites allocated in the Local Plan or sites from other sources, regardless of whether they already have planning permission, provided they meet the criteria above.</p> <h2>What is Brownfield Land?</h2> <p>Brownfield (previously developed land) land is defined in Annex 2 of the National Planning Policy Framework 2012 as:</p> <p>"Land which is or was occupied by a permanent structure, including the curtilage of the developed land (although it should not be assumed that the whole of the curtilage should be developed) and any associated fixed surface infrastructure. This excludes land that is or has been occupied by agricultural or forestry buildings; land that has been developed for minerals extraction or waste disposal by landfill purposes where provision for restoration has been made through development control procedures; land in built-up areas such as private residential gardens, parks, recreation grounds and allotments; and land that was previously developed, but where the remains of the permanent structure have blended into the landscape in the process of time."</p> <p>If you would like to submit a site to the register that you think could be developed for housing, please send details of the location and availability of the site including an outline plan to the following e-mail address; <a title="email address Strategic Planning" href="mailto:[email protected]" class="email">[email protected]</a></p> </div> <div class="col-lg-4"> <div class="textboxtabs well"> <h2>Related Documents</h2> <ul class="folder"> <li class="folder_item"><a href="/media/4887964/bblr-2019.csv" alt="Click here to view BBLR 2019 document" title="Click here to view BBLR 2019 document" target="_blank" class="excel"> BBLR 2019</a></li> <li class="folder_item"><a href="/media/4891067/BBLR01.pdf" alt="Click here to view BBLR01 document" title="Click here to view BBLR01 document" target="_blank" class="pdf"> BBLR01</a></li> <li class="folder_item"><a href="/media/4891070/BBLR02.pdf" alt="Click here to view BBLR02 document" title="Click here to view BBLR02 document" target="_blank" class="pdf"> BBLR02</a></li> <li class="folder_item"><a href="/media/4891073/BBLR03.pdf" alt="Click here to view BBLR03 document" title="Click here to view BBLR03 document" target="_blank" class="pdf"> BBLR03</a></li> <li class="folder_item"><a href="/media/4891076/BBLR04.pdf" alt="Click here to view BBLR04 document" title="Click here to view BBLR04 document" target="_blank" class="pdf"> BBLR04</a></li> <li class="folder_item"><a href="/media/4891079/BBLR05.pdf" alt="Click here to view BBLR05 document" title="Click here to view BBLR05 document" target="_blank" class="pdf"> BBLR05</a></li> <li class="folder_item"><a href="/media/4891085/BBLR07.pdf" alt="Click here to view BBLR07 document" title="Click here to view BBLR07 document" target="_blank" class="pdf"> BBLR07</a></li> <li class="folder_item"><a href="/media/4891088/BBLR08.pdf" alt="Click here to view BBLR08 document" title="Click here to view BBLR08 document" target="_blank" class="pdf"> BBLR08</a></li> <li class="folder_item"><a href="/media/4891091/BBLR09.pdf" alt="Click here to view BBLR09 document" title="Click here to view BBLR09 document" target="_blank" class="pdf"> BBLR09</a></li> <li class="folder_item"><a href="/media/4891064/BBLR10.pdf" alt="Click here to view BBLR10 document" title="Click here to view BBLR10 document" target="_blank" class="pdf"> BBLR10</a></li> </ul> </div> <div class="textboxtabs well"> <h2>Need to contact us?</h2> <p><a title="Strategic Planning" href="/contacts/strategic-planning.aspx" target="_blank">You can find our contact details here</a></p> </div> <div class="textboxtabs well"> <h2><advert-text class="hidden">Advertisement</advert-text></h2> <div class="mpu"> <advert-text>advertisement</advert-text> <div id="counciladvertising-mpu" role="complementary" aria-label="2nd advertisement" alt="2nd advertisement" title="2nd advertisement"> <script async="" src="//ads.counciladvertising.net/code/bromsgrovedc/mpu/public" data-can-ad=""></script> </div> </div> </div> </div> </div> </div> <div> <div class="row"> </div> </div> <div class="row"> <div class="col-lg-12 inline"> <div id="divPageFeedback">Was this page useful?<br> <div id="divFeedbackStars"> <a id="aStar4" class="star" href="https://www.bromsgrove.gov.uk/system/fourstar.aspx?starrating=4&amp;url=https://www.bromsgrove.gov.uk/council/policy-and-strategy/planning-policies/brownfield-land-register.aspx" title="Submit Good Feedback"><span>4 Star Rating</span></a> <a id="aStar3" class="star" href="https://www.bromsgrove.gov.uk/system/threestar.aspx?starrating=3&amp;url=https://www.bromsgrove.gov.uk/council/policy-and-strategy/planning-policies/brownfield-land-register.aspx" title="Submit High Average Feedback"><span>3 Star Rating</span></a> <a id="aStar2" class="star" href="https://www.bromsgrove.gov.uk/system/twostar.aspx?starrating=2&amp;url=https://www.bromsgrove.gov.uk/council/policy-and-strategy/planning-policies/brownfield-land-register.aspx" title="Submit Low Average Feedback"><span>2 Star Rating</span></a> <a id="aStar1" class="star" href="https://www.bromsgrove.gov.uk/system/onestar.aspx?starrating=1&amp;url=https://www.bromsgrove.gov.uk/council/policy-and-strategy/planning-policies/brownfield-land-register.aspx" title="Submit Poor Feedback"><span>1 Star Rating</span></a> </div> </div> <div id="divSocialFeedback" class="share"> <a class="stop external" id="fbookbtn" href="https://www.facebook.com/sharer/sharer.php?u=http://www.bromsgrove.gov.uk/council/policy-and-strategy/planning-policies/brownfield-land-register.aspx" data-href="http://www.bromsgrove.gov.uk/council/policy-and-strategy/planning-policies/brownfield-land-register.aspx" target="_blank" title="Share on FaceBook" alt="Share on FaceBook" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"><em id="fbookbtn-icon" class="icon-facebook-sign icon-large"></em></a> <a class="stop external" id="twitbtn" target="_blank" href="https://twitter.com/share" data-url="http://www.bromsgrove.gov.uk/council/policy-and-strategy/planning-policies/brownfield-land-register.aspx" data-text="You should check out this page" data-related="" title="Share on Twitter"><em id="twitbtn-icon" class="icon-twitter-sign icon-large"></em></a> <script> window.addEventListener('canGdprConsent', function(e) { if (e.consent) { !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs'); } }); </script> <a class="stop external" id="linkedbtn" target="_blank" href="https://www.linkedin.com/shareArticle?url=http://www.bromsgrove.gov.uk/council/policy-and-strategy/planning-policies/brownfield-land-register.aspx &amp;title=" brownfield="" land="" register"="" title="Share on Linked In"><em id="linkedbtn-icon" class="icon-linkedin-sign icon-large"></em></a> <script> window.addEventListener('canGdprConsent', function(e) { if (e.consent) { var my_awesome_script = document.createElement('script'); my_awesome_script.setAttribute('src','https://apis.google.com/js/platform.js'); my_awesome_script.setAttribute('async',''); my_awesome_script.setAttribute('defer',''); document.body.appendChild( my_awesome_script ); } }); </script> <a href="#" id="printbtn" title="Print this page" alt="Print this page" onclick="window.print();return false"><em id="printbtn-icon" class="icon-print icon-large"></em></a> </div> <div class="translate" title="Google Translate" aria-label="Google Translate" role="complementary"> <div id="google_translate_element"><div class="skiptranslate goog-te-gadget" dir="ltr" style=""><div id=":0.targetLanguage" style="display: inline;"><select class="goog-te-combo" aria-label="Language Translate Widget"><option value="">Select Language</option><option value="af">Afrikaans</option><option value="sq">Albanian</option><option value="am">Amharic</option><option value="ar">Arabic</option><option value="hy">Armenian</option><option value="az">Azerbaijani</option><option value="eu">Basque</option><option value="be">Belarusian</option><option value="bn">Bengali</option><option value="bs">Bosnian</option><option value="bg">Bulgarian</option><option value="ca">Catalan</option><option value="ceb">Cebuano</option><option value="ny">Chichewa</option><option value="zh-CN">Chinese (Simplified)</option><option value="zh-TW">Chinese (Traditional)</option><option value="co">Corsican</option><option value="hr">Croatian</option><option value="cs">Czech</option><option value="da">Danish</option><option value="nl">Dutch</option><option value="eo">Esperanto</option><option value="et">Estonian</option><option value="tl">Filipino</option><option value="fi">Finnish</option><option value="fr">French</option><option value="fy">Frisian</option><option value="gl">Galician</option><option value="ka">Georgian</option><option value="de">German</option><option value="el">Greek</option><option value="gu">Gujarati</option><option value="ht">Haitian Creole</option><option value="ha">Hausa</option><option value="haw">Hawaiian</option><option value="iw">Hebrew</option><option value="hi">Hindi</option><option value="hmn">Hmong</option><option value="hu">Hungarian</option><option value="is">Icelandic</option><option value="ig">Igbo</option><option value="id">Indonesian</option><option value="ga">Irish</option><option value="it">Italian</option><option value="ja">Japanese</option><option value="jw">Javanese</option><option value="kn">Kannada</option><option value="kk">Kazakh</option><option value="km">Khmer</option><option value="ko">Korean</option><option value="ku">Kurdish (Kurmanji)</option><option value="ky">Kyrgyz</option><option value="lo">Lao</option><option value="la">Latin</option><option value="lv">Latvian</option><option value="lt">Lithuanian</option><option value="lb">Luxembourgish</option><option value="mk">Macedonian</option><option value="mg">Malagasy</option><option value="ms">Malay</option><option value="ml">Malayalam</option><option value="mt">Maltese</option><option value="mi">Maori</option><option value="mr">Marathi</option><option value="mn">Mongolian</option><option value="my">Myanmar (Burmese)</option><option value="ne">Nepali</option><option value="no">Norwegian</option><option value="ps">Pashto</option><option value="fa">Persian</option><option value="pl">Polish</option><option value="pt">Portuguese</option><option value="pa">Punjabi</option><option value="ro">Romanian</option><option value="ru">Russian</option><option value="sm">Samoan</option><option value="gd">Scots Gaelic</option><option value="sr">Serbian</option><option value="st">Sesotho</option><option value="sn">Shona</option><option value="sd">Sindhi</option><option value="si">Sinhala</option><option value="sk">Slovak</option><option value="sl">Slovenian</option><option value="so">Somali</option><option value="es">Spanish</option><option value="su">Sundanese</option><option value="sw">Swahili</option><option value="sv">Swedish</option><option value="tg">Tajik</option><option value="ta">Tamil</option><option value="te">Telugu</option><option value="th">Thai</option><option value="tr">Turkish</option><option value="uk">Ukrainian</option><option value="ur">Urdu</option><option value="uz">Uzbek</option><option value="vi">Vietnamese</option><option value="cy">Welsh</option><option value="xh">Xhosa</option><option value="yi">Yiddish</option><option value="yo">Yoruba</option><option value="zu">Zulu</option></select></div>&nbsp;&nbsp;Powered by <span style="white-space:nowrap"><a class="goog-logo-link" href="https://translate.google.com" target="_blank"><img src="https://www.gstatic.com/images/branding/googlelogo/1x/googlelogo_color_42x16dp.png" width="37px" height="14px" style="padding-right: 3px" alt="Google Translate">Translate</a></span></div></div> <script type="text/javascript"> function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL}, 'google_translate_element'); // begin accessibility compliance $('img.goog-te-gadget-icon').attr('alt','Google Translate'); $('div#goog-gt-tt div.logo img').attr('alt','translate'); $('div#goog-gt-tt .original-text').css('text-align','left'); $('.goog-te-gadget-simple .goog-te-menu-value span').css('color','#000000'); // end accessibility compliance } </script> <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"> </script> </div> </div> </div> <div class="row"> <div class="col-lg-12 inline"> </div> </div> </main></div> <div class="footer-atoz"> <div class="container"> <div class="row"> <div class="col-lg-3 hidden-xs hidden-sm" role="navigation" aria-label="Links for a to z of council services"> <az>a to z of services</az> </div> <div class="col-lg-9 azlist" aria-label="a to z of services" role="navigation"> <a href="/a-z/?letter=a" class="" title="Letter A" alt="Letter A" aria-label="Letter A">A</a> | <a href="/a-z/?letter=b" class="" title="Letter B" alt="Letter B" aria-label="Letter B">B</a> | <a href="/a-z/?letter=c" class="" title="Letter C" alt="Letter C" aria-label="Letter C">C</a> | <a href="/a-z/?letter=d" class="" title="Letter D" alt="Letter D" aria-label="Letter D">D</a> | <a href="/a-z/?letter=e" class="" title="Letter E" alt="Letter E" aria-label="Letter E">E</a> | <a href="/a-z/?letter=f" class="" title="Letter F" alt="Letter F" aria-label="Letter F">F</a> | <a href="/a-z/?letter=g" class="" title="Letter G" alt="Letter G" aria-label="Letter G">G</a> | <a href="/a-z/?letter=h" class="" title="Letter H" alt="Letter H" aria-label="Letter H">H</a> | <a href="/a-z/?letter=i" class="" title="Letter I" alt="Letter I" aria-label="Letter I">I</a> | <a href="/a-z/?letter=j" class="" title="Letter J" alt="Letter J" aria-label="Letter J">J</a> | <a href="/a-z/?letter=k" class="" title="Letter K" alt="Letter K" aria-label="Letter K">K</a> | <a href="/a-z/?letter=l" class="" title="Letter L" alt="Letter L" aria-label="Letter L">L</a> | <a href="/a-z/?letter=m" class="" title="Letter M" alt="Letter M" aria-label="Letter M">M</a> | <a href="/a-z/?letter=n" class="" title="Letter N" alt="Letter N" aria-label="Letter N">N</a> | <a href="/a-z/?letter=o" class="" title="Letter O" alt="Letter O" aria-label="Letter O">O</a> | <a href="/a-z/?letter=p" class="" title="Letter P" alt="Letter P" aria-label="Letter P">P</a> | <a href="/a-z/?letter=q" class="" title="Letter Q" alt="Letter Q" aria-label="Letter Q">Q</a> | <a href="/a-z/?letter=r" class="" title="Letter R" alt="Letter R" aria-label="Letter R">R</a> | <a href="/a-z/?letter=s" class="" title="Letter S" alt="Letter S" aria-label="Letter S">S</a> | <a href="/a-z/?letter=t" class="" title="Letter T" alt="Letter T" aria-label="Letter T">T</a> | <a href="/a-z/?letter=u" class="" title="Letter U" alt="Letter U" aria-label="Letter U">U</a> | <a href="/a-z/?letter=v" class="" title="Letter V" alt="Letter V" aria-label="Letter V">V</a> | <a href="/a-z/?letter=w" class="" title="Letter W" alt="Letter W" aria-label="Letter W">W</a> | <a href="/a-z/?letter=x" class="" title="Letter X" alt="Letter X" aria-label="Letter X">X</a> | <a href="/a-z/?letter=y" class="" title="Letter Y" alt="Letter Y" aria-label="Letter Y">Y</a> | <a href="/a-z/?letter=z" class="" title="Letter Z" alt="Letter Z" aria-label="Letter Z">Z</a> </div> </div> </div> </div> <div class="footer-bottom"> <div class="container"> <div class="row"> <div class="col-lg-12"> <div class="col-sm-6 footer-links" role="navigation" aria-label="Links to A to Z and regulatory pages"> <a href="/a-z/?letter=a" title="A TO Z" alt="Link to A TO Z" aria-label="Link to A TO Z">A-Z</a> | <a href="/site-map/" title="Site Map" alt="Link to Site Map" aria-label="Link to Site Map">Site map</a> | <a href="/contacts" title="Contact Us" alt="Link to Contact Us" aria-label="Link to Contact Us">Contact</a> | <a href="/accessibility/" title="Accessibility" alt="Link to Accessibility" aria-label="Link to Accessibility">Accessibility</a> | <a href="/legal/" title="Legal Notices" alt="Link to Legal Notices" aria-label="Link to Legal Notices">Legal</a> | <a href="/Advertising/" title="Advertising" alt="Link to Advertising" aria-label="Link to Advertising">Advertising</a> </div> <div class="col-sm-2 footer-social" aria-label="Social Media Area" role="navigation"> <a target="_blank" href="http://www.facebook.com/pages/Bromsgrove-District-Council/54505722010" title="FaceBook" class="external"><em class="icon-facebook-sign icon-large"></em></a> <a target="_blank" href="http://www.twitter.com/bromsgrovedc" title="Twitter" class="external"><em class="icon-twitter-sign icon-large"></em></a> <a target="_blank" href="http://www.youtube.com/user/RedditchBC" title="YouTube" class="external"><em class="icon-youtube icon-large"></em></a> <a target="_blank" href="/newsrss/" title="News Feed"><em class="icon-rss icon-large"></em></a> </div> <div class="col-sm-4 footer-tag hidden-xs hidden-sm" aria-label="footer tag line" role="complementary"> <a aria-label="Bromsgrove District Council" role="complementary">Bromsgrove District Council</a> </div> </div> </div> <div class="row"> <div class="col-lg-12 final_footer"> <p> <img src="/fav_icons/bromsgrove-logo-128x32.png" alt=""> Copyright Bromsgrove District Council</p> <br> <br> <br> </div> </div> </div> </div> <!-- scripts at the bottom --> <script src="/scripts/libs/jquery-1.10.2.min.js"></script><iframe name="__cmpLocator"></iframe> <script src="/scripts/libs/bootstrap.min.js"></script> <script src="/scripts/js/icon-style.js"></script> <script src="/scripts/js/jquery.min.js"></script> <script src="/scripts/js/zozo.tabs.min.js"></script> <script> jQuery(document).ready(function ($) { /* jQuery activation and setting options for first tabs, enabling multiline*/ $("#tabbed-nav").zozoTabs({ position: "top-compact", multiline: true, theme: "white", shadows: true, orientation: "horizontal", size: "medium", animation: { easing: "easeInOutExpo", duration: 500, effects: "slideH" } }); /* jQuery activation and setting options for second tabs, enabling multiline*/ $("#tabbed-nav2").zozoTabs({ position: "top-left", theme: "white", shadows: true, multiline: true, orientation: "vertical", size: "medium", animation: { easing: "easeInOutExpo", duration: 500, effects: "slideV" } }); $("#tabbed-nav3").zozoTabs({ theme: "blue", animation: { easing: "easeInOutExpo", duration: 800, effects: "slideH" } }); }); </script> <!-- mega menu --> <script src="/Scripts/libs/jquery.hoverIntent.minified.js"></script> <script src="/Scripts/ulgMegaMenu.js"></script> <script src="//ads.counciladvertising.net/code/bromsgrovedc/media/public"></script> <!-- Global site tag (gtag.js) - Google Analytics --> <script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-10198644-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-10198644-1'); </script><div id="goog-gt-tt" class="skiptranslate" dir="ltr"><div style="padding: 8px;"><div><div class="logo"><img src="https://www.gstatic.com/images/branding/product/1x/translate_24dp.png" width="20" height="20" alt="translate"></div></div></div><div class="top" style="padding: 8px; float: left; width: 100%;"><h1 class="title gray">Original text</h1></div><div class="middle" style="padding: 8px;"><div class="original-text" style="text-align: left;"></div></div><div class="bottom" style="padding: 8px;"><div class="activity-links"><span class="activity-link">Contribute a better translation</span><span class="activity-link"></span></div><div class="started-activity-container"><hr style="color: #CCC; background-color: #CCC; height: 1px; border: none;"><div class="activity-root"></div></div></div><div class="status-message" style="display: none;"></div></div> <div class="goog-te-spinner-pos"><div class="goog-te-spinner-animation"><svg xmlns="http://www.w3.org/2000/svg" class="goog-te-spinner" width="96px" height="96px" viewBox="0 0 66 66"><circle class="goog-te-spinner-path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle></svg></div></div></body></html>
71.848851
9,604
0.680792
c954b8dbf55d4c35ff14ea98ed36b55d3a00de39
49
ts
TypeScript
src/store/Unsubscriber.ts
ctx-core/svelte
01909e085196d04969f02a8dc296b0a0a1cf0749
[ "Apache-2.0" ]
1
2021-07-09T10:07:30.000Z
2021-07-09T10:07:30.000Z
src/store/Unsubscriber.ts
ctx-core/svelte
01909e085196d04969f02a8dc296b0a0a1cf0749
[ "Apache-2.0" ]
null
null
null
src/store/Unsubscriber.ts
ctx-core/svelte
01909e085196d04969f02a8dc296b0a0a1cf0749
[ "Apache-2.0" ]
null
null
null
export type { Unsubscriber } from 'svelte/store'
24.5
48
0.755102
f1e384211924e296aec2a3e47365b4230983ac64
798
rb
Ruby
lib/quake/log/entities/kill.rb
joffilyfe/quake-log-parser
3faf2eb340ad5aa3e146bf81487ad888eab2fc57
[ "MIT" ]
null
null
null
lib/quake/log/entities/kill.rb
joffilyfe/quake-log-parser
3faf2eb340ad5aa3e146bf81487ad888eab2fc57
[ "MIT" ]
null
null
null
lib/quake/log/entities/kill.rb
joffilyfe/quake-log-parser
3faf2eb340ad5aa3e146bf81487ad888eab2fc57
[ "MIT" ]
null
null
null
# frozen_string_literal: true module Quake module Log module Entities class Kill attr_reader :data def initialize(data) @data = data end def by_player? @data[:assassin] != '<world>' end def by_world? @data[:assassin] == '<world>' end def assassin_id @data[:assassin_id].strip.to_i end def assassinated_id data[:assassinated_id].strip.to_i end def assassin data[:assassin].strip end def assassinated data[:assassinated].strip end def by data[:by].strip end def by_itself? assassin_id == assassinated_id end end end end end
16.625
43
0.508772
c670d9a8cef9291181abf4b9e304e9946b66a81a
766
rb
Ruby
samples/opengl/opengl.rb
mvz/ray
6f17a04cc60152cb02916dec56ddf2206f84aff5
[ "Zlib" ]
29
2015-03-18T00:03:25.000Z
2022-01-10T17:32:17.000Z
samples/opengl/opengl.rb
mvz/ray
6f17a04cc60152cb02916dec56ddf2206f84aff5
[ "Zlib" ]
10
2015-01-25T15:42:04.000Z
2020-02-14T20:10:46.000Z
samples/opengl/opengl.rb
mvz/ray
6f17a04cc60152cb02916dec56ddf2206f84aff5
[ "Zlib" ]
8
2015-03-25T09:36:31.000Z
2020-02-26T22:08:01.000Z
$:.unshift File.expand_path(File.dirname(__FILE__) + "/../../lib") $:.unshift File.expand_path(File.dirname(__FILE__) + "/../../ext") require 'ray' class CustomDrawable < Ray::Drawable include Ray::GL def initialize super self.vertex_count = 3 end def fill_vertices [Ray::Vertex.new([0, 0], Ray::Color.red), Ray::Vertex.new([50, 0], Ray::Color.green), Ray::Vertex.new([50, 50], Ray::Color.blue)] end def render(vertex, index) draw_arrays :triangles, vertex, 3 end end Ray.game "OpenGL test" do register do add_hook :quit, method(:exit!) end scene :triangle do @obj = CustomDrawable.new @obj.pos = window.size / 2 render do |win| win.draw @obj end end scenes << :triangle end
18.682927
66
0.627937
3f455a118772b8a44ff13e119875cc80c6bcc318
9,029
php
PHP
addproduct.php
asifsyed487/PointOfSaleSystem
e50f5f6800311b1aaef1ad4e3ced0d2f8ba993d5
[ "MIT" ]
1
2022-01-09T13:13:37.000Z
2022-01-09T13:13:37.000Z
addproduct.php
asifsyed487/PointOfSaleSystem
e50f5f6800311b1aaef1ad4e3ced0d2f8ba993d5
[ "MIT" ]
null
null
null
addproduct.php
asifsyed487/PointOfSaleSystem
e50f5f6800311b1aaef1ad4e3ced0d2f8ba993d5
[ "MIT" ]
null
null
null
<?php include_once "connectdb.php"; session_start(); if($_SESSION['useremail'] == "" OR $_SESSION['role'] == "User") { header("location: index.php"); } include_once "header.php"; if(isset($_POST['addproduct'])) { $productname = $_POST["productname"]; $productcategory = $_POST["productcategory"]; $productpurchaseprice = $_POST["productpurchaseprice"]; $productsaleprice = $_POST["productsaleprice"]; $productstock = $_POST["productstock"]; $productdescription = $_POST["productdescription"]; $jinishupdate = $_FILES["productimage"]["name"]; if(!empty($jinishupdate)) { $jinish = $_FILES["productimage"]; // echo".................................................................."; // print_r($_FILES['productimage']); $fileName = $jinish["name"]; // echo".................................................................."; // echo $productname; $fTemp = $_FILES["productimage"]["tmp_name"]; // echo "<br />"; // echo".................................................................."; // echo $productcategory; $fileNameToArray = explode(".", $fileName); // echo "<br />"; // echo".................................................................."; // print_r($productpurchaseprice); $fileExtension = strtolower(end($fileNameToArray)); // echo "<br />"; // echo".................................................................."; // echo $productsaleprice; $newFile = uniqid().".".$fileExtension; // echo "<br />"; // echo".................................................................."; // echo $productstock; $storeFile = "productimages/".$newFile; // echo "<br />"; // echo".................................................................."; // echo $productdescription; $fileSize = $_FILES["productimage"]["size"]; // echo "<br />"; // echo".................................................................."; // print_r( $jinish); if($fileExtension == "jpg" || $fileExtension == "jpeg" || $fileExtension == "png" || $fileExtension == "gif" ) { if($fileSize>=26214400) { $error= ' <script type="text/javascript"> jQuery(function validation() { swal({ title: "File Size exceeded ..", text: "File can not be more than 23mb ..", icon: "warning", }); }); </script> '; echo $error; } else { if(move_uploaded_file($fTemp, $storeFile)) { $productimage = $newFile; if(!isset($error)) { $insert = $pdo->prepare("insert into product(productname, productcategory, productpurchaseprice, productsaleprice, productstock, productdescription, productimage) values(:productname, :productcategory, :productpurchaseprice, :productsaleprice, :productstock, :productdescription, :productimage)"); $insert->bindParam(":productname", $productname); $insert->bindParam(":productcategory", $productcategory); $insert->bindParam(":productpurchaseprice", $productpurchaseprice); $insert->bindParam(":productsaleprice", $productsaleprice); $insert->bindParam(":productstock", $productstock); $insert->bindParam(":productdescription", $productdescription); $insert->bindParam(":productimage", $productimage); $insert->execute(); if($insert->rowCount()) { echo ' <script type="text/javascript"> jQuery(function validation() { swal({ title: "Product Added ..", text: "", icon: "success", }); }); </script> '; } else { echo ' <script type="text/javascript"> jQuery(function validation() { swal({ title: "Product Add Failed ..", text: "", icon: "error", }); }); </script> '; } } } } } else { $error= ' <script type="text/javascript"> jQuery(function validation() { swal({ title: "Only jpg, jpeg, png and gif file supports ..", text: "", icon: "warning", }); }); </script> '; echo $error; } } // } ?> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> Add Product: <small></small> </h1> <ol class="breadcrumb"> <li><a href="#"><i class="fa fa-dashboard"></i> Level</a></li> <li class="active">Here</li> </ol> </section> <!-- Main content --> <section class="content container-fluid"> <!-------------------------- | Your Page Content Here | --------------------------> <div class="box box-success"> <div class="box-header with-border"> <h3 class="box-title"> <a href="productlist.php" class="btn btn-info" role="button">BACK TO PRODUCT LIST</a> </h3> </div> <!-- /.box-header --> <!-- form start --> <form role="form" action="" method="post" enctype="multipart/form-data"> <div class="box-body"> <div class="col-md-6"> <div class="form-group"> <label for="exampleInputEmail1">Product Name</label> <input type="text" class="form-control" id="exampleInputEmail1" placeholder="Enter Product Name" name="productname" required> </div> <div class="form-group"> <label>Select Category</label> <select class="form-control" name="productcategory" required> <option value="" disabled selected>Select Category</option> <?php $select = $pdo->prepare("select categoryname from category"); $select->execute(); while($row=$select->fetch(PDO::FETCH_OBJ)) { echo ' <option>'.$row->categoryname.'</option> '; } ?> </select> </div> <div class="form-group"> <label for="exampleInputEmail1">Purchase Price</label> <input type="number" min="1" step="1" class="form-control" id="exampleInputEmail1" placeholder="Enter Product's Purchase Price" name="productpurchaseprice" required> </div> <div class="form-group"> <label for="exampleInputEmail1">Sale Price</label> <input type="number" min="1" step="1" class="form-control" id="exampleInputEmail1" placeholder="Enter Product's Sale Price" name="productsaleprice" required> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="exampleInputEmail1">Stock</label> <input type="number" min="1" step="1" class="form-control" id="exampleInputEmail1" placeholder="Enter Product's Stock" name="productstock" required> </div> <div class="form-group"> <label for="exampleInputEmail1">Description</label> <textarea id="exampleInputEmail1" type="text" class="form-control" id="exampleInputEmail1" placeholder="About the Product .." name="productdescription" cols="30" rows="5" ></textarea> </div> <div class="form-group"> <label for="exampleInputEmail1">Product Image</label> <input type="file" class="input-group" id="exampleInputEmail1" placeholder="Enter Product's Stock" name="productimage"> <p>Input Product's Image</p> </div> </div> </div> <div class="box-footer"> <button type="submit" class="btn btn-success" name="addproduct">ADD</button> </div> </form> </div> </section> <!-- /.content --> </div> <!-- /.content-wrapper --> <?php include_once "footer.php"; ?>
36.703252
306
0.450991
2c834044cc093ac43764eb2a113e01de63eb410c
4,742
py
Python
predict_utils/prepare_notalign.py
ndkgit339/FastSpeech2-filled_pause_speech_synthesis
dc8742704df20be325570f3c497f36815e0d72f2
[ "MIT" ]
null
null
null
predict_utils/prepare_notalign.py
ndkgit339/FastSpeech2-filled_pause_speech_synthesis
dc8742704df20be325570f3c497f36815e0d72f2
[ "MIT" ]
null
null
null
predict_utils/prepare_notalign.py
ndkgit339/FastSpeech2-filled_pause_speech_synthesis
dc8742704df20be325570f3c497f36815e0d72f2
[ "MIT" ]
null
null
null
from pathlib import Path from tqdm import tqdm import subprocess def get_textname_list(text_list_path, textname_list_path): with open(text_list_path, "r") as f: text_list = [l.strip() for l in f if l.strip()] textname_list = [t.split(":")[0] for t in text_list if len(t.split(":")[1]) > 0] with open(textname_list_path, "w") as f: f.write("\n".join(textname_list)) def get_ojtlab(textname_list_path, text_dir, ojtlab_dir, openjtalk_path, dic_path, htsvoice_path, max_process = 5): with open(textname_list_path, "r") as f: text_names = [l.strip() for l in f] text_paths = [text_dir / (name + ".txt") for name in text_names] # #OpenJTalkでフルコンテキストラベル生成 procs = [] for text_path in tqdm(text_paths): ojtlab_path = ojtlab_dir / text_path.name.replace(".txt", ".ojtlab") proc = subprocess.Popen([ openjtalk_path, "-x", dic_path, "-m", htsvoice_path, "-ot", ojtlab_path, text_path ]) procs.append(proc) if len(procs) % max_process == 0: for proc in procs: proc.communicate() procs.clear() for proc in procs: proc.communicate() def convert_ojtlab_to_fulllab(ojtlab_dir, fulllab_dir): ojtlab_paths = ojtlab_dir.glob("*.ojtlab") for ojtlab_path in tqdm(ojtlab_paths): with open(ojtlab_path, 'r') as f: ojtlab = f.read() fulllab = \ ojtlab.split("[Output label]\n")[1].split("\n[Global parameter]")[0] with open(fulllab_dir / (ojtlab_path.stem + ".lab"), "w") as f: f.write(fulllab) def full2monolab(ojtlab_text): lines = ojtlab_text.split('[Output label]')[1].split('[Global parameter]')[0].split('\n') lines = [x for x in lines if x] monolab_text = [] for i, l in enumerate(lines): l = l.split(' ')[2] l = l.split('-')[1] l = l.split('+')[0] if l == 'sil': if i == 0: l = 'silB' if l == 'pau': l = 'sp' monolab_text.append(l+"\n") else: monolab_text[-1] = 'silE' return monolab_text def convert_lab_available(lab): if lab == "sil": lab = "" elif lab == "A": lab = "a" elif lab == "I": lab = "i" elif lab == "U": lab = "u" elif lab == "E": lab = "e" elif lab == "O": lab = "o" elif lab == "cl": lab = "q" elif lab == "pau": lab = "sp" elif lab == "v": lab = "b" return lab def get_monolab(textname_list_path, ojtlab_dir, jl_in_dir): """ open jtalk で得たフルコンテキストラベルをモノフォンラベルに変換 """ with open(textname_list_path, "r") as f: text_names = [l.strip() for l in f] ojtlab_paths = [ojtlab_dir / (text_name + ".ojtlab") for text_name in text_names] for ojtlab_path in tqdm(ojtlab_paths): with open(ojtlab_path, "r") as f: ojtlab_text = f.read() monolab_text = full2monolab(ojtlab_text) for i in range(len(monolab_text)): monolab_text[i] = convert_lab_available(monolab_text[i]) monolab_path = jl_in_dir / ojtlab_path.with_suffix(".lab").name with open(monolab_path, "w") as f: f.write("".join(monolab_text)) def process(data_dir, openjtalk_path, dic_path, htsvoice_path, n_jobs=4): text_dir = data_dir / 'text' ojtlab_dir = data_dir / 'ojtlab' jl_in_dir = data_dir / 'jl_in_lab' fulllab_dir = data_dir / 'fullcontext_lab' text_list_path = data_dir / "utt_filler_list.txt" textname_list_path = data_dir / "utt_name.list" for d in [text_dir, ojtlab_dir, jl_in_dir, fulllab_dir]: d.mkdir(parents=True, exist_ok=True) print("Get text names...") get_textname_list(text_list_path, textname_list_path) print("Get full context labels...") get_ojtlab(textname_list_path, text_dir, ojtlab_dir, openjtalk_path, dic_path, htsvoice_path, max_process=n_jobs) print("Convert ojtlab to full labels...") convert_ojtlab_to_fulllab(ojtlab_dir, fulllab_dir) print("Convert full to mono labels...") get_monolab(textname_list_path, ojtlab_dir, jl_in_dir) def prepare_notalign(data_dir, n_jobs=8): openjtalk_path = '/usr/local/bin/open_jtalk' dic_path = '/usr/local/share/open_jtalk/open_jtalk_dic_utf_8-1.11' htsvoice_path = '/usr/local/share/hts_voice/hts_voice_nitech_jp_atr503_m001-1.05/nitech_jp_atr503_m001.htsvoice' data_dir = Path(data_dir) print(f"---start data {data_dir.name}---") process(data_dir, openjtalk_path, dic_path, htsvoice_path, n_jobs=n_jobs) if __name__=="__main__": prepare_notalign("./")
32.040541
117
0.609237
c6d854e58d3b334bcb880d02fa7cd26e5f46fbaa
1,994
py
Python
src/xr_events/services.py
xr-web-de/xr-web
63269e26a8752564b63e84bfc0ce180198577d35
[ "MIT" ]
4
2019-03-28T20:49:59.000Z
2019-08-11T19:31:35.000Z
src/xr_events/services.py
xr-web-de/xr-web
63269e26a8752564b63e84bfc0ce180198577d35
[ "MIT" ]
4
2019-05-08T18:07:45.000Z
2021-05-08T17:29:46.000Z
src/xr_events/services.py
xr-web-de/xr-web
63269e26a8752564b63e84bfc0ce180198577d35
[ "MIT" ]
5
2019-03-28T20:50:15.000Z
2020-01-17T21:16:57.000Z
import datetime from django.utils.timezone import localdate from xr_pages.services import ( get_home_page, MODERATORS_PAGE_PERMISSIONS, EDITORS_PAGE_PERMISSIONS, ) EVENT_MODERATORS_SUFFIX = "Event Moderators" EVENT_EDITORS_SUFFIX = "Event Editors" EVENT_AUTH_GROUP_TYPES = [EVENT_MODERATORS_SUFFIX, EVENT_EDITORS_SUFFIX] MODERATORS_EVENT_PERMISSIONS = MODERATORS_PAGE_PERMISSIONS EDITORS_EVENT_PERMISSIONS = EDITORS_PAGE_PERMISSIONS def get_event_list_page(request=None): from .models import EventListPage home_page = get_home_page(request) try: event_list_page = EventListPage.objects.child_of(home_page).live().get() except (KeyError, AttributeError, EventListPage.DoesNotExist): return None return event_list_page def get_event_group_pages(request=None): from .models import EventGroupPage event_list_page = get_event_list_page(request) try: event_group_pages = ( EventGroupPage.objects.child_of(event_list_page) .live() .order_by("-group__is_regional_group", "group__name") ) except (KeyError, AttributeError, EventGroupPage.DoesNotExist): return [] # # arrange regional group pages at the start # if any([page.is_regional_group for page in event_group_pages]): # regional_pages = [page for page in event_group_pages if page.is_regional_group] # local_pages = [page for page in event_group_pages if not page.is_regional_group] # event_group_pages = regional_pages + local_pages return event_group_pages def date_range_from_days(days): days = int(days) if days > 0: from_date = localdate() to_date = localdate() + datetime.timedelta(days=days) elif days < 0: from_date = localdate() + datetime.timedelta(days=days) to_date = localdate() else: from_date = localdate() to_date = localdate() + datetime.timedelta(days=30) return from_date, to_date
29.323529
90
0.72016
60f11be3eee303ea39cf076931c47e7bef9a182f
870
lua
Lua
LordOfTheWastes/data/scripts/entity/missionbulletins.lua
Sathaerz/Avorion-Mods
524893d792284fd00689e2f4a2ae6cec0189501c
[ "Unlicense" ]
null
null
null
LordOfTheWastes/data/scripts/entity/missionbulletins.lua
Sathaerz/Avorion-Mods
524893d792284fd00689e2f4a2ae6cec0189501c
[ "Unlicense" ]
null
null
null
LordOfTheWastes/data/scripts/entity/missionbulletins.lua
Sathaerz/Avorion-Mods
524893d792284fd00689e2f4a2ae6cec0189501c
[ "Unlicense" ]
null
null
null
local LOTW_getPossibleMissions = MissionBulletins.getPossibleMissions function MissionBulletins.getPossibleMissions() local station = Entity() local stationTitle = station.title local scripts = LOTW_getPossibleMissions() if stationTitle == "Military Outpost" then local _AddBulletins = true local _Players = {Sector():getPlayers()} for _, _Player in pairs(_Players) do if not _Player:getValue("_lotw_story_5_accomplished") then _AddBulletins = false end end local distanceFromCenter = length(vec2(Sector():getCoordinates())) if distanceFromCenter < 430 then _AddBulletins = false end if _AddBulletins then table.insert(scripts, {path = "data/scripts/player/missions/lotw/lotwmission6.lua", prob = 5}) table.insert(scripts, {path = "data/scripts/player/missions/lotw/lotwmission7.lua", prob = 5}) end end return scripts end
30
97
0.758621
f95f171a2469bf9ae2f00761ab67cae71f2b1579
29,952
lua
Lua
AI/decks/Blackwing.lua
Snarkie/YGOProAIScript
1f57db863fb9b5a46e5fe17b7285bde82032e6e4
[ "MIT" ]
18
2015-04-26T00:40:04.000Z
2022-02-27T16:55:30.000Z
AI/decks/Blackwing.lua
Snarkie/YGOProAIScript
1f57db863fb9b5a46e5fe17b7285bde82032e6e4
[ "MIT" ]
5
2016-04-26T16:23:06.000Z
2018-06-28T13:41:15.000Z
AI/decks/Blackwing.lua
Snarkie/YGOProAIScript
1f57db863fb9b5a46e5fe17b7285bde82032e6e4
[ "MIT" ]
14
2015-01-11T00:08:32.000Z
2017-08-20T02:54:55.000Z
function BlackwingPriority() AddPriority({ [81105204] = {7,1,1,1,3,1,1,1,8,1,KrisCond}, -- Kris [58820853] = {5,3,1,1,1,1,1,1,5,1,ShuraCond}, -- Shura [49003716] = {4,1,1,1,4,1,1,1,8,1,BoraCond}, -- Bora [14785765] = {3,1,1,1,6,4,1,1,1,1,ZephCond}, -- Zephyros [85215458] = {9,4,1,1,3,1,1,1,5,1,KalutCond}, -- Kalut [02009101] = {8,3,3,1,2,1,1,1,6,1,GaleCond}, -- Gale [55610595] = {2,1,5,1,7,3,1,1,7,1,PinakaCond}, -- Pinaka [28190303] = {10,1,1,1,4,1,1,1,7,1,GladiusCond},-- Gladius [22835145] = {6,2,1,1,1,4,1,1,6,1,BlizzardCond},-- Blizzard [73652465] = {11,1,1,1,4,1,1,1,7,1,OroshiCond}, -- Oroshi [97268402] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Veiler [91351370] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Black Whirlwind [53567095] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Icarus [72930878] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Black Sonic [81983656] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Hawk Joe [69031175] = {1,1,5,1,3,1,1,1,1,1,nil}, -- Armor Master [73580471] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Black Rose [95040215] = {1,1,8,1,2,1,1,1,1,1,nil}, -- Nothung [98012938] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Vulcan [73347079] = {1,1,1,1,7,1,1,1,1,1,ForceStrixCond},-- Force Strix [76067258] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Master Key Beetle [16051717] = {1,1,9,6,1,1,1,1,1,1,RaikiriCond}, -- Raikiri -- Crow Tag Force [75498415] = {4,1,1,1,1,1,1,1,1,1,nil}, -- Sirocco [72714392] = {1,1,8,2,5,3,1,1,2,1,VayuCond}, -- Vayu [24508238] = {1,1,1,1,1,1,1,1,5,1,nil}, -- D.D. Crow [42703248] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Trunade [83764719] = {8,1,1,1,1,1,1,1,1,1,nil}, -- Monster Reborn [27174286] = {1,1,1,1,1,1,1,1,1,1,nil}, -- RftDD [44095762] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Mirror Force [59616123] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Trap Stun [59839761] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Delta Crow [41420027] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Solemn Judgment [52687916] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Trishula [27315304] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Mist Wurm [33236860] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Silverwing [09012916] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Black-Winged Dragon [23693634] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Colossal Fighter [50321796] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Brionac [76913983] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Armed Wing [90953320] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Hyper Librarian [26593852] = {1,1,1,1,1,1,1,1,1,1,nil}, -- Catastor }) end function BlackwingFilter(c,exclude) return IsSetCode(c.setcode,0x33) and (exclude == nil or c.id~=exclude) end function BlackwingTunerFilter(c,exclude) return BlackwingFilter(c,exclude) and FilterType(c,TYPE_TUNER) end function BlackwingNonTunerFilter(c,exclude) return BlackwingFilter(c,exclude) and not FilterType(c,TYPE_TUNER) end function BlackwingSynchroFilter(c,exclude) return BlackwingFilter(c,exclude) and FilterType(c,TYPE_SYNCHRO) end function HasWhirlwind() return HasIDNotNegated(AIST(),91351370,true,nil,nil,POS_FACEUP) end function SynchroCheck(level,nontunercount) local tuners={} local nontuners={} local levels={} for i=1,#AIMon() do local c = AIMon()[i] if c.level>0 then if FilterType(c,TYPE_TUNER) then tuners[#tuners+1]=c.level else nontuners[#nontuners+1]=c.level end end end if #tuners == 0 or #nontuners == 0 then return false end for i=1,#nontuners do for j=1,#nontuners do local a,b if i==j then a=0 b=0 else a=nontuners[i] b=nontuners[j] end levels[a+b]=true end end for i=1,#tuners do for j=1,#nontuners do levels[tuners[i]+nontuners[j]]=0 end end end function BounceFilter(c) return c.id == 50078509 and FilterPosition(c,POS_FACEUP) or c.id == 97077563 and CothCheck(c) end -- favourable targets to return to the hand -- for Zephyros and Vulcan function BounceTargets(cards,filter,opt) local result = 0 for i=1,#cards do local c = cards[i] if c and (filter == nil or (opt == nil and filter(c) or filter(c,opt))) then if BounceFilter(c) then result = result+1 end end end return result end function KrisCond(loc,c) if loc == PRIO_TOHAND then return not HasID(AICards(),c.id,true) and FieldCheck(3,BlackwingTunerFilter)==1 end return true end function ShuraCond(loc,c) if loc == PRIO_TOHAND then return not HasID(AICards(),c.id,true) end return true end function BoraCond(loc,c) if loc == PRIO_TOHAND then return not HasID(AICards(),c.id,true) and FieldCheck(3,BlackwingTunerFilter)==1 end return true end function ZephCond(loc,c) return true end function KalutCond(loc,c) if loc == PRIO_TOHAND then return not HasID(AIHand(),c.id,true) and (Duel.GetTurnPlayer()==1-player_ai or Duel.GetCurrentPhase()==PHASE_END or HasID(AIMon(),58820853,true)) and CardsMatchingFilter(AICards(),BlackwingFilter)>0 end return true end function GaleCond(loc,c) if loc == PRIO_TOHAND then return not HasID(AICards(),c.id,true) and (FieldCheck(4,BlackwingFilter)==1 or FieldCheck(3,BlackwingNonTunerFilter)==1) end return true end function PinakaCond(loc,c) if loc == PRIO_TOGRAVE then return FilterLocation(c,LOCATION_MZONE) end if loc == PRIO_TOFIELD then return FilterLocation(c,LOCATION_DECK) end return true end function VayuCond(loc,c) if loc == PRIO_TOFIELD then return FilterLocation(c,LOCATION_DECK) end return true end function GladiusCond(loc,c) if loc == PRIO_TOHAND then return FieldCheck(3,FilterType,TYPE_TUNER)==1 and #AIMon()==1 end return true end function BlizzardCond(loc,c) if loc == PRIO_TOHAND then return not HasID(AIHand(),c.id,true) and CardsMatchingFilter(AIGrave(),BlizzardFilter)>0 and DualityCheck() end return true end function OroshiCond(loc,c) if loc == PRIO_TOHAND then return (HasID(AIMon(),95040215,true) or HasID(AIMon(),22835145,true)) --or SynchroCheck(6)) and HasID(AIExtra(),81983656,true) and Duel.GetTurnPlayer()==player_ai and not (Duel.GetCurrentPhase()==PHASE_END) end return true end function ForceStrixCond(loc,c) if loc == PRIO_TOGRAVE then return FilterLocation(c,LOCATION_MZONE) and c.xyz_material_count==0 end return true end function CastelCond(loc,c) if loc == PRIO_TOGRAVE then return FilterLocation(c,LOCATION_MZONE) and c.xyz_material_count==0 end return true end function RaikiriCond(loc,c) if loc == PRIO_TOFIELD then return DestroyCheck(OppField(),nil,nil,nil,RaikiriFilter)>0 end return true end function GaleFilter(c,atk) return Targetable(c,TYPE_MONSTER) and Affected(c,TYPE_MONSTER,3) and (atk==nil or c.attack*.5<=atk) end function UseGale() return CardsMatchingFilter(OppMon(),GaleFilter)>0 end function SummonGale(mode) if mode == 2 and DualityCheck() and (HasID(AIHand(),28190303,true) or HasWhirlwind() and HasID(AIDeck(),28190303,true)) and #AIMon()==0 then return true end if mode == 1 and OverExtendCheck(3) then return true end if mode == 3 and (FieldCheck(4)==1 or FieldCheck(3,BlackwingNonTunerFilter)==1) then return true end if mode == 4 and OppHasStrongestMonster() and CardsMatchingFilter(OppMon(),GaleFilter,math.min(AIGetStrongestAttack(),1300))>0 then return true end return false end function SummonShura(mode,c) ApplyATKBoosts({c}) if mode == 1 and not HasID(AIMon(),58820853,true) and CanWinBattle(c,OppMon(),true) then return true end if mode == 2 and (OverExtendCheck(3) or HasWhirlwind()) then return true end return false end function BlizzardFilter(c) return BlackwingFilter(c) and c.level==4 end function SummonBlizzard() return CardsMatchingFilter(AIGrave(),BlizzardFilter)>0 and DualityCheck() and WindaCheck() and not HasID(AIMon(),95040215,true) end function SummonPinaka(mode) if mode == 1 and DualityCheck() and (HasID(AIHand(),28190303,true) or HasWhirlwind() and HasID(AIDeck(),28190303,true)) and #AIMon()==0 then return true end if mode == 2 and DualityCheck() and (HasID(AIHand(),81105204,true) or HasID(AIHand(),49003716,true) or FieldCheck(4)>0) then return true end return false end function SummonZephyros(mode) if DeckCheck(DECK_HARPIE) then return false end if mode == 1 and (OverExtendCheck(3) or HasWhirlwind()) then return true elseif mode == 2 and BounceTargets(AIField())>0 and OverExtendCheck(3) and AI.GetPlayerLP(1)>400 then return true elseif mode == 3 and #AIMon()==0 and AI.GetPlayerLP(1)>400 then return true end return false end function SummonKris(mode) if mode == 1 and OverExtendCheck(3) then return true elseif mode == 2 and (OverExtendCheck(3) or HasWhirlwind()) then return true elseif mode == 3 and FieldCheck(3,BlackwingTunerFilter)==1 then return true end return false end function SummonGladius(mode) if mode == 1 and WindaCheck() and FieldCheck(3,FilterType,TYPE_TUNER)==1 then return true elseif mode == 2 and DualityCheck() and FieldCheck(3,FilterType,TYPE_TUNER)==1 then return true end return false end function SummonOroshi() return WindaCheck() and HasID(AIMon(),95040215,true) and HasID(AIExtra(),81983656,true) end function SummonNothung(mode) if mode == 1 and (not HasID(AIMon(),95040215,true) or AI.GetPlayerLP(2)<=800) then return true elseif mode == 2 then return true end return false end function HawkJoeFilter(c) return BlackwingSynchroFilter(c) and FilterRace(c,RACE_WINDBEAST) and FilterRevivable(c) end function SummonHawkJoe(mode) if mode == 1 and WindaCheck() and (CardsMatchingFilter(AIGrave(),HawkJoeFilter)>0 or HasID(AIMon(),73652465,true) and HasID(AIMon(),95040215,true)) then return true end return false end function SummonBora(mode) if mode == 1 and FieldCheck(3,BlackwingTunerFilter)==1 then return true end if mode == 2 and OverExtendCheck(3) then return true end if mode == 3 and (HasWhirlwind() or #AIMon()==0) then return true end return false end function SummonForceStrix() if TurnEndCheck() then return true end return false end function SummonKalut() if DualityCheck() and (HasID(AIHand(),02009101,true) or HasWhirlwind() and NeedsCard(02009101,AIDeck(),AIHand(),true)) and #AIMon()==0 and #OppMon()>0 then return true end return false end function SummonArmorMaster() return MP2Check(2500) end function UseIcarus() local targets = SubGroup(OppField(),IcarusFilter) local targets2 = SubGroup(targets,PriorityTarget) if #targets2>0 and #targets>1 and OppHasStrongestMonster() then return true end return false end function SummonMKB() return OppGetStrongestAttDef()<2500 and DualityCheck() and (HasID(AIST(),05851097,true) or HasID(AIST(),38296564,true)) and HasIDNotNegated(AIExtra(),76067258,true) and MP2Check(2500) end function UseMKB() return true end function UseSirocco() return OppHasStrongestMonster() and CardsMatchingFilter(AIMon(),BlackwingFilter)>0 end function SummonSirocco() return #AIMon()==0 and #OppMon()>0 end function UseVayu() return OverExtendCheck(3) and BattlePhaseCheck() end function SetVayu() return TurnEndCheck() end function RftDDFilter(c) return FilterType(c,TYPE_MONSTER) and FilterRevivable(c) end function UseRftDD() return CardsMatchingFilter(AIBanish(),RftDDFilter)>2 and BattlePhaseCheck() and Duel.GetLocationCount(player_ai,LOCATION_MZONE)>2 end function SetRftDD() return CardsMatchingFilter(AIBanish(),RftDDFilter)>2 and TurnEndCheck() end function SummonSyncTrishula(c) return #OppField()>0 and #OppHand()>0 and HasID(AIExtra(),c.id,true) and (NotNegated(c) or OppHasStrongestMonster() and OppGetStrongestAttDef()<c.attack) end function SummonBlackwing(c) ApplyATKBoosts({c}) if OppHasStrongestMonster() and OppGetStrongestAttDef()<c.attack or HasIDNotNegated(AICards(),53567095,true) then return true end return false end function ArmedWingFilter(c,source) return BattleTargetCheck(c,source) and FilterPosition(c,POS_DEFENSE) and (FilterPrivate(c) or c.defense<source.attack+500) end function ArmedWingCheck(c,targets) return NotNegated(c) and CardsMatchingFilter(targets,ArmedWingFilter,c)>0 end function SummonArmedWing(c) return ArmedWingCheck(c,OppMon()) or OppGetStrongestAttDef()<c.attack end function SummonVulcanBW(c) return DeckCheck(DECK_BLACKWING) and SummonVulcan(c) and BounceTargets(AIField())>0 end function SummonRaikiri(c,params) local mode = params[1] local cards = params[2] local targets = DestroyCheck(OppField(),nil,nil,nil,RaikiriFilter) local bws = CardsMatchingFilter(cards,RaikiriSummonFilter) + CardsMatchingFilter(AIMon(),BlackwingFilter) -2 if mode == 1 and targets>1 and bws>1 then return true end if mode == 2 and targets>0 and bws>0 and MP2Check(c.attack) then return true end return false end function UseRaikiri(c) return DestroyCheck(OppField(),nil,nil,nil,RaikiriFilter)>0 end function RaikiriSummonFilter(c) return BlackwingFilter(c) and not FilterType(c,TYPE_SYNCHRO) end function BlackwingInit(cards) local Act = cards.activatable_cards local Sum = cards.summonable_cards local SpSum = cards.spsummonable_cards local Rep = cards.repositionable_cards local SetMon = cards.monster_setable_cards local SetST = cards.st_setable_cards if HasIDNotNegated(Act,16051717,true) and DestroyCheck(OppField())>CardsMatchingFilter(AIMon(),BlackwingFilter)-1 then for i=1,#Sum do if RaikiriSummonFilter(Sum[i]) then return Summon(i) end end for i=1,#SpSum do if RaikiriSummonFilter(SpSum[i]) then return SpSummon(i) end end end if HasIDNotNegated(Act,16051717,UseRaikiri)then return Activate() end if HasIDNotNegated(Act,91351370) and #Sum>0 then return {COMMAND_ACTIVATE,CurrentIndex} end if HasIDNotNegated(Act,02009101) and UseGale() then return {COMMAND_ACTIVATE,CurrentIndex} end if HasIDNotNegated(Act,76067258) and UseMKB() then GlobalCardMode=1 return {COMMAND_ACTIVATE,CurrentIndex} end if HasIDNotNegated(Act,73347079) then return {COMMAND_ACTIVATE,CurrentIndex} end if HasIDNotNegated(Act,81983656) then return {COMMAND_ACTIVATE,CurrentIndex} end if HasIDNotNegated(Act,27174286) and UseRftDD() then return {COMMAND_ACTIVATE,CurrentIndex} end if HasID(SpSum,52687916,SummonSyncTrishula) then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasID(SpSum,73652465) and SummonOroshi() then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasIDNotNegated(SpSum,81983656) and SummonHawkJoe(1) then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasIDNotNegated(SpSum,16051717,SummonRaikiri,{1,SpSum}) then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasIDNotNegated(SpSum,98012938) and SummonVulcanBW() then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasIDNotNegated(SpSum,95040215) and SummonNothung(1) then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasID(SpSum,28190303) and SummonGladius(1) then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasID(SpSum,49003716) and SummonBora(1) then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasID(SpSum,02009101) and SummonGale(3) then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasIDNotNegated(Sum,22835145) and SummonBlizzard() then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Sum,75498415) and SummonSirocco() then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Sum,58820853) and SummonShura(1,Sum[CurrentIndex]) then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Sum,28190303) and SummonGladius(2) then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Sum,55610595) and SummonPinaka(1) then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Sum,02009101) and SummonGale(2) then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Sum,55610595) and SummonPinaka(2) then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Sum,58820853) and SummonShura(2,Sum[CurrentIndex]) then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Sum,14785765) and SummonZephyros(1) then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Sum,81105204) and SummonKris(2) then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Sum,49003716) and SummonBora(3) then return {COMMAND_SUMMON,CurrentIndex} end if HasID(SpSum,49003716) and SummonBora(2) then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasID(SpSum,02009101) and SummonGale(1) then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasID(SpSum,81105204) and SummonKris(1) then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasID(Act,14785765) and SummonZephyros(2) then return {COMMAND_ACTIVATE,CurrentIndex} end if HasID(Sum,85215458) and SummonKalut() then return {COMMAND_SUMMON,CurrentIndex} end if HasIDNotNegated(SpSum,95040215) and SummonNothung(2) then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasIDNotNegated(SpSum,16051717,SummonRaikiri,{2,SpSum}) then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasIDNotNegated(SpSum,76067258) and SummonMKB() then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasIDNotNegated(SpSum,73347079) and SummonForceStrix() then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasID(SpSum,69031175) and SummonArmorMaster() then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasID(SpSum,76913983,SummonArmedWing) then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasIDNotNegated(Act,53567095) and UseIcarus() then return {COMMAND_ACTIVATE,CurrentIndex} end if HasID(SpSum,02009101) and SummonGale(4) then return {COMMAND_SPECIAL_SUMMON,CurrentIndex} end if HasID(Sum,02009101) and SummonGale(4) then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Sum,81105204,SummonBlackwing) then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Sum,58820853,SummonBlackwing) then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Sum,14785765,SummonBlackwing) then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Sum,49003716,SummonBlackwing) then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Sum,22835145,SummonBlackwing) then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Sum,02009101,SummonBlackwing) then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Sum,55610595,SummonBlackwing) then return {COMMAND_SUMMON,CurrentIndex} end if HasID(Act,14785765) and SummonZephyros(3) then return {COMMAND_ACTIVATE,CurrentIndex} end if HasID(SetMon,72714392) and SetVayu() then return {COMMAND_SET_MONSTER,CurrentIndex} end if HasIDNotNegated(Act,72714392) and UseVayu() then return {COMMAND_ACTIVATE,CurrentIndex} end if HasIDNotNegated(Act,75498415) and UseSirocco() then return {COMMAND_ACTIVATE,CurrentIndex} end if HasID(SetST,27174286) and SetRftDD() then return {COMMAND_SET_ST,CurrentIndex} end return nil end function HawkJoeTarget(cards,source) if LocCheck(cards,LOCATION_GRAVE) then return Add(cards,PRIO_TOFIELD) end if RemovalCheckCard(source,CATEGORY_DESTROY,nil,nil,Duel.GetCurrentChain()-1)then--,nil,Duel.GetCurrentChain()) then return BestTargets(cards) end local e = Duel.GetChainInfo(Duel.GetCurrentChain()-1,CHAININFO_TRIGGERING_EFFECT) if Duel.GetCurrentChain()>1 and e then return BestTargets(cards,1,TARGET_OTHER) end local aimon,oppmon = GetBattlingMons() if aimon and oppmon then return BestTargets(cards,1,TARGET_BATTLE,nil,nil,nil,GetCardFromScript(oppmon)) end return BestTargets(cards) end function ForceStrixTarget(cards) if LocCheck(cards,LOCATION_OVERLAY) then return Add(cards,PRIO_TOGRAVE) end return Add(cards) end function BlizzardTarget(cards) return Add(cards,PRIO_TOFIELD,1,FilterLevel,4) end function IcarusTarget(cards,min) if GlobalCardMode == 1 then GlobalCardMode = nil return GlobalTargetGet(cards,true) elseif min==1 then return Add(cards,PRIO_TOGRAVE) else return BestTargets(cards,2,TARGET_DESTROY,Affected,TYPE_TRAP) end end GlobalMKB={} function MKBSet(target,source) GlobalMKB[target.cardid]=source.cardid return end function MKBCheck(target) if target == nil then return false end local source = GlobalMKB[target.cardid] if source == nil then return false end source = FindCard(source,Field()) if source == nil then return false end if target and source and FilterLocation(target,LOCATION_ONFIELD) and NotNegated(source) and FilterLocation(source,LOCATION_ONFIELD) and FilterAffected(target,EFFECT_INDESTRUCTABLE_EFFECT) then return source end return false end function MKBTarget(cards,source) if LocCheck(cards,LOCATION_OVERLAY) then return Add(cards,PRIO_TOGRAVE) end if GlobalCardMode == 1 then local result = nil GlobalCardMode = nil if HasID(cards,38296564,true) then result=IndexByID(cards,38296564) MKBSet(cards[result],source) return {result} elseif HasID(cards,05851097,true) then result=IndexByID(cards,05851097) MKBSet(cards[result],source) return {result} else result = BestTargets(cards,1,TARGET_PROTECT) MKBSet(cards[1],source) return result end end return Add(cards,PRIO_TOGRAVE,1,function(c) return c.id~=05851097 and c.id~=38296564 end) end function DDCrowTarget(cards) if GlobalCardMode==1 then GlobalCardMode=nil return GlobalTargetGet(cards,true) end return BestTargets(cards,1,TARGET_BANISH) end function RaikiriFilter(c) return DestroyFilter(c) and Affected(c,TYPE_MONSTER,7) end function RaikiriTarget(cards,max) local count = math.max(1,math.min(CardsMatchingFilter(OppField(),RaikiriFilter),max)) return BestTargets(cards,count,TARGET_DESTROY) end function BlackwingCard(cards,min,max,id,c) if c then id = c.id end if id == 16051717 then return RaikiriTarget(cards,max) end if id == 02009101 then return BestTargets(cards,1,TARGET_OTHER) end if id == 95040215 then return BestTargets(cards,1,TARGET_OTHER) end if id == 91351370 then return Add(cards) end if id == 55610595 then return Add(cards) end if id == 81983656 then return HawkJoeTarget(cards,c) end if id == 58820853 then return Add(cards,PRIO_TOFIELD) end if id == 73347079 then return ForceStrixTarget(cards) end if id == 22835145 then return BlizzardTarget(cards) end if id == 53567095 then return IcarusTarget(cards,min) end if id == 76067258 then return MKBTarget(cards,c) end if id == 24508238 then return DDCrowTarget(cards,c) end if id == 52687916 then -- Synch Trishula return BestTargets(cards,1,TARGET_BANISH) end if id == 27174286 then -- RftDD return BestTargets(cards,PRIO_TOFIELD,max) end return nil end function ChainKalut() local aimon,oppmon=GetBattlingMons() local count = CardsMatchingFilter(AIHand(),FilterID,85215458) if aimon and (AttackBoostCheck(1400*count) or CanFinishGame(aimon,oppmon,aimon:GetAttack()+1400*count)) and UnchainableCheck(85215458) then return true end return false end function BlackSonicFilter(c) return FilterPosition(c,POS_ATTACK) and Affected(c,TYPE_TRAP) end function ChainBlackSonic(c) if RemovalCheckCard(c) then return true end local targets = SubGroup(OppMon(),BlackSonicFilter) local targets2 = SubGroup(targets,PriorityTarget) local aimon,oppmon = GetBattlingMons() if (WinsBattle(oppmon,aimon) or #targets>1 or #target2>0) and UnchainableCheck(72930878) then return true end end function IcarusFilter(c) return DestroyFilterIgnore(c) and Targetable(c,TYPE_TRAP) and Affected(c,TYPE_TRAP) end function ChainIcarus(card) local targets = SubGroup(OppField(),IcarusFilter) local prio = HasPriorityTarget(targets) local removal = {} for i=1,#AIMon() do local c = AIMon()[i] if FilterRace(c,RACE_WINDBEAST) and RemovalCheckCard(c) then removal[#removal+1]=c end end if (#removal>0 and UnchainableCheck(53567095) or RemovalCheckCard(card)) and #targets>1 then if #removal>0 then BestTargets(removal,1,TARGET_PROTECT) GlobalTargetSet(removal[1]) GlobalCardMode=1 end return true end if prio and #targets>1 and Duel.GetTurnPlayer()==1-player_ai and UnchainableCheck(53567095) then return true end if IsBattlePhase() and Duel.GetTurnPlayer()==1-player_ai then local aimon,oppmon = GetBattlingMons() local Kalutcount = CardsMatchingFilter(AIHand(),FilterID,85215458) if WinsBattle(oppmon,aimon) and #targets>1 and UnchainableCheck(53567095) and not (AttackBoostCheck(1400*Kalutcount) and MacroCheck()) then return true end end return false end function ChainHawkJoe(c) if Negated(c) then return false end local aimon,oppmon = GetBattlingMons() if Duel.GetTurnPlayer()~=player_ai and WinsBattle(oppmon,aimon) and Duel.GetCurrentChain()==0 then return true end if Duel.GetCurrentChain()>0 then return true end return false end function ChainDDCrow(card) local c=CheckTarget(card,OppGrave(),true,FilterType,TYPE_MONSTER) if c and UnchainableCheck(24508238) then GlobalCardMode=1 GlobalTargetSet(c) return true end local c=CheckSS(card,OppGrave(),true,LOCATION_GRAVE,FilterType,TYPE_MONSTER) if c and UnchainableCheck(24508238) then GlobalCardMode=1 GlobalTargetSet(c) return true end local darkcount = CardsMatchingFilter(AIGrave(),FilterAttribute,ATTRIBUTE_DARK) local crowcount = CardsMatchingFilter(AIHand(),FilterID,24508238) if HasIDNotNegated(AIHand(),65192027,true) and DestroyCheck(OppField())>1 and darkcount<3 and darkcount+crowcount>=3 and #OppGrave()>=crowcount-darkcount and UnchainableCheck(24508238) and Duel.GetTurnPlayer()==player_ai then return true end return false end function DeltaCrowFilter(c) return FilterPosition(c,POS_FACEDOWN) and DestroyCheck(c) and Targetable(c,TYPE_TRAP) and Affected(c,TYPE_TRAP) end function ChainDeltaCrow(c) local targets = CardsMatchingFilter(OppST(),DeltaCrowFilter) if RemovalCheckCard(c) then return true end local count = 0 for i=1,#AIMon() do local c = AIMon()[i] if RemovalCheckCard(c) and BlackwingFilter(c) then count = count+1 end end if count>=CardsMatchingFilter(AIMon(),BlackwingFilter) then return UnchainableCheck(59839761) end if (Duel.GetCurrentPhase()==PHASE_END and Duel.GetTurnPlayer()~=player_ai or Duel.GetTurnPlayer()==player_ai) and targets>1 then return UnchainableCheck(59839761) end end function BlackwingChain(cards) if HasIDNotNegated(cards,59839761,ChainDeltaCrow) then return {1,CurrentIndex} end if HasID(cards,85215458) and ChainKalut() then return {1,CurrentIndex} end if HasIDNotNegated(cards,91351370) then -- Black Whirlwind return {1,CurrentIndex} end if HasIDNotNegated(cards,95040215) then -- Nothung return {1,CurrentIndex} end if HasID(cards,55610595) then -- Pinaka return {1,CurrentIndex} end if HasIDNotNegated(cards,58820853) then -- Shura return {1,CurrentIndex} end if HasIDNotNegated(cards,22835145) then -- Blizzard return {1,CurrentIndex} end if HasIDNotNegated(cards,72930878,nil,LOCATION_HAND,ChainBlackSonic) then return {1,CurrentIndex} end if HasIDNotNegated(cards,72930878,ChainBlackSonic) then return {1,CurrentIndex} end if HasIDNotNegated(cards,53567095,ChainIcarus) then return {1,CurrentIndex} end if HasIDNotNegated(cards,81983656,ChainHawkJoe) then return {1,CurrentIndex} end if HasID(cards,24508238,ChainDDCrow) then return {1,CurrentIndex} end return nil end function BlackwingEffectYesNo(id,card) local result = nil if id==85215458 and ChainKalut() then result = 1 end if id==91351370 and NotNegated(card) then -- Black Whirlwind result = 1 end if id==95040215 and NotNegated(card) then -- Nothung result = 1 end if id==58820853 and NotNegated(card) then -- Shura result = 1 end if id == 55610595 then -- Pinaka result = 1 end if id == 22835145 and NotNegated(card) then -- Blizzard result = 1 end if id == 81983656 and ChainHawkJoe(card) then result = 1 end return result end function BlackwingOption(options) return nil end BlackwingAtt={ 81105204, -- Kris 58820853, -- Shura 49003716, -- Bora 14785765, -- Zephyros 85215458, -- Kalut 02009101, -- Gale 81983656, -- Hawk Joe 69031175, -- Armor Master 33698022, -- Moonlight Rose 95040215, -- Nothung 76067258, -- Master Key Beetle 75498415, -- Sirocco 52687916, -- Trishula 27315304, -- Mist Wurm 33236860, -- Silverwing 09012916, -- Black-Winged Dragon 23693634, -- Colossal Fighter 50321796, -- Brionac 76913983, -- Armed Wing 90953320, -- Hyper Librarian 26593852, -- Catastor } BlackwingDef={ 28190303, -- Gladius 22835145, -- Blizzard 73652465, -- Oroshi 73347079, -- Force Strix 72714392, -- Vayu 24508238, -- D.D. Crow } function BlackwingPosition(id,available) result = nil for i=1,#BlackwingAtt do if BlackwingAtt[i]==id then result=POS_FACEUP_ATTACK end end for i=1,#BlackwingDef do if BlackwingDef[i]==id then result=POS_FACEUP_DEFENSE end end return result end
27.328467
118
0.715912
a9971018c7239ca6b77454dadd0a07eef35c09f6
1,730
swift
Swift
Marshall Connect/UI/ShadowLayer.swift
fregante/MarshallConnect
e0953ac6d46b00e9ab12302655fc35a9f863a6ec
[ "MIT" ]
2
2019-03-28T09:37:00.000Z
2020-10-05T05:40:15.000Z
Marshall Connect/UI/ShadowLayer.swift
fregante/MarshallConnect
e0953ac6d46b00e9ab12302655fc35a9f863a6ec
[ "MIT" ]
1
2019-01-15T21:00:18.000Z
2019-01-15T21:00:18.000Z
Marshall Connect/UI/ShadowLayer.swift
fregante/MarshallConnect
e0953ac6d46b00e9ab12302655fc35a9f863a6ec
[ "MIT" ]
2
2019-12-02T19:39:23.000Z
2020-10-05T05:50:46.000Z
// // ShadowLayer.swift // Marshall Connect // // Created by Vahagn Mkrtchyan on 12/8/18. // Copyright © 2018 Vahagn Mkrtchyan. All rights reserved. // import Cocoa extension NSBezierPath { var cgPath: CGPath { get { return self.transformToCGPath() } } /// Transforms the NSBezierPath into a CGPath /// /// :returns: The transformed NSBezierPath private func transformToCGPath() -> CGPath { // Create path let path = CGMutablePath() let points = UnsafeMutablePointer<NSPoint>.allocate(capacity: 3) let numElements = self.elementCount if numElements > 0 { var didClosePath = true for index in 0..<numElements { let pathType = self.element(at: index, associatedPoints: points) switch pathType { case .moveTo: path.move(to: CGPoint(x: points[0].x, y: points[0].y)) case .lineTo: path.addLine(to: CGPoint(x: points[0].x, y: points[0].y)) didClosePath = false case .curveTo: path.addCurve(to: CGPoint(x: points[0].x, y: points[0].y), control1: CGPoint(x: points[1].x, y: points[1].y), control2: CGPoint(x: points[2].x, y: points[2].y)) didClosePath = false case .closePath: path.closeSubpath() didClosePath = true } } if !didClosePath { path.closeSubpath() } } points.deallocate() return path } }
29.322034
180
0.499422
41433a633a5c4dc2ac0b6c6bda6756e77a64b9d3
55
css
CSS
public/css/post.css
kojimadaiki/practice-menu
a87ad4fb7b3d8498ea7a6ae15d8daafe7933500f
[ "MIT" ]
null
null
null
public/css/post.css
kojimadaiki/practice-menu
a87ad4fb7b3d8498ea7a6ae15d8daafe7933500f
[ "MIT" ]
null
null
null
public/css/post.css
kojimadaiki/practice-menu
a87ad4fb7b3d8498ea7a6ae15d8daafe7933500f
[ "MIT" ]
null
null
null
.top { display: flex; } p input { width: 200px; }
6.875
16
0.545455
79c2850a23d5734de46be29a2d3197017d06721b
379
php
PHP
app/Http/Controllers/UserController.php
KaptainMidnight/pixel_backend
1c37ab135c3dbea6e7e29ff370dc4f4fe54138aa
[ "MIT" ]
null
null
null
app/Http/Controllers/UserController.php
KaptainMidnight/pixel_backend
1c37ab135c3dbea6e7e29ff370dc4f4fe54138aa
[ "MIT" ]
1
2021-02-02T18:03:08.000Z
2021-02-02T18:03:08.000Z
app/Http/Controllers/UserController.php
KaptainMidnight/pixel_backend
1c37ab135c3dbea6e7e29ff370dc4f4fe54138aa
[ "MIT" ]
null
null
null
<?php namespace App\Http\Controllers; use App\Models\User; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; class UserController extends Controller { /** * Response all users * * @return JsonResponse */ public function list() { return response()->json(User::query()->where('id', '<>', auth()->user()->id)->get()); } }
18.047619
93
0.617414
da53c9d9e54cb977bb6f36cd58f850c3ef83a2f3
414
php
PHP
app/Bitacora.php
EGiadans/BitacorasGasIslo
108a05ed853b8f17c07c156a450ea7b35cd08e4c
[ "MIT" ]
null
null
null
app/Bitacora.php
EGiadans/BitacorasGasIslo
108a05ed853b8f17c07c156a450ea7b35cd08e4c
[ "MIT" ]
null
null
null
app/Bitacora.php
EGiadans/BitacorasGasIslo
108a05ed853b8f17c07c156a450ea7b35cd08e4c
[ "MIT" ]
null
null
null
<?php namespace App; use Illuminate\Database\Eloquent\Model; class Bitacora extends Model { protected $table = 'bitacoras'; protected $primaryKey = 'ID_Bitacora'; public $timestamps = false; public function gerente() { return $this->belongsTo('App\Gerente', 'ID_Gerente'); } public function estacion() { return $this->belongsTo('App\Estacion', 'ID_Estacion'); } }
18.818182
63
0.654589
3951e01a0d645933dd78ef6458d65a392952a5cf
510
py
Python
tests/getnet/services/utils/test_device.py
7bruno/getnet-py
590db2f19e0c7f98ffdfbb27f4c6ffd7fb1f47ed
[ "MIT" ]
2
2021-04-09T20:17:41.000Z
2021-04-09T20:18:06.000Z
tests/getnet/services/utils/test_device.py
7bruno/getnet-py
590db2f19e0c7f98ffdfbb27f4c6ffd7fb1f47ed
[ "MIT" ]
5
2019-11-24T16:24:11.000Z
2021-02-22T16:10:05.000Z
tests/getnet/services/utils/test_device.py
7bruno/getnet-py
590db2f19e0c7f98ffdfbb27f4c6ffd7fb1f47ed
[ "MIT" ]
3
2020-07-25T23:00:59.000Z
2022-02-15T02:37:27.000Z
import ipaddress import pytest from getnet.services.utils import Device class TestDevice: def test_invalid_device_id(self): with pytest.raises(TypeError): Device("127.0.0.1", "A" * 81) def test_invalid_ipaddress(self): with pytest.raises(ipaddress.AddressValueError): Device("127.0.0.300", "ABC") def test_get_as_dict(self): object = Device("127.0.0.3", "ABC") assert {"ip_address": "127.0.0.3", "device_id": "ABC"} == object.as_dict()
25.5
82
0.637255
a9e4c96d568f24826bc41720d63192eaee62409e
307
php
PHP
resources/views/admin/orders.blade.php
seohomeless/dom4
ffc77bab29f7da0fab259779e44d727b5a839c5f
[ "MIT" ]
null
null
null
resources/views/admin/orders.blade.php
seohomeless/dom4
ffc77bab29f7da0fab259779e44d727b5a839c5f
[ "MIT" ]
null
null
null
resources/views/admin/orders.blade.php
seohomeless/dom4
ffc77bab29f7da0fab259779e44d727b5a839c5f
[ "MIT" ]
null
null
null
@extends('layouts.main') @section('content') <div> <h3>Заказы</h3> <ul class="adminmenu"> <li><a href="/admin/addtovar">+ Добавить товар</a></li> <li><a href="/admin/tovari">Управление товарами</a></li> <li><a href="/admin/orders">Заказы</a></li> </ul> </div> @endsection
13.347826
58
0.579805
f431fcdef5be69ad35151055f614685327846d8c
71
ts
TypeScript
src/Model/ConnectionPriority.ts
MrDockal/react-native-ble-manager
3675562d2d2e8619f70464808811989d7b777785
[ "Apache-2.0" ]
null
null
null
src/Model/ConnectionPriority.ts
MrDockal/react-native-ble-manager
3675562d2d2e8619f70464808811989d7b777785
[ "Apache-2.0" ]
null
null
null
src/Model/ConnectionPriority.ts
MrDockal/react-native-ble-manager
3675562d2d2e8619f70464808811989d7b777785
[ "Apache-2.0" ]
null
null
null
export enum ConnectionPriority { BALANCED = 0, HIGH = 1, LOW = 2, }
11.833333
32
0.647887
389180edd4a58e32b87373748c9f4892f6559284
862
php
PHP
pages/home.php
rohscx/simple-php-website
312057eeaecb3a4fa11d18d5f7c48c9dc5eff82f
[ "MIT" ]
null
null
null
pages/home.php
rohscx/simple-php-website
312057eeaecb3a4fa11d18d5f7c48c9dc5eff82f
[ "MIT" ]
null
null
null
pages/home.php
rohscx/simple-php-website
312057eeaecb3a4fa11d18d5f7c48c9dc5eff82f
[ "MIT" ]
null
null
null
<p>Welcome to the <b>home</b> page.</p> <p>This is the initial release of the portal, updates, and changes will be included to increase functionality at a later date.</p> <p><b>Whats New!</b></p> <ul> <li>A new Version has been relased! 17.<font color="red">1</font>.<font color="red">0</font>!</li> <li>Branching 17.1.0 Master and 17.1.1 as Branch. Changes will be rolled into master as the prove to be stable</li> <li>ISE Bypass and Bypass tracking features are functional</li> <li>General UI Changes</li> <li>ISE BYPASS page added</li> <li>Authentication page added</li> <li>More robust hostname looks comparing DNS and PING results</li> <li>All REST interactions are now completed through an Object</li> </ul> <p>The purpose of these tools is to provide insight into the operations of particular systems in a more easily absorbed format.</p>
57.466667
131
0.725058
24f57c8a0c55e313dfda3b39c57dfdbe0eeab567
127
sql
SQL
scripts/plugins/storage/sqlite/upgrade/28.sql
doug-dianomic/fledge
cab620d1f31e6dca8e31ca8e483adaad7ce94834
[ "Apache-2.0" ]
69
2019-12-03T17:54:33.000Z
2022-03-13T07:05:23.000Z
scripts/plugins/storage/sqlite/upgrade/28.sql
doug-dianomic/fledge
cab620d1f31e6dca8e31ca8e483adaad7ce94834
[ "Apache-2.0" ]
125
2020-02-13T15:11:28.000Z
2022-03-29T14:42:36.000Z
scripts/plugins/storage/sqlite/upgrade/28.sql
doug-dianomic/fledge
cab620d1f31e6dca8e31ca8e483adaad7ce94834
[ "Apache-2.0" ]
24
2019-12-27T07:48:45.000Z
2022-03-13T07:05:28.000Z
-- Add audit log key NTFCL INSERT INTO fledge.log_codes ( code, description ) VALUES ( 'NTFCL', 'Notification Cleared' );
31.75
50
0.700787
e149413ab2e775299c770ea49ce64375b2858027
896
sql
SQL
queries/stackoverflow/q16/ae013d4fafab6acff1cde17161da595b510627c7.sql
christophanneser/Bao-for-Presto
b1d93689025d51cdea1a2e81edb8f077df8afcc1
[ "MIT" ]
null
null
null
queries/stackoverflow/q16/ae013d4fafab6acff1cde17161da595b510627c7.sql
christophanneser/Bao-for-Presto
b1d93689025d51cdea1a2e81edb8f077df8afcc1
[ "MIT" ]
null
null
null
queries/stackoverflow/q16/ae013d4fafab6acff1cde17161da595b510627c7.sql
christophanneser/Bao-for-Presto
b1d93689025d51cdea1a2e81edb8f077df8afcc1
[ "MIT" ]
null
null
null
SELECT COUNT(*) FROM site AS s, so_user AS u1, tag AS t1, tag_question AS tq1, question AS q1, badge AS b1, account AS acc WHERE s.site_id = u1.site_id AND s.site_id = b1.site_id AND s.site_id = t1.site_id AND s.site_id = tq1.site_id AND s.site_id = q1.site_id AND t1.id = tq1.tag_id AND q1.id = tq1.question_id AND q1.owner_user_id = u1.id AND acc.id = u1.account_id AND b1.user_id = u1.id AND (q1.score >= 0) AND (q1.score <= 0) AND s.site_name = 'stackoverflow' AND (t1.name in ('aggregation', 'export-to-csv', 'magento-1.7', 'nativescript', 'ninject', 'pycharm', 'silverlight', 'submit', 'toolbar', 'unity-container')) AND (LOWER(acc.website_url) LIKE ('%code%'))
28
46
0.526786
7b34c076123240063ce080384f82cf4d3e2bb4a5
643
rb
Ruby
spec/omniauth/fedid_oauth_spec.rb
justcodeio/omniauth-fedid
210e6159a9cfd228287d9aa7a56d32df7bc41a0f
[ "MIT" ]
1
2020-04-30T12:43:27.000Z
2020-04-30T12:43:27.000Z
spec/omniauth/fedid_oauth_spec.rb
justcodeio/omniauth-fedid
210e6159a9cfd228287d9aa7a56d32df7bc41a0f
[ "MIT" ]
2
2019-12-19T05:33:36.000Z
2020-06-25T02:47:06.000Z
spec/omniauth/fedid_oauth_spec.rb
justcodeio/omniauth-fedid
210e6159a9cfd228287d9aa7a56d32df7bc41a0f
[ "MIT" ]
null
null
null
require "spec_helper" describe OmniAuth::Strategies::FedidOauth do subject do OmniAuth::Strategies::FedidOauth.new({}) end it "has a version number" do expect(Omniauth::Fedid::VERSION).not_to be nil end context "client options" do it 'should have correct name' do expect(subject.options.name).to eq("fedid_oauth") end it 'should have correct token url' do expect(subject.options.client_options.token_url).to eq('/as/token.oauth2') end it 'should have correct authorize url' do expect(subject.options.client_options.authorize_url).to eq('/as/authorization.oauth2') end end end
24.730769
92
0.707621
e2a207d1255dc46d8924003d8a7acb528258d368
2,521
py
Python
ima_control/scripts/plot.py
RCPRG-ros-pkg/turtlebot3_ima
7a267177741fc9fe3552ed3a97170012f4bb377a
[ "Apache-2.0" ]
null
null
null
ima_control/scripts/plot.py
RCPRG-ros-pkg/turtlebot3_ima
7a267177741fc9fe3552ed3a97170012f4bb377a
[ "Apache-2.0" ]
null
null
null
ima_control/scripts/plot.py
RCPRG-ros-pkg/turtlebot3_ima
7a267177741fc9fe3552ed3a97170012f4bb377a
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python # encoding: utf8 import rospy import datetime from gazebo_msgs.msg import ModelStates from std_msgs.msg import Float64 import numpy as np import matplotlib from matplotlib import pyplot as plt GAZEBO_SCALE=1 def callback(data): global plot_omega, plot_vu, ros_time, plot_time vu = data.twist[1].linear.x omega = data.twist[1].angular.z print 'vu: ', vu, '\n omega: ', omega plot_vu.append(vu) plot_omega.append(omega) time_stamp = rospy.Time.now()-ros_time plot_time.append(time_stamp.to_sec()) def listener(): global plot_omega, plot_vu, ros_time, plot_time rospy.init_node('ima_plot', anonymous=True) plot_omega = [] plot_vu = [] plot_time = [] # In ROS, nodes are uniquely named. If two nodes with the same # name are launched, the previous one is kicked off. The # anonymous=True flag means that rospy will choose a unique # name for our 'listener' node so that multiple listeners can # run simultaneously. raw_input("Press Enter to continue...") ros_time = rospy.Time.now() rospy.Subscriber("/gazebo/model_states", ModelStates, callback) # EFFORT CONTROLLER CONFIGURATION left_wheel = rospy.Publisher("/turtlebot/wheel_left_effort_controller/command", Float64, queue_size=10) right_wheel = rospy.Publisher("/turtlebot/wheel_right_effort_controller/command", Float64, queue_size=10) # VELOCITY CONTROLLER CONFIGURATION # left_wheel = rospy.Publisher("/turtlebot/wheel_left_velocity_controller/command", Float64, queue_size=10) # right_wheel = rospy.Publisher("/turtlebot/wheel_right_velocity_controller/command", Float64, queue_size=10) # spin() simply keeps python from exiting until this node is stopped while not rospy.is_shutdown(): rospy.sleep(1) left_wheel.publish(0.0015*GAZEBO_SCALE) right_wheel.publish(-0.0015*GAZEBO_SCALE) rospy.sleep(10) left_wheel.publish(0.0015*GAZEBO_SCALE) right_wheel.publish(0.0*GAZEBO_SCALE) rospy.sleep(5) left_wheel.publish(-0.0015*GAZEBO_SCALE) right_wheel.publish(-0.0015*GAZEBO_SCALE) rospy.sleep(5) left_wheel.publish(0.0*GAZEBO_SCALE) right_wheel.publish(0.0*GAZEBO_SCALE) rospy.sleep(10) break plt.plot(plot_time,plot_vu); plt.title("Linear velocity") plt.show() plt.plot(plot_time,plot_omega); plt.title("Angular velocity") plt.show() if __name__ == '__main__': listener()
35.507042
113
0.704879
ce8c88a2c3475032df22b132a242daedfe9aa3ba
1,546
rs
Rust
src/format/fourcc.rs
Maxung/libv4l-rs
2e4139fa49137595a2f86e5656ed4a21513cb33b
[ "MIT" ]
null
null
null
src/format/fourcc.rs
Maxung/libv4l-rs
2e4139fa49137595a2f86e5656ed4a21513cb33b
[ "MIT" ]
null
null
null
src/format/fourcc.rs
Maxung/libv4l-rs
2e4139fa49137595a2f86e5656ed4a21513cb33b
[ "MIT" ]
null
null
null
use std::{fmt, str}; #[derive(Debug, Default, Copy, Clone, Eq)] /// Four character code representing a pixelformat pub struct FourCC { pub repr: [u8; 4], } impl FourCC { #[allow(clippy::trivially_copy_pass_by_ref)] /// Returns a pixelformat as four character code /// /// # Arguments /// /// * `repr` - Four characters as raw bytes /// /// # Example /// /// ``` /// use v4l::format::FourCC; /// let fourcc = FourCC::new(b"YUYV"); /// ``` pub fn new(repr: &[u8; 4]) -> FourCC { FourCC { repr: *repr } } /// Returns the string representation of a four character code /// /// # Example /// /// ``` /// use v4l::format::FourCC; /// let fourcc = FourCC::new(b"YUYV"); /// let str = fourcc.str().unwrap(); /// ``` pub fn str(&self) -> Result<&str, str::Utf8Error> { str::from_utf8(&self.repr) } } impl fmt::Display for FourCC { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let string = str::from_utf8(&self.repr); if let Ok(string) = string { write!(f, "{}", string)?; } Ok(()) } } impl PartialEq for FourCC { fn eq(&self, other: &FourCC) -> bool { self.repr.iter().zip(other.repr.iter()).all(|(a, b)| a == b) } } impl From<u32> for FourCC { fn from(code: u32) -> Self { FourCC::new(&code.to_le_bytes()) } } impl From<FourCC> for u32 { fn from(fourcc: FourCC) -> Self { Self::from_le_bytes(fourcc.repr) } }
22.735294
68
0.52652
27a02a69334d3e8803fff928959fd9f991f4fc24
2,836
sql
SQL
dbpatch/1480478466.sql
naldz/cyberden
14fd41701880b03cf5557f859f3ecd4e501075d2
[ "MIT" ]
null
null
null
dbpatch/1480478466.sql
naldz/cyberden
14fd41701880b03cf5557f859f3ecd4e501075d2
[ "MIT" ]
6
2016-12-31T10:36:11.000Z
2016-12-31T10:40:11.000Z
dbpatch/1480478466.sql
naldz/cyberden
14fd41701880b03cf5557f859f3ecd4e501075d2
[ "MIT" ]
null
null
null
-- MySQL Script generated by MySQL Workbench -- Sun Dec 4 10:21:30 2016 -- Model: New Model Version: 1.0 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema mydb -- ----------------------------------------------------- -- ----------------------------------------------------- -- Table `station` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `station` ( `id` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(45) NULL, `mac_address` VARCHAR(20) NOT NULL, `is_commissioned` TINYINT UNSIGNED NOT NULL COMMENT 'Determines if a station is working or not' /* comment truncated */ /*1 = Working 2 = Not working*/, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `administrator` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `administrator` ( `id` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(200) NOT NULL, `username` VARCHAR(20) NOT NULL, `password` VARCHAR(100) NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `session` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `session` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `station_id` SMALLINT UNSIGNED NOT NULL, `administrator_id` SMALLINT UNSIGNED NOT NULL, `duration` SMALLINT NULL COMMENT 'duration in minutes', `duration_end_time` DATETIME NOT NULL, `start_time` DATETIME NOT NULL, `end_time` DATETIME NULL, `cost` DECIMAL(10,2) UNSIGNED NOT NULL DEFAULT 0.00, `is_paid` TINYINT NOT NULL DEFAULT 0, `comment` TEXT NULL, `is_in_session` TINYINT UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (`id`), INDEX `fk_session_station_idx` (`station_id` ASC), INDEX `fk_session_administrator1_idx` (`administrator_id` ASC), CONSTRAINT `fk_session_station` FOREIGN KEY (`station_id`) REFERENCES `station` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_session_administrator1` FOREIGN KEY (`administrator_id`) REFERENCES `administrator` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `setting` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `setting` ( `id` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, `rental_price` SMALLINT UNSIGNED NOT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
35.012346
135
0.587094
edd3dc5557c2e3aa012319f3de2583715185f13c
8,128
swift
Swift
MHW/Controller/HighlightGemsViewController.swift
jeffeom/MHW
e4d36b0e27e318a1323dd5e985842e433feca3d6
[ "Apache-2.0" ]
null
null
null
MHW/Controller/HighlightGemsViewController.swift
jeffeom/MHW
e4d36b0e27e318a1323dd5e985842e433feca3d6
[ "Apache-2.0" ]
null
null
null
MHW/Controller/HighlightGemsViewController.swift
jeffeom/MHW
e4d36b0e27e318a1323dd5e985842e433feca3d6
[ "Apache-2.0" ]
null
null
null
// // HighlightGemsViewController.swift // MHW // // Created by Jeff Eom on 2018-04-21. // Copyright © 2018 Jeff Eom. All rights reserved. // import UIKit import CoreData import GoogleMobileAds class HighlightGemsViewController: UIViewController { static let identifier = "highlightGemsVC" @IBOutlet weak var gemListTableView: UITableView! @IBOutlet weak var viewBottomConstraintForBanner: NSLayoutConstraint! @IBOutlet weak var bannerView: GADBannerView! let hangulSystem = YKHangul() var gemsArray: [String] = [] var alphabetDict: [String: [String]] = [:] var sortedKeysInDict: [String] = [] var gemsToHighlight: [String] = [] var gemHighlightList = GemHighlightList(context: PersistenceService.context) override func viewDidLoad() { super.viewDidLoad() automaticallyAdjustsScrollViewInsets = false title = "Highlight Gems".localized() let purchased = UserDefaults.standard.value(forKey: "purchasedAdsRemoval") as? Bool ?? false if purchased { bannerView.isHidden = true viewBottomConstraintForBanner.constant = 0 }else { bannerView.isHidden = false viewBottomConstraintForBanner.constant = 50 bannerView.adUnitID = Key.adUnitID bannerView.rootViewController = self bannerView.load(GADRequest()) } fetchGemssFromJSON() let gemHighlightListFetchRequest: NSFetchRequest<GemHighlightList> = GemHighlightList.fetchRequest() do { var gemHighlightLists = try PersistenceService.context.fetch(gemHighlightListFetchRequest) if gemHighlightLists.count > 1 { let arraysToErase = gemHighlightLists.filter({ $0.gems?.count == 0 }) for anArrayToErase in arraysToErase { PersistenceService.context.delete(anArrayToErase as NSManagedObject) gemHighlightLists.remove(at: gemHighlightLists.index(of: anArrayToErase)!) PersistenceService.saveContext() } } if !gemHighlightLists.isEmpty { gemHighlightList = gemHighlightLists[0] let gemsArray = Array(gemHighlightList.gems ?? []) as! [Gem] self.gemsToHighlight = gemsArray.compactMap({ $0.name ?? "" }) gemListTableView.reloadData() }else { gemHighlightList = GemHighlightList(context: PersistenceService.context) gemListTableView.reloadData() } }catch { print(error.localizedDescription) } } } //MARK: IBActions extension HighlightGemsViewController { @IBAction func pressedSaveButton(_ sender: UIBarButtonItem) { self.deleteAllData() for i in 0..<gemsToHighlight.count { let gem = Gem(context: PersistenceService.context) gem.name = gemsToHighlight[i] gemHighlightList.addToGems(gem) } PersistenceService.saveContext() let alert = UIAlertController(title: "", message: "Saved successfully".localized(), preferredStyle: .alert) self.present(alert, animated: true, completion: nil) let when = DispatchTime.now() + 2 DispatchQueue.main.asyncAfter(deadline: when){ alert.dismiss(animated: true, completion: { self.navigationController?.popViewController(animated: true) }) } } @IBAction func pressedResetButton(_ sender: UIButton) { let alertController = UIAlertController(title: "Reset?".localized(), message: "Do you want to start from the beginning?".localized(), preferredStyle: .alert) let resetAction = UIAlertAction(title: "Reset".localized(), style: .destructive) { (_) in print("reset") self.deleteAllData() self.gemsToHighlight = [] self.gemListTableView.reloadData() } let cancelAction = UIAlertAction(title: "Cancel".localized(), style: .cancel, handler: nil) alertController.addAction(resetAction) alertController.addAction(cancelAction) present(alertController, animated: true, completion: nil) } fileprivate func deleteAllData(){ let count = (gemHighlightList.gems?.count ?? 0) for _ in 0..<count { gemHighlightList.removeFromGems(at: 0) } PersistenceService.saveContext() } } //MARK: Setup extension HighlightGemsViewController { func fetchGemssFromJSON() { if let path = Bundle.main.path(forResource: "gem_en".localized(), ofType: "json") { do { let data = try Data(contentsOf: URL(fileURLWithPath: path), options: .mappedIfSafe) let jsonResult = try JSONSerialization.jsonObject(with: data, options: .mutableLeaves) if let jsonResult = jsonResult as? [String: AnyObject], let gemDictArray = jsonResult["gem"] as? [[String: AnyObject]] { // do stuff for aGemDict in gemDictArray { let gem = aGemDict["name"] as! String gemsArray.append(gem) var initialLetter = String(gem.uppercased().first ?? " ".first!) let currentLang = UserDefaults.standard.array(forKey: "AppleLanguages")?.first as? String if (currentLang?.contains("ko") ?? false) { initialLetter = hangulSystem.getStringConsonant(string: String(gem.first ?? " ".first!), consonantType: .Initial) } var letterArray = alphabetDict[initialLetter] ?? [String]() letterArray.append(gem) alphabetDict[initialLetter] = letterArray sortedKeysInDict = Array(alphabetDict.keys).sorted(by: <) gemListTableView.reloadData() } } } catch { print(error.localizedDescription) } } } } //MARK: UITableViewDelegate & Datasource extension HighlightGemsViewController: UITableViewDelegate, UITableViewDataSource { func numberOfSections(in tableView: UITableView) -> Int { return sortedKeysInDict.count } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return alphabetDict[sortedKeysInDict[section]]?.count ?? 0 } func sectionIndexTitles(for tableView: UITableView) -> [String]? { return sortedKeysInDict } func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { return sortedKeysInDict[section] } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = UITableViewCell(style: .default, reuseIdentifier: "gemCell") cell.textLabel?.font = UIFont(name: "Avenir", size: 18) cell.textLabel?.textColor = UIColor(red: 67/255, green: 61/255, blue: 63/255, alpha: 1.0) cell.textLabel?.text = alphabetDict[sortedKeysInDict[indexPath.section]]?[indexPath.row] cell.selectionStyle = .none if gemsToHighlight.contains((alphabetDict[sortedKeysInDict[indexPath.section]]?[indexPath.row])!) { cell.accessoryType = .checkmark cell.isSelected = true }else { cell.accessoryType = .none cell.isSelected = false } return cell } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let cell = tableView.cellForRow(at: indexPath) guard let theGem = cell?.textLabel?.text else { return } if cell?.accessoryType == .checkmark { if gemsToHighlight.contains(theGem) { guard let ip = gemsToHighlight.index(of: theGem) else { return } gemsToHighlight.remove(at: ip) cell?.accessoryType = .none } }else if cell?.accessoryType == UITableViewCellAccessoryType.none { if !gemsToHighlight.contains(theGem) { gemsToHighlight.append(theGem) cell?.accessoryType = .checkmark } } } func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) { let cell = tableView.cellForRow(at: indexPath) guard let theGem = cell?.textLabel?.text else { return } if cell?.accessoryType == .checkmark { if gemsToHighlight.contains(theGem) { guard let ip = gemsToHighlight.index(of: theGem) else { return } gemsToHighlight.remove(at: ip) cell?.accessoryType = .none } }else if cell?.accessoryType == UITableViewCellAccessoryType.none { if !gemsToHighlight.contains(theGem) { gemsToHighlight.append(theGem) cell?.accessoryType = .checkmark } } } }
38.521327
161
0.688361
e322860fb0a3969c53408348b308e3830c0fe994
179
sql
SQL
db/schema.sql
MJ-0001/tech-blog
4b9f22a378307361fe606dacc760bdb683236e04
[ "MIT" ]
null
null
null
db/schema.sql
MJ-0001/tech-blog
4b9f22a378307361fe606dacc760bdb683236e04
[ "MIT" ]
null
null
null
db/schema.sql
MJ-0001/tech-blog
4b9f22a378307361fe606dacc760bdb683236e04
[ "MIT" ]
null
null
null
-- If this db already exists, drop it DROP DATABASE IF EXISTS tech_blog_db; -- Create a new db CREATE DATABASE tech_blog_db; -- Select the db for use in mysql USE tech_blog_db;
19.888889
37
0.759777
df1e7c0df712bda9d9890bcfb1f1a7940e1edab8
75
gemspec
Ruby
dpl-pages.gemspec
djpohly/dpl
000fc083115abc6cd96771bcfe3dc43cb4f1e391
[ "MIT" ]
1
2018-10-20T19:32:47.000Z
2018-10-20T19:32:47.000Z
dpl-pages.gemspec
djpohly/dpl
000fc083115abc6cd96771bcfe3dc43cb4f1e391
[ "MIT" ]
null
null
null
dpl-pages.gemspec
djpohly/dpl
000fc083115abc6cd96771bcfe3dc43cb4f1e391
[ "MIT" ]
1
2018-10-20T19:32:50.000Z
2018-10-20T19:32:50.000Z
require './gemspec_helper' gemspec_for 'pages', [['octokit', '~> 4.6.2']]
18.75
46
0.626667
1e3477b1e3422075c4fcc687ed88a20e918eae4e
403
dart
Dart
lib/src/base_cluster.dart
androidmaven/fluster
42361da0f91e8ce70faf0818a2e50c17b7422a52
[ "MIT" ]
null
null
null
lib/src/base_cluster.dart
androidmaven/fluster
42361da0f91e8ce70faf0818a2e50c17b7422a52
[ "MIT" ]
null
null
null
lib/src/base_cluster.dart
androidmaven/fluster
42361da0f91e8ce70faf0818a2e50c17b7422a52
[ "MIT" ]
null
null
null
/* * Created by Alfonso Cejudo, Sunday, July 21st 2019. */ class BaseCluster { double x; double y; int zoom; int pointsSize; int parentId; int index; int id; bool isCluster = false; /// For PointCluster instances that are standalone (i.e. not cluster) items. String markerId; /// For clusters that wish to display one representation of its children. String childMarkerId; }
19.190476
78
0.69727
a686ae95ef5bec6a5bd7204859db603ee0f8a72f
2,796
sql
SQL
banco.sql
mateusschwede/Manutech
5636374b94e4999d665984e4cdbaf1060ddc96b0
[ "MIT" ]
null
null
null
banco.sql
mateusschwede/Manutech
5636374b94e4999d665984e4cdbaf1060ddc96b0
[ "MIT" ]
null
null
null
banco.sql
mateusschwede/Manutech
5636374b94e4999d665984e4cdbaf1060ddc96b0
[ "MIT" ]
null
null
null
CREATE DATABASE oficina CHARSET = utf8; USE oficina; CREATE TABLE usuario ( id INTEGER NOT NULL AUTO_INCREMENT, nome VARCHAR(50) NOT NULL, senha VARCHAR(5) NOT NULL, PRIMARY KEY(id) ) CHARSET=utf8; CREATE TABLE fornecedor ( cnpj BIGINT(14) NOT NULL, nome VARCHAR(50) NOT NULL, telefone BIGINT(11) NOT NULL, endereco VARCHAR(350) NOT NULL, ativo BOOLEAN NOT NULL DEFAULT true, PRIMARY KEY(cnpj) ) CHARSET=utf8; CREATE TABLE cliente ( cpf BIGINT(11) NOT NULL, nome VARCHAR(50) NOT NULL, telefone BIGINT(11) NOT NULL, endereco VARCHAR(350) NOT NULL, ativo BOOLEAN NOT NULL DEFAULT true, PRIMARY KEY(cpf) ) CHARSET=utf8; CREATE TABLE veiculo ( placa VARCHAR(7) NOT NULL, modelo VARCHAR(100) NOT NULL, quilometragem FLOAT NOT NULL, cpfProprietario BIGINT(11) NOT NULL, ativo BOOLEAN NOT NULL DEFAULT true, PRIMARY KEY(placa) ) CHARSET=utf8; CREATE TABLE item ( id INTEGER NOT NULL AUTO_INCREMENT, descricao VARCHAR(50) NOT NULL, valor FLOAT NOT NULL DEFAULT 0.00, cnpjFornecedor BIGINT(14) NOT NULL, ativo BOOLEAN NOT NULL DEFAULT true, PRIMARY KEY(id) ) CHARSET=utf8; CREATE TABLE ordem ( id INTEGER NOT NULL AUTO_INCREMENT, placaVeiculo VARCHAR(7) NOT NULL, cpfProprietario BIGINT(11) NOT NULL, dataRegistro DATETIME NOT NULL, valorTotal FLOAT NOT NULL DEFAULT 0.00, aberta BOOLEAN NOT NULL DEFAULT true, servico VARCHAR(100) NOT NULL DEFAULT "Não descrito", valorServico FLOAT NOT NULL DEFAULT 0.00, PRIMARY KEY(id) ) CHARSET=utf8; CREATE TABLE itemOrdem ( idOrdem INTEGER NOT NULL, idItem INTEGER NOT NULL, qtItem INTEGER(100) NOT NULL, valorTotItem FLOAT NOT NULL DEFAULT 0.00 ) CHARSET=utf8; INSERT INTO usuario(nome, senha) VALUES ("ma",11111); INSERT INTO fornecedor(cnpj, nome, telefone, endereco, ativo) VALUES (04040400404403,"volvo express",51992392828,"rua ermindo mayrer, 319, feliz - rs",1),(04040400404444,"volvo express",51992392828,"rua ermindo mayrer, 319, feliz - rs",1),(04040400404448,"volvo express",51992392828,"rua ermindo mayrer, 319, feliz - rs",0); INSERT INTO cliente(cpf, nome, telefone, endereco, ativo) VALUES (04044455511,"mateus",51992382929,"rua xyz",1),(04044455522,"mateus2",51992382929,"rua xyz",1),(04044455532,"mateus3",51992388829,"rua zzz",0); INSERT INTO item(descricao, valor, cnpjFornecedor, ativo) VALUES ("óleo lubrificante",300.23,04040400404403,1),("óleo lubrificante2",566.23,04040400404444,1),("óleo lubrificante3",900.50,04040400404444,0); INSERT INTO veiculo(placa, modelo, quilometragem, cpfProprietario) VALUES ("ipq3030","vw gol 1.0 2008, vermelho",12000,04044455511),("ipq3031","vw golf 2.0 2005, branco",82000,04044455511),("zzz6031","vw up 1.0 tsi 2018, preto",2000,04044455511);
39.942857
324
0.728898
fa33c7e062e7c5ed1374704d895628d0627ec2a1
2,474
hpp
C++
include/rcppmath/clamp.hpp
shumov-ag/rcpputils
a7898d98ab684bb5d0cb2c20c823a1b4014fa0dc
[ "Apache-2.0" ]
14
2019-05-05T06:36:41.000Z
2022-02-11T06:43:37.000Z
include/rcppmath/clamp.hpp
shumov-ag/rcpputils
a7898d98ab684bb5d0cb2c20c823a1b4014fa0dc
[ "Apache-2.0" ]
125
2019-02-26T18:38:18.000Z
2022-01-21T20:18:59.000Z
include/rcppmath/clamp.hpp
shumov-ag/rcpputils
a7898d98ab684bb5d0cb2c20c823a1b4014fa0dc
[ "Apache-2.0" ]
39
2019-02-26T18:12:29.000Z
2022-03-11T15:23:01.000Z
// Copyright 2020 PAL Robotics S.L. // // 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. /*! \file clamp.hpp * \brief Restrict a value between two bounds. */ #ifndef RCPPMATH__CLAMP_HPP_ #define RCPPMATH__CLAMP_HPP_ #include <cassert> namespace rcppmath { /** * If v compares less than lo, returns lo; otherwise if hi compares less * than v, returns hi; otherwise returns v. Uses operator< to compare the values. * * \param[in] v The value to clamp. * \param[in] lo The lower boundary. * \param[in] hi The higher boundary. * \return Reference to lo if v is less than lo, reference to hi if hi is less than v, otherwise * reference to v. * \note Implementation from https://en.cppreference.com/w/cpp/algorithm/clamp. * \warning Capturing the result of clamp by reference if one of the parameters is rvalue produces * a dangling reference if that parameter is returned. */ template<class T> constexpr const T & clamp(const T & v, const T & lo, const T & hi) { assert(!(hi < lo) ); return (v < lo) ? lo : (hi < v) ? hi : v; } /** * Performs clamping with a provided Comparison object (comp). * * \param[in] v The value to clamp. * \param[in] lo The lower boundary. * \param[in] hi The higher boundary. * \param[in] comp Comparison object that returns true if the first argument is * less than the second. * \return Reference to lo if v is less than lo, reference to hi if hi is less than v, otherwise * reference to v. "Less than" semantics determined by Comparison object. * \warning Capturing the result of clamp by reference if one of the parameters is rvalue produces * a dangling reference if that parameter is returned. * \sa rcppmath::clamp(const T&, const T&, const T&) */ template<class T, class Compare> constexpr const T & clamp(const T & v, const T & lo, const T & hi, Compare comp) { assert(!comp(hi, lo) ); return comp(v, lo) ? lo : comp(hi, v) ? hi : v; } } // namespace rcppmath #endif // RCPPMATH__CLAMP_HPP_
35.342857
98
0.710994
eb591f75b1d84ed69ccde4f663c2d583b79f321e
1,692
swift
Swift
Instories/Models/MailControllerPresenter.swift
yakovlevvl/Instories
44bfe4fadf20eaacc80e1b498448360802dd2d5f
[ "Apache-2.0" ]
37
2019-03-08T21:51:19.000Z
2021-09-08T13:23:51.000Z
Instories/Models/MailControllerPresenter.swift
mohsinalimat/Instories
e6217c0121d6627c3c1d13b106155d99dba65c6d
[ "Apache-2.0" ]
4
2020-01-23T07:05:30.000Z
2020-08-04T01:45:31.000Z
Instories/Models/MailControllerPresenter.swift
mohsinalimat/Instories
e6217c0121d6627c3c1d13b106155d99dba65c6d
[ "Apache-2.0" ]
14
2019-04-03T20:59:41.000Z
2021-08-06T14:36:15.000Z
// // MailControllerPresenter.swift // Instories // // Created by Vladyslav Yakovlev on 25.07.2018. // Copyright © 2018 Vladyslav Yakovlev. All rights reserved. // import MessageUI final class MailControllerPresenter: NSObject { func present(from сontroller: UIViewController) { let device = UIDevice.current.modelName let systemVersion = UIDevice.current.systemVersion let appVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString")! let appName = AppInfo.appName let info = "\n\n---\nPlease don't remove the following technical info:\nApp version - \(appVersion)\nDevice - \(device)\niOS version - \(systemVersion)" if MFMailComposeViewController.canSendMail() { let mailController = MFMailComposeViewController() mailController.mailComposeDelegate = self mailController.setSubject(appName) mailController.setMessageBody(info, isHTML: false) mailController.setToRecipients(["[email protected]"]) сontroller.present(mailController, animated: true) } else { let alertVC = UIAlertController(title: "Error", message: "Sorry, you need to setup mail first!", preferredStyle: .alert) alertVC.addAction(UIAlertAction(title: "OK", style: .cancel)) сontroller.present(alertVC, animated: true) } } } extension MailControllerPresenter: MFMailComposeViewControllerDelegate { func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) { controller.dismiss(animated: true) } }
40.285714
160
0.693262
b95122194b2f276382ba5f4c88950110ccf44ae9
4,414
swift
Swift
Mongli/Mongli/Source/Flows/MoreFlow.swift
Furkanus/Mongli
61b6dcddec36733d656b8eecaf671fc3077c7b06
[ "MIT" ]
9
2019-12-11T11:02:15.000Z
2021-05-27T00:32:08.000Z
Mongli/Mongli/Source/Flows/MoreFlow.swift
Furkanus/Mongli
61b6dcddec36733d656b8eecaf671fc3077c7b06
[ "MIT" ]
2
2020-02-06T18:13:44.000Z
2021-09-01T03:06:33.000Z
Mongli/Mongli/Source/Flows/MoreFlow.swift
Furkanus/Mongli
61b6dcddec36733d656b8eecaf671fc3077c7b06
[ "MIT" ]
4
2020-02-09T16:09:19.000Z
2021-09-06T12:38:39.000Z
// // MoreFlow.swift // Mongli // // Created by DaEun Kim on 2020/03/20. // Copyright © 2020 DaEun Kim. All rights reserved. // import UIKit import Carte import RxCocoa import RxFlow import RxSwift // MARK: Flow final class MoreFlow: Flow { var root: Presentable { return self.rootViewController } lazy private var rootViewController = { return MoreViewController(self.reactor) }() private let reactor: MoreViewReactor private let service: AuthService private let navigationController = UINavigationController() private let carteViewController = OpensourceLisenceViewController() init(_ service: AuthService) { self.service = service self.reactor = MoreViewReactor(service) } func navigate(to step: Step) -> FlowContributors { guard let step = step as? MongliStep else { return .none } switch step { case .toast(let message): return self.showToast(message: message) case let .alert(type, handler): return self.presentAlert(type, handler: handler) case .signInIsRequired: (UIApplication.shared.delegate as? AppDelegate)?.signInIsRequired() return .none case .categoryInfoIsRequired: return self.presentCategoryInfo() case .moreIsRequired: return self.navigateToMore() case let .accountManagementIsRequired(logoutHandler, deleteUserHandler, renameHandler): return self.presentAccountManagementActionSheet(logoutHandler, deleteUserHandler, renameHandler) case .opensourceLisenceIsRequired: return self.presentOpensourceLisence() case .contactIsRequired: return self.presentContact() default: return .none } } } // MARK: navigate functions extension MoreFlow { private func showToast(message: LocalizedString) -> FlowContributors { self.rootViewController.showToast(message) return .none } private func presentAlert(_ type: UIViewController.AlertType, handler: ((UIAlertAction) -> Void)?) -> FlowContributors { self.rootViewController.presentAlert(type, handler: handler) return .none } private func presentCategoryInfo() -> FlowContributors { let vc = CategoryInfoViewController() self.rootViewController.present(vc, animated: true) return .none } private func navigateToMore() -> FlowContributors { return .one(flowContributor: .contribute(withNextPresentable: self.rootViewController, withNextStepper: self.reactor)) } private func presentContact() -> FlowContributors { guard let url = URL(string: "mailto:[email protected]") else { return self.showToast(message: .unknownErrorMsg) } UIApplication.shared.open(url, options: [:], completionHandler: nil) return .none } private func presentOpensourceLisence() -> FlowContributors { navigationController.viewControllers = [carteViewController] self.rootViewController.present(navigationController, animated: true, completion: nil) return .none } private func presentAccountManagementActionSheet(_ logoutHandler: ((UIAlertAction) -> Void)?, _ deleteUserHandler: ((UIAlertAction) -> Void)?, _ renameHandler: @escaping ((String?) -> Void)) -> FlowContributors { let actionSheet = UIAlertController(title: .accountManagement, message: nil, style: .actionSheet) let logoutAction = UIAlertAction(title: .logout, style: .destructive, handler: logoutHandler) let deleteUserAction = UIAlertAction(title: .deleteUser, style: .destructive) { [weak self] _ in self?.rootViewController.presentAlert(.deleteUser, handler: deleteUserHandler) AnalyticsManager.view_more_menu_accountManagement_deleteUser.log(nil) } let renameAction = UIAlertAction(title: .rename, style: .default) { [weak self] _ in self?.rootViewController.presentAlert(.rename(renameHandler)) AnalyticsManager.view_more_menu_accountManagement_rename.log(nil) } let cancelAction = UIAlertAction(title: .cancel, style: .cancel, handler: nil) actionSheet.addAction(logoutAction) actionSheet.addAction(deleteUserAction) actionSheet.addAction(renameAction) actionSheet.addAction(cancelAction) self.rootViewController.present(actionSheet, animated: true, completion: nil) return .none } }
31.528571
120
0.708881
bf566a833ddfb6582a9a8e31c2f5ce975b67f29a
5,365
swift
Swift
Lendr/Lendr/Model Controllers/NetworkingController.swift
Build-Week-Lendr/iOS
217df22b302b92f54021c85f742a121246c1276a
[ "MIT" ]
null
null
null
Lendr/Lendr/Model Controllers/NetworkingController.swift
Build-Week-Lendr/iOS
217df22b302b92f54021c85f742a121246c1276a
[ "MIT" ]
null
null
null
Lendr/Lendr/Model Controllers/NetworkingController.swift
Build-Week-Lendr/iOS
217df22b302b92f54021c85f742a121246c1276a
[ "MIT" ]
null
null
null
// // NetworkingController.swift // Lendr // // Created by Isaac Lyons on 11/18/19. // Copyright © 2019 Lambda School. All rights reserved. // import Foundation enum HeaderNames: String { case auth = "Authorization" case contentType = "Content-Type" } class NetworkingController { let baseURL = URL(string: "https://zero5nelsonm-lendr.herokuapp.com")! let networkLoader: NetworkDataLoader let jsonDecoder = JSONDecoder() let jsonEncoder = JSONEncoder() static var bearer: Bearer? init(networkLoader: NetworkDataLoader = URLSession.shared) { self.networkLoader = networkLoader } func fetch<Type: Codable>(from url: URL, completion: @escaping (Type?, Error?) -> Void) { guard let bearer = NetworkingController.bearer else { completion(nil, NSError()) return } var request = URLRequest(url: url) request.setValue("Bearer \(bearer.accessToken)", forHTTPHeaderField: HeaderNames.auth.rawValue) networkLoader.loadData(with: request) { data, error in if let error = error { completion(nil, error) return } guard let data = data else { completion(nil, NSError()) return } do { let decodedObject = try self.jsonDecoder.decode(Type.self, from: data) completion(decodedObject, nil) } catch { completion(nil, error) } } } func signUp(user: SignUpUser, completion: @escaping (SignInResponse?, Error?) -> Void) { let url = baseURL.appendingPathComponent("createnewuser") var request = URLRequest(url: url) request.httpMethod = "POST" request.setValue("application/json", forHTTPHeaderField: HeaderNames.contentType.rawValue) do { let encodedUser = try jsonEncoder.encode(user) request.httpBody = encodedUser } catch { completion(nil, error) } networkLoader.loadData(with: request) { data, error in if let error = error { completion(nil, error) return } guard let data = data else { completion(nil, NSError()) return } do { let signInResponse = try self.jsonDecoder.decode(SignInResponse.self, from: data) completion(signInResponse, nil) } catch { completion(nil, error) } } } static func signIn(token: String) { bearer = Bearer(accessToken: token) } func fetchUserInfo(completion: @escaping (UserDetails?, Error?) -> Void) { guard let bearer = NetworkingController.bearer else { completion(nil, NSError()) return } let url = baseURL .appendingPathComponent("users") .appendingPathComponent("getuserinfo") var request = URLRequest(url: url) request.setValue("Bearer \(bearer.accessToken)", forHTTPHeaderField: HeaderNames.auth.rawValue) networkLoader.loadData(with: request) { data, error in if let error = error { completion(nil, error) } guard let data = data else { completion(nil, NSError()) return } do { let userDetails = try self.jsonDecoder.decode(UserDetails.self, from: data) completion(userDetails, nil) } catch { completion(nil, error) } } } func post<Type: Codable>(_ value: Type, to url: URL, completion: @escaping (Data?, URLResponse?, Error?) -> Void) { guard let bearer = NetworkingController.bearer else { completion(nil, nil, NSError()) return } var request = URLRequest(url: url) request.httpMethod = "POST" request.setValue("Bearer \(bearer.accessToken)", forHTTPHeaderField: HeaderNames.auth.rawValue) request.setValue("application/json", forHTTPHeaderField: HeaderNames.contentType.rawValue) do { let encodedJSON = try jsonEncoder.encode(value) request.httpBody = encodedJSON } catch { completion(nil, nil, error) return } networkLoader.loadData(with: request) { data, response, error in if let error = error { completion(nil, nil, error) return } guard let data = data, let response = response else { completion(nil, nil, NSError()) return } completion(data, response, nil) } } func delete(from url: URL, completion: @escaping (Data?, URLResponse?, Error?) -> Void) { guard let bearer = NetworkingController.bearer else { completion(nil, nil, NSError()) return } var request = URLRequest(url: url) request.httpMethod = "DELETE" request.setValue("Bearer \(bearer.accessToken)", forHTTPHeaderField: HeaderNames.auth.rawValue) networkLoader.loadData(with: request, completion: completion) } }
30.310734
119
0.56589
da538b5980d44e3e8283777e6ae11925acda0b2f
17,523
php
PHP
src/Client/Client.php
nadirhamid/zoho-recruit-api
6b03590783f109db57de9c1bffa8b6c072b91b2c
[ "MIT" ]
null
null
null
src/Client/Client.php
nadirhamid/zoho-recruit-api
6b03590783f109db57de9c1bffa8b6c072b91b2c
[ "MIT" ]
null
null
null
src/Client/Client.php
nadirhamid/zoho-recruit-api
6b03590783f109db57de9c1bffa8b6c072b91b2c
[ "MIT" ]
null
null
null
<?php namespace Humantech\Zoho\Recruit\Api\Client; use GuzzleHttp\Psr7\Response; use Humantech\Zoho\Recruit\Api\Formatter\RequestFormatter; use Humantech\Zoho\Recruit\Api\Formatter\ResponseFormatter; use Humantech\Zoho\Recruit\Api\Formatter\ResponseListFormatter; use Humantech\Zoho\Recruit\Api\Formatter\ResponseRowFormatter; use Humantech\Zoho\Recruit\Api\Formatter\XmlRequestDataFormatter; use Humantech\Zoho\Recruit\Api\Unserializer\UnserializerBuilder; class Client extends AbstractClient implements ClientInterface { const API_BASE_URL = 'https://recruit.zoho.%s/recruit/private/%s/%s/%s?authtoken=%s'; const API_DEFAULT_VERSION = 2; const API_DEFAULT_SCOPE = 'recruitapi'; const API_RESPONSE_FORMAT_JSON = 'json'; const API_RESPONSE_FORMAT_XML = 'xml'; /** * @var string */ protected $authToken; /** * @var string */ protected $domain; /** * @param string $authToken */ public function __construct($authToken, $domain='com') { $this->authToken = $authToken; $this->domain = $domain; } /** * @param string $module * @param string $method * @param string $responseFormat * @param array $requestParameters * * @return string * * @throws \InvalidArgumentException */ protected function getUri($module, $method, $responseFormat, array $requestParameters = array()) { if (!$this->hasMethod($method)) { throw new \InvalidArgumentException(sprintf('The method %s is not registered', $method)); } if (!$this->hasResponseFormat($responseFormat)) { throw new \InvalidArgumentException(sprintf('The response format %s is not registered', $responseFormat)); } if (!isset($requestParameters['scope'])) { $requestParameters['scope'] = self::API_DEFAULT_SCOPE; } if (!isset($requestParameters['version'])) { $requestParameters['version'] = self::API_DEFAULT_VERSION; } $uri = sprintf( self::API_BASE_URL, $this->domain, $responseFormat, $module, $method, $this->getAuthToken() ); return $uri . $this->generateQueryStringByRequestParams($requestParameters); } /** * @param array $requestParameters * * @return string */ protected function generateQueryStringByRequestParams(array $requestParameters) { return empty($requestParameters) ? '' : '&' . http_build_query($requestParameters) ; } /** * @param string $method * * @return bool */ protected function hasMethod($method) { return in_array($method, array( 'getRecords', 'getRecordById', 'addRecords', 'updateRecords', 'getNoteTypes', 'getRelatedRecords', 'getFields', 'getAssociatedJobOpenings', 'changeStatus', 'uploadFile', 'downloadFile', 'associateJobOpening', 'uploadPhoto', 'downloadPhoto', 'uploadDocument', 'getModules', 'getAssociatedCandidates', 'getSearchRecords', )); } /** * @param string $responseFormat * * @return bool */ protected function hasResponseFormat($responseFormat) { return in_array(strtolower($responseFormat), array( 'json', 'xml', )); } /** * @param Response $response * @param string $responseFormat * * @return array */ protected function getUnserializedData(Response $response, $responseFormat) { return UnserializerBuilder::create($responseFormat)->unserialize( $response->getBody()->getContents() ); } /** * @inheritdoc */ public function getAuthToken() { return $this->authToken; } /** * @inheritdoc */ public function getRecords($module, array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON) { $method = 'getRecords'; $response = $this->sendRequest('GET', $this->getUri($module, $method, $responseFormat, $additionalParams)); $unserializedData = $this->getUnserializedData($response, $responseFormat); return ResponseFormatter::create($module, $method)->formatter($unserializedData)->getOutput(); } /** * @inheritdoc */ public function getRecordById($module, $id, array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON) { $method = 'getRecordById'; $additionalParams['id'] = $id; $response = $this->sendRequest('GET', $this->getUri($module, $method, $responseFormat, $additionalParams)); $unserializedData = $this->getUnserializedData($response, $responseFormat); return ResponseFormatter::create($module, $method)->formatter($unserializedData)->getOutput(); } /** * @inheritdoc */ public function addRecords($module, $data, array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON, $returnFullResult = FALSE) { $method = 'addRecords'; $xmlData = RequestFormatter::create($module, 'addRecords')->formatter($data)->getOutput(); $response = $this->sendRequest('POST', $this->getUri($module, $method, $responseFormat, $additionalParams), [ 'body' => http_build_query(['xmlData' => $xmlData]), 'headers' => ['Content-type' => 'application/x-www-form-urlencoded'], ] ); $unserializedData = $this->getUnserializedData($response, $responseFormat); if ($returnFullResult) { return $unserializedData; } return ResponseFormatter::create($module, $method)->formatter($unserializedData)->getOutput(); } /** * @inheritdoc */ public function updateRecords($module, $id, $data, array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON) { $method = 'updateRecords'; $additionalParams['id'] = $id; $additionalParams['xmlData'] = RequestFormatter::create($module, 'updateRecords')->formatter($data)->getOutput(); $response = $this->sendRequest('POST', $this->getUri($module, $method, $responseFormat, $additionalParams)); $unserializedData = $this->getUnserializedData($response, $responseFormat); return ResponseFormatter::create($module, $method)->formatter($unserializedData)->getOutput(); } /** * @inheritdoc */ public function getNoteTypes(array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON) { $module = 'Notes'; $method = 'getNoteTypes'; $response = $this->sendRequest('GET', $this->getUri($module, $method, $responseFormat, $additionalParams)); $unserializedData = $this->getUnserializedData($response, $responseFormat); return ResponseFormatter::create($module, $method)->formatter($unserializedData)->getOutput(); } /** * @inheritdoc */ public function getRelatedRecords($module, $parentModule, $id, array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON) { $method = 'getRelatedRecords'; $additionalParams['parentModule'] = $parentModule; $additionalParams['id'] = $id; $response = $this->sendRequest('GET', $this->getUri($module, $method, $responseFormat, $additionalParams)); $unserializedData = $this->getUnserializedData($response, $responseFormat); return ResponseFormatter::create($module, $method)->formatter($unserializedData)->getOutput(); } /** * @inheritdoc */ public function getFields($module, array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON) { $method = 'getFields'; $response = $this->sendRequest('GET', $this->getUri($module, $method, $responseFormat, $additionalParams)); $unserializedData = $this->getUnserializedData($response, $responseFormat); return ResponseFormatter::create($module, $method)->formatter($unserializedData)->getOutput(); } /** * @inheritdoc */ public function getAssociatedJobOpenings($candidateId, array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON) { $module = 'Candidates'; $method = 'getAssociatedJobOpenings'; $additionalParams['id'] = $candidateId; $response = $this->sendRequest('GET', $this->getUri($module, $method, $responseFormat, $additionalParams)); $unserializedData = $this->getUnserializedData($response, $responseFormat); return ResponseFormatter::create($module, $method)->formatter($unserializedData)->getOutput(); } /** * @inheritdoc */ public function changeStatus(array $candidateIds, $candidateStatus, array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON) { $module = 'Candidates'; $method = 'changeStatus'; if (!in_array($candidateStatus, array( 'New', 'Waiting-for-Evaluation', 'Qualified', 'Unqualified', 'Junk candidate', 'Contacted', 'Contact in Future', 'Not Contacted', 'Attempted to Contact', 'Associated', 'Submitted-to-client', 'Approved by client', 'Rejected by client', 'Interview-to-be-Scheduled', 'Interview-Scheduled', 'Rejected-for-Interview', 'Interview-in-Progress', 'On-Hold', 'Hired', 'Rejected', 'Rejected-Hirable', 'To-be-Offered', 'Offer-Accepted', 'Offer-Made', 'Offer-Declined', 'Offer-Withdrawn', 'Joined', 'No-Show', ))) { throw new HttpApiException(sprintf('The new status "%s" is invalid!', $candidateStatus)); } $additionalParams['candidateIds'] = implode(',', $candidateIds); $additionalParams['candidateStatus'] = $candidateStatus; $response = $this->sendRequest('POST', $this->getUri($module, $method, $responseFormat, $additionalParams)); $unserializedData = $this->getUnserializedData($response, $responseFormat); return ResponseFormatter::create($module, $method)->formatter($unserializedData)->getOutput(); } /** * @inheritdoc */ public function uploadFile($id, $type, $resource, array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON) { $module = 'Candidates'; $method = 'uploadFile'; if (!in_array($type, array( 'Resume', 'Others', ))) { throw new HttpApiException(sprintf('The type of upload "%s" is invalid!', $type)); } $additionalParams['id'] = $id; $additionalParams['type'] = $type; $response = $this->sendFile($this->getUri($module, $method, $responseFormat, $additionalParams), array( 'content' => $resource )); $unserializedData = $this->getUnserializedData(new Response(200, array(), $response), $responseFormat); return ResponseFormatter::create($module, $method)->formatter($unserializedData)->getOutput(); } /** * @inheritdoc */ public function downloadFile($id, array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON) { $module = 'Candidates'; $method = 'downloadFile'; $additionalParams['id'] = $id; $response = $this->sendRequest('GET', $this->getUri($module, $method, $responseFormat, $additionalParams)); $unserializedData = $this->getUnserializedData($response, $responseFormat); $formatterData = array( 'download' => $response, 'params' => array('unserializedData' => $unserializedData) ); return ResponseFormatter::create($module, $method)->formatter($formatterData)->getOutput(); } /** * @inheritdoc */ public function associateJobopening(array $jobIds, array $candidateIds, array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON) { $module = 'Candidates'; $method = 'associateJobOpening'; $additionalParams['jobIds'] = implode(',', $jobIds); $additionalParams['candidateIds'] = implode(',', $candidateIds); $response = $this->sendRequest('POST', $this->getUri($module, $method, $responseFormat, $additionalParams)); $unserializedData = $this->getUnserializedData($response, $responseFormat); return ResponseFormatter::create($module, $method)->formatter($unserializedData)->getOutput(); } /** * @inheritdoc */ public function uploadPhoto($module, $id, $resource, array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON) { $method = 'uploadPhoto'; if (!in_array($module, array( 'Candidates', 'Contacts', ))) { throw new HttpApiException(sprintf('The module "%s" is invalid!', $module)); } $additionalParams['id'] = $id; $response = $this->sendFile($this->getUri($module, $method, $responseFormat, $additionalParams), array( 'content' => $resource )); $unserializedData = $this->getUnserializedData(new Response(200, array(), $response), $responseFormat); return ResponseFormatter::create($module, $method)->formatter($unserializedData)->getOutput(); } /** * @inheritdoc */ public function downloadPhoto($module, $id, array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON) { $method = 'downloadPhoto'; if (!in_array($module, array( 'Candidates', 'Contacts', ))) { throw new HttpApiException(sprintf('The module "%s" is invalid!', $module)); } $additionalParams['id'] = $id; $response = $this->sendRequest('GET', $this->getUri($module, $method, $responseFormat, $additionalParams)); $unserializedData = $this->getUnserializedData($response, $responseFormat); $formatterData = array( 'download' => $response, 'params' => array('unserializedData' => $unserializedData) ); return ResponseFormatter::create($module, $method)->formatter($formatterData)->getOutput(); } /** * @inheritdoc */ public function uploadDocument($documentData, $fileName, array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON) { $module = 'Candidates'; $method = 'uploadDocument'; $additionalParams['fileName'] = $fileName; $response = $this->sendFile($this->getUri($module, $method, $responseFormat, $additionalParams), array( 'documentData' => base64_encode($documentData) )); $unserializedData = $this->getUnserializedData(new Response(200, array(), $response), $responseFormat); return ResponseFormatter::create($module, $method)->formatter($unserializedData)->getOutput(); } /** * @inheritdoc */ public function getModules(array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON) { $module = 'Info'; $method = 'getModules'; $response = $this->sendRequest('GET', $this->getUri($module, $method, $responseFormat, $additionalParams)); $unserializedData = $this->getUnserializedData($response, $responseFormat); return ResponseFormatter::create($module, $method)->formatter($unserializedData)->getOutput(); } /** * @inheritdoc */ public function getAssociatedCandidates($jobId, array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON) { $module = 'JobOpenings'; $method = 'getAssociatedCandidates'; $additionalParams['id'] = $jobId; $response = $this->sendRequest('GET', $this->getUri($module, $method, $responseFormat, $additionalParams)); $unserializedData = $this->getUnserializedData($response, $responseFormat); return ResponseFormatter::create($module, $method)->formatter($unserializedData)->getOutput(); } /** * @inheritdoc */ public function getSearchRecords($module, $selectColumns, $searchCondition, array $additionalParams = array(), $responseFormat = self::API_RESPONSE_FORMAT_JSON) { $method = 'getSearchRecords'; $additionalParams['selectColumns'] = $selectColumns; $additionalParams['searchCondition'] = $searchCondition; $response = $this->sendRequest('GET', $this->getUri($module, $method, $responseFormat, $additionalParams)); $unserializedData = $this->getUnserializedData($response, $responseFormat); return ResponseFormatter::create($module, $method)->formatter($unserializedData)->getOutput(); } }
32.814607
164
0.611996
a327c4778435beb884246002f32bfbf131655086
1,185
tsx
TypeScript
docs/_react/intro.story.tsx
onfido/castor
aca7ac3c26750e2e2853e0a7d2b60e63c90b39d6
[ "Apache-2.0" ]
19
2020-11-30T18:12:17.000Z
2022-03-07T18:57:27.000Z
docs/_react/intro.story.tsx
onfido/castor
aca7ac3c26750e2e2853e0a7d2b60e63c90b39d6
[ "Apache-2.0" ]
1,472
2020-11-30T11:08:13.000Z
2022-03-30T05:15:56.000Z
docs/_react/intro.story.tsx
onfido/castor
aca7ac3c26750e2e2853e0a7d2b60e63c90b39d6
[ "Apache-2.0" ]
2
2020-12-12T22:45:06.000Z
2020-12-28T17:22:58.000Z
import { Source } from '@storybook/components'; import React from 'react'; export const Intro = () => ( <> <h1>Castor React</h1> <p> <i>Castor React</i> is Onfido&#39;s design system addition. It provides React component library. </p> <h2>Install</h2> <p> You can install with <code>npm</code> CLI tool: </p> <Source language="bash" code={` npm install @onfido/castor @onfido/castor-react `} format dark /> <p> If you plan to use icons, also install <code>Castor Icons</code> package: </p> <Source language="bash" code={` npm install @onfido/castor-icons `} format dark /> <p> Then (only once) inline the <code>Icons</code> SVG sprite in your app: </p> <Source language="jsx" code={` import { Icons } from '@onfido/castor-icons'; import React, { Fragment } from 'react'; const App = () => ( <Fragment> <Icons /> {/* ...anything else e.g. app routes */} </Fragment> ); `} format dark /> </> );
20.789474
79
0.502954
fb1d2be2f26a213eaedaab4daba488cebcdbba2e
2,005
c
C
open-vm-tools/services/plugins/deployPkg/deployPkgPlugin.c
mrehman29/open-vm-tools
03f35e3209b3a73cf8e43a74ac764f22526723a0
[ "X11" ]
1,816
2015-01-23T17:21:48.000Z
2022-03-31T07:36:28.000Z
open-vm-tools/services/plugins/deployPkg/deployPkgPlugin.c
mrehman29/open-vm-tools
03f35e3209b3a73cf8e43a74ac764f22526723a0
[ "X11" ]
576
2015-02-06T14:11:34.000Z
2022-03-31T13:25:48.000Z
open-vm-tools/services/plugins/deployPkg/deployPkgPlugin.c
mrehman29/open-vm-tools
03f35e3209b3a73cf8e43a74ac764f22526723a0
[ "X11" ]
438
2015-02-03T09:57:57.000Z
2022-03-26T01:12:43.000Z
/********************************************************* * Copyright (C) 2008-2016 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation version 2.1 and no later version. * * This program 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 Lesser GNU General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * *********************************************************/ /** * @file deployPkgPlugin.c * * Wrapper around the deployPkg library for doing image customization. */ #include <stdlib.h> #include "vm_basic_defs.h" #include "deployPkgInt.h" #include "vmware/tools/plugin.h" #include "vmware/tools/utils.h" #include "vm_version.h" #include "embed_version.h" #include "vmtoolsd_version.h" VM_EMBED_VERSION(VMTOOLSD_VERSION_STRING); /** * Called by the Tools service when loading the deployPkg plugin. * * @param[in] ctx The application context. * * @return Registration data for the plugin. */ TOOLS_MODULE_EXPORT ToolsPluginData * ToolsOnLoad(ToolsAppCtx *ctx) { static ToolsPluginData regData = { "deployPkg", NULL, NULL }; RpcChannelCallback rpcs[] = { { "deployPkg.begin", DeployPkg_TcloBegin, NULL, NULL, NULL, 0 }, { "deployPkg.deploy", DeployPkg_TcloDeploy, NULL, NULL, NULL, 0 } }; ToolsAppReg regs[] = { { TOOLS_APP_GUESTRPC, VMTools_WrapArray(rpcs, sizeof *rpcs, ARRAYSIZE(rpcs)) } }; srand(time(NULL)); regData.regs = VMTools_WrapArray(regs, sizeof *regs, ARRAYSIZE(regs)); return &regData; }
29.057971
84
0.673815
550cc52f67e969cf0a2e72d61ad90e3a2e3efab6
3,902
lua
Lua
PurchaseConfirmation/Locale/deDE.lua
scscgit/scsc_wildstar_addons
b07d8bb3bdfbd0ac661cfcf3d91f4c52a1094f14
[ "MIT" ]
null
null
null
PurchaseConfirmation/Locale/deDE.lua
scscgit/scsc_wildstar_addons
b07d8bb3bdfbd0ac661cfcf3d91f4c52a1094f14
[ "MIT" ]
null
null
null
PurchaseConfirmation/Locale/deDE.lua
scscgit/scsc_wildstar_addons
b07d8bb3bdfbd0ac661cfcf3d91f4c52a1094f14
[ "MIT" ]
2
2019-11-30T13:08:53.000Z
2021-02-07T00:06:04.000Z
local L = Apollo.GetPackage("Gemini:Locale-1.0").tPackage:NewLocale("PurchaseConfirmation", "deDE") if not L then return end --[[ Proper Translations ]]-- --[[ Google Translations ]]-- --[[ CONFIRMATION DIALOG ]] -- Main window labels L["Dialog_ButtonDetails"] = "Detail" -- Detail window foldout labels L["Dialog_DetailsLabel_Fixed"] = "Festbetrag" L["Dialog_DetailsLabel_Average"] = "Durchschnittsausgaben" L["Dialog_DetailsLabel_EmptyCoffers"] = "Leere Kassen" -- Detail window foldout tooltips L["Dialog_DetailsTooltip_Breached"] = "Schwelle verletzt" L["Dialog_DetailsTooltip_NotBreached"] = "Schwelle nicht verletzt" L["Dialog_DetailsTooltip_Disabled"] = "Schwelle ist deaktiviert" --[[ SETTINGS WINDOW ]] -- Main window labels L["Settings_WindowTitle"] = "PurchaseConfirmation Einstellungen" L["Settings_Balance"] = "Aktuelle Bilanz" -- Individual threshold labels and descriptions L["Settings_Threshold_Fixed_Enable"] = "\"Festen oberen\" Schwelle aktivieren:" L["Settings_Threshold_Fixed_Description"] = "Verlangen immer Bestätigung für Einkäufe über diesen Betrag." L["Settings_Threshold_Puny_Enable"] = "\"Mickrigen Betrag\" Schwelle aktivieren:" L["Settings_Threshold_Puny_Description"] = "Nie fordern Bestätigung für Einkäufe unter diesem Betrag, und verwenden Sie nicht den Kauf in \"durchschnittlichen Ausgaben\" Schwelle Berechnungen." L["Settings_Threshold_Average_Enable"] = "\"Durchschnittlichen Ausgaben\" Schwelle aktivieren [1-100%]:" L["Settings_Threshold_Average_Description"] = "Bestätigung anfordern, wenn Kaufpreis ist mehr als die angegebene Prozentsatz über dem Durchschnitt des letzten Kauf-Geschichte." L["Settings_Threshold_EmptyCoffers_Enable"] = "\"Leeren Kassen\" Schwelle aktivieren [1-100%]:" L["Settings_Threshold_EmptyCoffers_Description"] = "Bestätigung anfordern, wenn Kauf mehr kosten als der angegebene Prozentsatz von Ihren aktuellen Kontostand." L["Settings_Modules_Button"] = "Module" --[[ MODULES ]] L["Modules_WindowTitle"] = "Module" L["Module_Enable"] = "Aktivieren" L["Module_Failure_Addon_Missing"] = "Erforderliche Addon %q nicht gefunden." L["Module_VendorPurchase_Title"] = "Verkäufer: Kauf" L["Module_VendorPurchase_Description"] = "Dieses Modul fängt Artikel Einkäufe in der Haupt-Verkäufer-Addon. Dies umfasst alle regulären Hersteller, wie zB allgemeine Ware-Anbieter, während Nexus verstreut." L["Module_VendorRepair_Title"] = "Verkäufer: Reparieren" L["Module_VendorRepair_Description"] = "Dieses Modul Abschnitte ein-und all-Artikel Reparaturen in der Haupt-Verkäufer-Addon durchgeführt. Es muss nicht fordern Bestätigung für die Auto-Reparaturen durch Addon 'JunkIt' initiiert." L["Module_HousingBuyToCrate_Title"] = "Gehäuse: Um Kiste kaufen" L["Module_HousingBuyToCrate_Description"] = "Dieses Modul fängt Kauf Gehäuse Kultur Elemente (um Ihre Kiste). Es hat keinen Einfluss Housing Artikel Reparatur / Platzierungskosten, nur den Kauf, um Ihre Kiste." L["Module_SpaceStashBankSlot_Title"] = "SpaceStash: Kaufen Bank-Slot" L["Module_SpaceStashBankSlot_Description"] = "Wenn Sie das Addon SpaceStash sind, wird diese Bank-Slot-Käufe abzufangen." L["Module_LilVendorPurchase_Title"] = "LilVendor: Kauf" L["Module_LilVendorPurchase_Description"] = "Wenn Sie das Addon LilVendor sind, wird diese Käufe abzufangen. Gleiche wie für die Lager-Verkauf-Addon, mit Ausnahme der Ersatz LilVendor Addon." L["Module_ViragsMultibuyerPurchase_Title"] = "ViragsMultibyer: Kauf" L["Module_ViragsMultibuyerPurchase_Description"] = "Wenn Sie das Addon ViragsMultibyer sind, wird diese Käufe vor, die die ViragsMultibuyer internen Bestätigungsdialog abfangen." L["Module_CostumesDye_Title"] = "Kostüme: Färben" L["Module_CostumesDye_Description"] = "Sieht gut aus ist niemals billig, vor allem nicht in Wildstar. Mit diesem Modul können Sie sich zweimal überlegen, vor dem Ablegen 2 Platinum auf diesem süßen blutroten Färbe."
52.72973
230
0.792158
93c5c0d5580da736c1a331ade837fbe48a28291e
1,351
cs
C#
Therapp/FiapCoin/FiapCoin/ViewModel/ConsultaDetalheViewModel.cs
gabrielpfc/produto-therapp
8d32770b1ee3f9729fc552c5658d5c2e6ec85947
[ "MIT" ]
null
null
null
Therapp/FiapCoin/FiapCoin/ViewModel/ConsultaDetalheViewModel.cs
gabrielpfc/produto-therapp
8d32770b1ee3f9729fc552c5658d5c2e6ec85947
[ "MIT" ]
null
null
null
Therapp/FiapCoin/FiapCoin/ViewModel/ConsultaDetalheViewModel.cs
gabrielpfc/produto-therapp
8d32770b1ee3f9729fc552c5658d5c2e6ec85947
[ "MIT" ]
null
null
null
using System; using System.Collections.Generic; using System.Windows.Input; using THERAPP.Views.Components; using Xamarin.Forms; namespace THERAPP.ViewModel { public class ConsultaDetalheViewModel { public ConsultaDetalheViewModel() { Evento = Model.Global.Evento; CancelarClickedCommand = new Command(() => { App.MensagemAlerta("Ainda não é possivel cancelar consultas.", "Mas fique tranquilo você não pagara nenhuma taxa caso falte na consulta."); }); AlterarClickedCommand = new Command(() => { App.MensagemAlerta("Ainda não é possivel alterar consultas.", "Mas fique tranquilo você pode agendar uma nova consulta."); }); } public ConsultaDetalheViewModel(Model.Evento _evento) { Evento = _evento; } private Model.Evento evento; public Model.Evento Evento { get { return evento; } set { evento = value; } } public ICommand EntrarClickedCommand { get; private set; } public ICommand AlterarClickedCommand { get; private set; } public ICommand CancelarClickedCommand { get; private set; } } }
26.490196
155
0.571429
795f1625de270fc5e2c6c1985e6b6499a6eef7d4
742
php
PHP
app/Http/Requests/VideoRequest.php
jona04/RiveracLaravel
f5ad620c7732d4ae39ecbb449dd991de7ebb5aa1
[ "MIT" ]
1
2016-12-11T19:56:58.000Z
2016-12-11T19:56:58.000Z
app/Http/Requests/VideoRequest.php
jona04/RiveracLaravel
f5ad620c7732d4ae39ecbb449dd991de7ebb5aa1
[ "MIT" ]
null
null
null
app/Http/Requests/VideoRequest.php
jona04/RiveracLaravel
f5ad620c7732d4ae39ecbb449dd991de7ebb5aa1
[ "MIT" ]
null
null
null
<?php namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; class VideoRequest extends FormRequest { /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return true; } public function messages() { return [ 'titulo.required' => 'Preencha o titulo da video', 'url.required' => 'Preencha a url da video', ]; } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'titulo'=>'required | max : 255', 'url'=>'required', ]; } }
17.255814
64
0.52965
f4185cfcb4486b93d790d392a6f8c15a08507661
1,042
cs
C#
ARMeilleure/Decoders/OpCodeT16MemMult.cs
2579768776/Ryujinx
f2087ca29e37e08b9e55250fe1b9cfd27287bae2
[ "MIT" ]
6
2022-01-29T13:13:16.000Z
2022-03-16T12:12:06.000Z
ARMeilleure/Decoders/OpCodeT16MemMult.cs
2579768776/Ryujinx
f2087ca29e37e08b9e55250fe1b9cfd27287bae2
[ "MIT" ]
8
2022-03-23T02:24:07.000Z
2022-03-24T19:17:53.000Z
ARMeilleure/Decoders/OpCodeT16MemMult.cs
zandm7/Ryujinx
b1484e3e1822796802ac4d0a7784172a05ff9e34
[ "MIT" ]
1
2021-12-04T12:19:43.000Z
2021-12-04T12:19:43.000Z
using ARMeilleure.Instructions; using System; using System.Numerics; namespace ARMeilleure.Decoders { class OpCodeT16MemMult : OpCodeT16, IOpCode32MemMult { public int Rn { get; } public int RegisterMask { get; } public int PostOffset { get; } public bool IsLoad { get; } public int Offset { get; } public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCodeT16MemMult(inst, address, opCode); public OpCodeT16MemMult(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode) { RegisterMask = opCode & 0xff; Rn = (opCode >> 8) & 7; int regCount = BitOperations.PopCount((uint)RegisterMask); Offset = 0; PostOffset = 4 * regCount; IsLoad = inst.Name switch { InstName.Ldm => true, InstName.Stm => false, _ => throw new InvalidOperationException() }; } } }
29.771429
135
0.579655
c50626ea5a3e7ed12c29ae48b6be6e8a1889f279
171
css
CSS
talk/resi_est/reveal.js/dist/reveal-override.css
zs-li/zs-li.github.io
fd002db258289d4ab2b170be42949c94fad1a0fa
[ "MIT" ]
1
2020-03-21T02:09:26.000Z
2020-03-21T02:09:26.000Z
talk/resi_est/reveal.js/dist/reveal-override.css
zs-li/zs-li.github.io
fd002db258289d4ab2b170be42949c94fad1a0fa
[ "MIT" ]
null
null
null
talk/resi_est/reveal.js/dist/reveal-override.css
zs-li/zs-li.github.io
fd002db258289d4ab2b170be42949c94fad1a0fa
[ "MIT" ]
null
null
null
body:after { content: url(../../figures/raw/small_tsinghua.png); position: fixed; top: 2em; right: 3em; width: 3em; width: 3em; height: auto; }
19
55
0.578947
f4f03cca359e4c059dc451bc20e2099cc6553569
7,330
swift
Swift
ios/Classes/SwiftClevertapFlutterPlugin.swift
NandanSatheesh/clevertap_flutter
ed1165080d28130277b18e9c2c634534fc2cf275
[ "BSD-2-Clause" ]
3
2019-09-16T11:42:32.000Z
2020-05-23T03:51:53.000Z
ios/Classes/SwiftClevertapFlutterPlugin.swift
NandanSatheesh/clevertap_flutter
ed1165080d28130277b18e9c2c634534fc2cf275
[ "BSD-2-Clause" ]
5
2019-09-24T08:55:21.000Z
2021-07-15T16:00:35.000Z
ios/Classes/SwiftClevertapFlutterPlugin.swift
NandanSatheesh/clevertap_flutter
ed1165080d28130277b18e9c2c634534fc2cf275
[ "BSD-2-Clause" ]
2
2019-09-17T05:30:47.000Z
2019-12-11T08:23:05.000Z
import Flutter import UIKit import CleverTapSDK public class SwiftClevertapFlutterPlugin: NSObject, FlutterPlugin { private var cleverTap = CleverTap.sharedInstance() private var deviceDetailsDict = [String : Any]() public static func register(with registrar: FlutterPluginRegistrar) { let channel = FlutterMethodChannel(name: "clevertap_flutter", binaryMessenger: registrar.messenger()) let instance = SwiftClevertapFlutterPlugin() registrar.addMethodCallDelegate(instance, channel: channel) } public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { if (call.method == "getPlatformVersion") { result("iOS " + UIDevice.current.systemVersion) } else if call.method == "pushProfile" { initializeDeviceDetailsDict() if let profileArgs = call.arguments as? [String : Any] { cleverTap?.profilePush(profileArgs) #if DEBUG print("CleverTapEvent pushProfile: \(profileArgs)") #endif result("Profile Pushed \(profileArgs)") } } else if call.method == "pushEvent" { if let arguments = call.arguments as? [String : Any] { let eventName = arguments["eventName"] as? String ?? "Null Event" let properties = arguments["values"] as? [String : Any] cleverTap?.recordEvent(eventName, withProps: addDeviceDetails(properties)) #if DEBUG print("flutter pushEvent \(eventName) \(addDeviceDetails(properties))") #endif result(true) } } else if call.method == "onUserLogin" { initializeDeviceDetailsDict() let values = call.arguments as? [String : Any] cleverTap?.onUserLogin(values ?? [:]) #if DEBUG print("CleverTapEvent onUserLogin:\(values)") #endif result(true) } else { result(FlutterMethodNotImplemented) } } private func initializeDeviceDetailsDict() { deviceDetailsDict.removeAll() let systemVersion = UIDevice.current.systemVersion let appVersion = Bundle.main.versionNumber let modelName = UIDevice.current.modelName let manufacturer = "Apple" deviceDetailsDict["OS Version"] = systemVersion deviceDetailsDict["App Version"] = appVersion deviceDetailsDict["Device Model"] = modelName deviceDetailsDict["Manufacturer"] = manufacturer deviceDetailsDict["Device Brand"] = "Apple" #if DEBUG print("CleverTapEvent device \(deviceDetailsDict)") #endif } private func addDeviceDetails(_ props : [String : Any]?) -> [String : Any] { deviceDetailsDict.removeAll() initializeDeviceDetailsDict() if let appendProps = props { for (key, value) in appendProps { deviceDetailsDict[key] = value } } return deviceDetailsDict } } extension Bundle { var appName: String { return infoDictionary?["CFBundleName"] as? String ?? "" } var bundleId: String { return bundleIdentifier! } var versionNumber: String { return infoDictionary?["CFBundleShortVersionString"] as? String ?? "" } var buildNumber: String { return infoDictionary?["CFBundleVersion"] as? String ?? "" } } public extension UIDevice { /// pares the deveice name as the standard name var modelName: String { #if targetEnvironment(simulator) let identifier = ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"]! #else var systemInfo = utsname() uname(&systemInfo) let machineMirror = Mirror(reflecting: systemInfo.machine) let identifier = machineMirror.children.reduce("") { identifier, element in guard let value = element.value as? Int8 , value != 0 else { return identifier } return identifier + String(UnicodeScalar(UInt8(value))) } #endif switch identifier { case "iPod5,1": return "iPod Touch 5" case "iPod7,1": return "iPod Touch 6" case "iPhone3,1", "iPhone3,2", "iPhone3,3": return "iPhone 4" case "iPhone4,1": return "iPhone 4s" case "iPhone5,1", "iPhone5,2": return "iPhone 5" case "iPhone5,3", "iPhone5,4": return "iPhone 5c" case "iPhone6,1", "iPhone6,2": return "iPhone 5s" case "iPhone7,2": return "iPhone 6" case "iPhone7,1": return "iPhone 6 Plus" case "iPhone8,1": return "iPhone 6s" case "iPhone8,2": return "iPhone 6s Plus" case "iPhone9,1", "iPhone9,3": return "iPhone 7" case "iPhone9,2", "iPhone9,4": return "iPhone 7 Plus" case "iPhone8,4": return "iPhone SE" case "iPhone10,1", "iPhone10,4": return "iPhone 8" case "iPhone10,2", "iPhone10,5": return "iPhone 8 Plus" case "iPhone10,3", "iPhone10,6": return "iPhone X" case "iPhone11,2": return "iPhone XS" case "iPhone11,4", "iPhone11,6": return "iPhone XS Max" case "iPhone11,8": return "iPhone XR" case "iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4":return "iPad 2" case "iPad3,1", "iPad3,2", "iPad3,3": return "iPad 3" case "iPad3,4", "iPad3,5", "iPad3,6": return "iPad 4" case "iPad4,1", "iPad4,2", "iPad4,3": return "iPad Air" case "iPad5,3", "iPad5,4": return "iPad Air 2" case "iPad6,11", "iPad6,12": return "iPad 5" case "iPad7,5", "iPad7,6": return "iPad 6" case "iPad2,5", "iPad2,6", "iPad2,7": return "iPad Mini" case "iPad4,4", "iPad4,5", "iPad4,6": return "iPad Mini 2" case "iPad4,7", "iPad4,8", "iPad4,9": return "iPad Mini 3" case "iPad5,1", "iPad5,2": return "iPad Mini 4" case "iPad6,3", "iPad6,4": return "iPad Pro 9.7 Inch" case "iPad6,7", "iPad6,8": return "iPad Pro 12.9 Inch" case "iPad7,1", "iPad7,2": return "iPad Pro (12.9-inch) (2nd generation)" case "iPad7,3", "iPad7,4": return "iPad Pro (10.5-inch)" case "iPad8,1", "iPad8,2", "iPad8,3", "iPad8,4":return "iPad Pro (11-inch)" case "iPad8,5", "iPad8,6", "iPad8,7", "iPad8,8":return "iPad Pro (12.9-inch) (3rd generation)" case "AppleTV5,3": return "Apple TV" case "AppleTV6,2": return "Apple TV 4K" case "AudioAccessory1,1": return "HomePod" default: return identifier } } }
43.117647
105
0.537926
d7e1b65a1482b6fb3a0fd5cb5c40302f16e98699
739
rb
Ruby
app/models/ship/model/line.rb
work-design/rails_ship
e0ae67b164085ceab6d2eacafb9bed8888ee239f
[ "MIT" ]
1
2021-12-22T06:28:28.000Z
2021-12-22T06:28:28.000Z
app/models/ship/model/line.rb
work-design/rails_ship
e0ae67b164085ceab6d2eacafb9bed8888ee239f
[ "MIT" ]
7
2020-02-09T15:58:08.000Z
2021-10-07T12:33:10.000Z
app/models/ship/model/line.rb
work-design/rails_ship
e0ae67b164085ceab6d2eacafb9bed8888ee239f
[ "MIT" ]
null
null
null
module Ship module Model::Line extend ActiveSupport::Concern included do attribute :name, :string attribute :start_name, :string attribute :finish_name, :string attribute :locations_count, :integer, default: 0 belongs_to :user, class_name: 'Auth::User' has_many :locations, -> { order(position: :asc) }, dependent: :delete_all, inverse_of: :line accepts_nested_attributes_for :locations has_many :line_similars, dependent: :delete_all has_many :similars, through: :line_similars after_create_commit :sync_names end def sync_names self.start_name = locations[0].poiname self.finish_name = locations[1].poiname self.save end end end
25.482759
98
0.686062
f4a579c7457ee7a0a9d64b1a32e4acc0ad4dd7de
4,481
tsx
TypeScript
packages/react/src/components/Ogre.tsx
azurystudios/twemazing
ea9e3677909042b6afc23286e761085b368b5efc
[ "Apache-2.0" ]
6
2021-08-14T00:35:43.000Z
2021-08-22T12:35:00.000Z
packages/react/src/components/Ogre.tsx
twemazing/twemazing
ea9e3677909042b6afc23286e761085b368b5efc
[ "Apache-2.0" ]
null
null
null
packages/react/src/components/Ogre.tsx
twemazing/twemazing
ea9e3677909042b6afc23286e761085b368b5efc
[ "Apache-2.0" ]
null
null
null
import React from 'react' const Ogre = ({ size, rem }: { size: number | string, rem?: boolean }) => { const width = (typeof size === 'string') ? size : rem ? `${size}rem` : `${size}px` return ( <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36" style={{ width: width }}><path fill="#292F33" d="M32 23s7 0 1-8c0 0 6-2-2-7 0 0 6-6.017-7-3 0 0 0-5-2-5s-4 4-4 4-2-4-4-4-2 5-2 5C-1 1.928 5 8 5 8c-8 5-2 7-2 7-6 8 1 8 1 8s-4 2-4 5 3 2 6 2c-7 9 12 1 12 1s19 8 12-1c3 0 6 1 6-2s-4-5-4-5z"/><path fill="#DD2E44" d="M28.963 16s-.26-6.519-3.982-9C21.982 5 20 5 18 5c-2.089 0-4 0-7 2-3.721 2.481-4 9-4 9-1 0-2.271 2.291-2 5 .289 2.889 2 4 2 4 0 4 3 7 3 7 0 2 0 3 4 3h7.963c4.037 0 4-1 4-3 0 0 3-3 3-7 0 0 1.711-1.111 2-4 .271-2.709-1-5-2-5z"/><path fill="#292F33" d="M25.178 25.622c-.845.445-4.378 1.467-7.178 1.467-3 0-6.508-1.022-7.353-1.467-.844-.444-1.776.344-1.51 1.867.363 2.074 1.253 4.684 3.387 4.195C13.224 31.524 15 30 18 30c3.022 0 4.645 1.524 5.345 1.684 2.133.489 2.893-2.122 3.255-4.195.267-1.523-.578-2.311-1.422-1.867z"/><g fill="#FFF"><path d="M25.721 28.741l-.805-3c-1.155.485-4.343 1.348-6.917 1.348-2.835 0-6.12-.912-7.186-1.388l-.815 3.04c-.142.531.176 1.082.707 1.225.531.142 1.082-.176 1.225-.707l.748-2.331c.892.344 3.114.664 5.322.66 2.161-.004 4.308-.324 5.18-.66l.616 2.331c.142.531.689.849 1.22.707.532-.142.848-.694.705-1.225z"/><path d="M22.929 29.906c.086-.403-.174-.804-.578-.889-.403-.086-.804.174-.889.578l-.119.643c-.351-.19-1.839-.646-3.343-.649-1.553-.003-3.125.454-3.484.649l-.198-.643c-.086-.404-.517-.664-.92-.578-.403.086-.679.486-.593.889l.318 1.514C14.038 30.941 15.632 30 18 30c2.255 0 3.729.847 4.624 1.345l.305-1.439z"/></g><path fill="#55ACEE" d="M13.496 14.984l-2.38-.506c-1.636-.348-3.259.706-3.607 2.342-.348 1.636.706 3.259 2.342 3.607l2.38.506c1.636.348 3.259-.706 3.607-2.342.348-1.636-.706-3.259-2.342-3.607zm9.008-.239l2.38-.506c1.636-.348 3.259.706 3.607 2.342.348 1.636-.706 3.259-2.342 3.607l-2.38.506c-1.636.348-3.259-.706-3.607-2.342-.348-1.636.706-3.259 2.342-3.607z"/><path fill="#FFCC4D" d="M13.737 15.47l-1.956-.416c-1.345-.286-2.679.581-2.965 1.926-.286 1.345.581 2.679 1.926 2.965l1.956.416c1.345.286 2.679-.581 2.965-1.926.285-1.344-.581-2.679-1.926-2.965z"/><circle fill="#292F33" cx="12.739" cy="17.708" r="1.5"/><path fill="#FFCC4D" d="M22.263 15.47l1.956-.416c1.345-.286 2.679.581 2.965 1.926.286 1.345-.581 2.679-1.925 2.965l-1.956.416c-1.345.286-2.679-.581-2.965-1.926-.286-1.344.58-2.679 1.925-2.965z"/><circle fill="#292F33" cx="23.261" cy="17.708" r="1.5"/><path fill="#A0041E" d="M18 26.5c-1.86 0-2.647-1.005-2.901-1.855-.543.128-1.345.209-1.929-.187-.305-.207-.67-.628-.67-1.458 0-.276.224-.5.5-.5s.5.224.5.5c0 .474.173.591.231.63.373.254 1.229.046 1.585-.095.153-.061.328-.042.465.052.136.093.219.247.219.413.003.149.083 1.5 2 1.5 1.978 0 2-1.438 2-1.5 0-.166.082-.32.22-.413.136-.094.309-.113.465-.052.356.142 1.211.35 1.585.095.057-.039.23-.156.23-.63 0-.276.224-.5.5-.5s.5.224.5.5c0 .83-.364 1.251-.671 1.458-.584.396-1.386.314-1.929.187-.253.85-1.041 1.855-2.9 1.855z"/><path fill="#BE1931" d="M23.663 34.095c-.63 0-1.292-.273-1.975-.816-.96-.765-1.864-1.484-3.688-1.484s-2.729.72-3.687 1.483c-1.186.945-2.439.944-3.624.002-.216-.172-.252-.487-.08-.703.171-.216.486-.252.703-.08.821.654 1.556.654 2.377 0 1.003-.798 2.138-1.701 4.311-1.701 2.174 0 3.309.903 4.31 1.7.578.46 1.096.654 1.531.587.477-.075.729-.449.738-.465.151-.229.46-.296.69-.147.229.148.3.452.154.684-.049.077-.5.759-1.403.912-.118.018-.237.028-.357.028z"/><path fill="#F4900C" d="M6.002.95c.026-.497.435-.896.92-.936.632-.053.912.447 1.146.953.73 1.574 1.508 3.121 2.544 4.52.72.973 1.589 2.014 2.696 2.564.589.197.862.911.55 1.449.525.911-.513 1.79-1.366 1.364-1.16.67-3.078-1.545-3.733-2.334-.846-1.019-1.496-2.191-1.954-3.43-.469-1.27-.883-2.779-.803-4.15zm23.988 0c-.026-.497-.435-.896-.92-.936-.632-.053-.912.447-1.146.953-.73 1.574-1.508 3.121-2.544 4.52-.72.973-1.589 2.014-2.696 2.564-.589.197-.862.911-.55 1.449-.525.911.513 1.79 1.366 1.364 1.16.67 3.078-1.545 3.733-2.334.846-1.018 1.496-2.19 1.954-3.429.469-1.271.883-2.78.803-4.151z"/><path fill="#292F33" d="M15 16c-4.254 0-7.422-2.08-7.555-2.168-.459-.306-.583-.927-.277-1.387.306-.458.926-.583 1.385-.279C8.581 12.185 11.372 14 15 14c.552 0 1 .448 1 1s-.448 1-1 1zm6 0c-.553 0-1-.448-1-1s.447-1 1-1c3.655 0 6.418-1.814 6.445-1.832.46-.307 1.08-.183 1.387.277.307.46.183 1.081-.277 1.387C28.422 13.92 25.254 16 21 16z"/></svg> ) } export default Ogre
298.733333
4,249
0.646061
b2f8a70beefce60cea39602036b022a8fbc32570
913
rb
Ruby
spec/routing/scenarios_routing_spec.rb
Jubke/wyvis
23694b33a83404398d14bfd12b6a2caa2bdad130
[ "MIT" ]
null
null
null
spec/routing/scenarios_routing_spec.rb
Jubke/wyvis
23694b33a83404398d14bfd12b6a2caa2bdad130
[ "MIT" ]
null
null
null
spec/routing/scenarios_routing_spec.rb
Jubke/wyvis
23694b33a83404398d14bfd12b6a2caa2bdad130
[ "MIT" ]
null
null
null
require "rails_helper" RSpec.describe ScenariosController, :type => :routing do describe "routing" do it "routes to #index" do expect(:get => "/scenarios").to route_to("scenarios#index") end it "routes to #new" do expect(:get => "/scenarios/new").to route_to("scenarios#new") end it "routes to #show" do expect(:get => "/scenarios/1").to route_to("scenarios#show", :id => "1") end it "routes to #edit" do expect(:get => "/scenarios/1/edit").to route_to("scenarios#edit", :id => "1") end it "routes to #create" do expect(:post => "/scenarios").to route_to("scenarios#create") end it "routes to #update" do expect(:put => "/scenarios/1").to route_to("scenarios#update", :id => "1") end it "routes to #destroy" do expect(:delete => "/scenarios/1").to route_to("scenarios#destroy", :id => "1") end end end
25.361111
84
0.600219
2c84e904cc3b848675e7fbffbcd7bf280569228a
6,818
cpp
C++
pin-3.22-98547-g7a303a835-gcc-linux/source/tools/AttachDetach/tls_app_ia32.cpp
ArthasZhang007/15418FinalProject
a71f698ea48ebbc446111734c198f16a55633669
[ "MIT" ]
null
null
null
pin-3.22-98547-g7a303a835-gcc-linux/source/tools/AttachDetach/tls_app_ia32.cpp
ArthasZhang007/15418FinalProject
a71f698ea48ebbc446111734c198f16a55633669
[ "MIT" ]
null
null
null
pin-3.22-98547-g7a303a835-gcc-linux/source/tools/AttachDetach/tls_app_ia32.cpp
ArthasZhang007/15418FinalProject
a71f698ea48ebbc446111734c198f16a55633669
[ "MIT" ]
null
null
null
/* * Copyright (C) 2009-2021 Intel Corporation. * SPDX-License-Identifier: MIT */ /*! @file * We test two aspects: - tls value before and after PIN_Detach() - creation new threads while PIN is detached from application */ #include <stdio.h> #include <pthread.h> #include <stdlib.h> #include <unistd.h> #include <sys/syscall.h> #include <linux/unistd.h> #include <asm/ldt.h> #include <errno.h> #include <string.h> #include <sys/utsname.h> #ifndef __NR_set_thread_area #define __NR_set_thread_area 243 #endif #ifndef __NR_get_thread_area #define __NR_get_thread_area 244 #endif #ifndef SYS_set_thread_area #define SYS_set_thread_area __NR_set_thread_area #endif #ifndef SYS_get_thread_area #define SYS_get_thread_area __NR_get_thread_area #endif #define NTHREADS 4 pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; unsigned int numOfThreadsReadyForDetach = 0; unsigned long pinDetached = 0; /* This function is replaced by Pin tool */ extern "C" void TellPinToDetach(unsigned long* updateWhenReady) { return; } struct UserDesc { UserDesc() : _entry_number(0), _base_addr(0), _val1(0), _val2(0) {} unsigned int _entry_number; unsigned int _base_addr; unsigned int _val1; unsigned int _val2; }; #define TLS_GET_GS_REG() \ ( \ { \ int __seg; \ __asm("movw %%gs, %w0" : "=q"(__seg)); \ __seg & 0xffff; \ }) #define TLS_SET_GS_REG(val) __asm("movw %w0, %%gs" ::"q"(val)) #define TLS_GET_FS_REG() \ ( \ { \ int __seg; \ __asm("movw %%fs, %w0" : "=q"(__seg)); \ __seg & 0xffff; \ }) #define TLS_SET_FS_REG(val) __asm("movw %w0, %%fs" ::"q"(val)) char buf[NTHREADS][3000]; unsigned int mainThreadAddress[8192]; #define GDT_NUM_OF_ENTRIES 3 #define GDT_ENTRIES 16 unsigned int GdtFirstEntry() { static int first = 0; if (first) return first; UserDesc thrDescr; for (int i = 0; i < GDT_ENTRIES; i++) { thrDescr._entry_number = i; int res = syscall(SYS_get_thread_area, &thrDescr); if ((res == 0) || (errno != EINVAL)) { first = i; return first; } } fprintf(stderr, "First GDT entry is not found\n"); exit(-1); } /* Check that TLS remains the same after Pin is detached * */ void* thread_func(void* arg) { unsigned long thread_no = (unsigned long)arg + 1; unsigned int gs_value = TLS_GET_GS_REG(); unsigned int gdtEntryMin = GdtFirstEntry(); unsigned int gdtEntryMax = gdtEntryMin + GDT_NUM_OF_ENTRIES - 1; UserDesc thrDescr[GDT_NUM_OF_ENTRIES]; for (unsigned int i = gdtEntryMin; i <= gdtEntryMax; i++) { unsigned int ind = i - gdtEntryMin; thrDescr[ind]._entry_number = i; int res = syscall(SYS_get_thread_area, &(thrDescr[ind])); if (res != 0) { fprintf(stderr, "SYS_get_thread_area failed for entry %d with error: %s\n", thrDescr[ind]._entry_number, strerror(errno)); return (void*)1; } } while (!pinDetached) { sched_yield(); } fprintf(stderr, "thread %d runs native\n", thread_no); UserDesc thrDescrAfter[GDT_NUM_OF_ENTRIES]; for (unsigned int i = gdtEntryMin; i <= gdtEntryMax; i++) { unsigned int ind = i - gdtEntryMin; thrDescrAfter[ind]._entry_number = i; int res = syscall(SYS_get_thread_area, &(thrDescrAfter[ind])); if (res != 0) { fprintf(stderr, "SYS_get_thread_area failed for entry %d with error: %s\n", thrDescrAfter[ind]._entry_number, strerror(errno)); return (void*)1; } if (thrDescrAfter[ind]._base_addr != thrDescr[ind]._base_addr) { fprintf(stderr, "ERROR in thread %d: base addr of entry %d before detach 0x%lx; after detach 0x%lx\n", thread_no, i, thrDescrAfter[ind]._base_addr, thrDescr[ind]._base_addr); return (void*)1; } } return 0; } int main(int argc, char* argv[]) { pthread_t h[NTHREADS]; unsigned int gdtEntryMin = GdtFirstEntry(); unsigned int gdtEntryMax = gdtEntryMin + GDT_NUM_OF_ENTRIES - 1; UserDesc thrDescr[GDT_NUM_OF_ENTRIES]; for (unsigned int i = gdtEntryMin; i <= gdtEntryMax; i++) { unsigned int ind = i - gdtEntryMin; thrDescr[ind]._entry_number = i; int res = syscall(SYS_get_thread_area, &thrDescr[ind]); if (res != 0) { fprintf(stderr, "SYS_get_thread_area failed for entry %d with error: %s\n", thrDescr[ind]._entry_number, strerror(errno)); return -1; } } for (unsigned long i = 0; i < NTHREADS; i++) { pthread_create(&h[i], 0, thread_func, (void*)i); } /* * If the number of threads is big, some threads leave system call "clone" * while PIN is detached. This functionality is also tested here. */ TellPinToDetach(&pinDetached); void* result[NTHREADS]; for (unsigned long i = 0; i < NTHREADS; i++) { pthread_join(h[i], &(result[i])); } fprintf(stderr, "main thread runs native\n"); for (unsigned long i = 0; i < NTHREADS; i++) { if (result[i] != 0) { fprintf(stderr, "TEST FAILED\n"); return -1; } } UserDesc thrDescrAfter[GDT_NUM_OF_ENTRIES]; for (unsigned int i = gdtEntryMin; i <= gdtEntryMax; i++) { unsigned int ind = i - gdtEntryMin; thrDescrAfter[ind]._entry_number = i; int res = syscall(SYS_get_thread_area, &thrDescrAfter[ind]); if (res != 0) { fprintf(stderr, "SYS_get_thread_area failed for entry %d with error: %s\n", thrDescrAfter[ind]._entry_number, strerror(errno)); return -1; } if (thrDescrAfter[ind]._base_addr != thrDescr[ind]._base_addr) { fprintf(stderr, "ERROR in the main thread: base addr of entry %d before detach 0x%lx; after detach 0x%lx\n", i, thrDescr[ind]._base_addr, thrDescrAfter[ind]._base_addr); fprintf(stderr, "TEST FAILED\n"); return -1; } } fprintf(stderr, "TEST PASSED\n"); return 0; }
29.772926
128
0.560135
c94f10dfdbbfb4944caa7184777fd95089f41274
576
ts
TypeScript
src/app/about/about-routing.module.ts
luchob/homepagev2
835da859faa151cefa3d2bd42cc65d2bd46afd50
[ "Unlicense" ]
null
null
null
src/app/about/about-routing.module.ts
luchob/homepagev2
835da859faa151cefa3d2bd42cc65d2bd46afd50
[ "Unlicense" ]
8
2019-02-08T19:05:28.000Z
2019-03-21T19:35:16.000Z
src/app/about/about-routing.module.ts
luchob/homepagev2
835da859faa151cefa3d2bd42cc65d2bd46afd50
[ "Unlicense" ]
null
null
null
import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import {AboutPageComponent} from './about-page/about-page.component'; const routes: Routes = [ { path: '', component: AboutPageComponent, data: { title: 'Lachezar Balev - About', description: 'Looking for some random thoughts from me? This is the part of my personal ' + 'home page that you should visit.', } } ]; @NgModule({ imports: [RouterModule.forChild(routes)], exports: [RouterModule] }) export class AboutRoutingModule { }
25.043478
97
0.668403
851d0b5a5ed6b27d12f14a109f4aa9c7d6909603
99
cs
C#
DotNetRuServer.Comon.BL/Config/IFlatEntity.cs
b-a-x/Server
b2f127dc3dd7b063b9df8c9bc40fa58a2492db8a
[ "MIT" ]
1
2019-11-17T18:15:16.000Z
2019-11-17T18:15:16.000Z
DotNetRuServer.Comon.BL/Config/IFlatEntity.cs
b-a-x/Server
b2f127dc3dd7b063b9df8c9bc40fa58a2492db8a
[ "MIT" ]
null
null
null
DotNetRuServer.Comon.BL/Config/IFlatEntity.cs
b-a-x/Server
b2f127dc3dd7b063b9df8c9bc40fa58a2492db8a
[ "MIT" ]
null
null
null
namespace DotNetRuServer.Comon.BL.Config { public interface IFlatEntity : IEntity { } }
16.5
42
0.69697
c69d3cbcd2f2e6a6975cf761fbdd8c68b2bb34f6
833
py
Python
setup.py
notpeter/legiscrape
f90375dbfffa8aef62807ba34e9225b3f0b3776e
[ "MIT" ]
3
2019-01-03T16:33:45.000Z
2020-07-24T00:42:53.000Z
setup.py
notpeter/legiscrape
f90375dbfffa8aef62807ba34e9225b3f0b3776e
[ "MIT" ]
1
2018-09-12T16:46:47.000Z
2018-09-12T16:46:47.000Z
setup.py
notpeter/legiscrape
f90375dbfffa8aef62807ba34e9225b3f0b3776e
[ "MIT" ]
null
null
null
from setuptools import setup setup(name='legiscrape', version='0.1.0', description='Legistar Scraper', long_description=( 'Legiscrape - Download Video from Legistar Meetings / Granicus Video Toolbox.' ), classifiers=[ 'Development Status :: 3 - Alpha', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3.5', 'Environment :: Console', ], entry_points = { 'console_scripts': ['legiscrape-video=legiscrape.cli:main'], }, url='http://github.com/notpeter/legiscrape', author='Peter Tripp', author_email='[email protected]', license='MIT', packages=['legiscrape'], include_package_data=True, install_requires=['jsonschema', 'requests'], zip_safe=False )
30.851852
86
0.605042
b74aa047fc0e3dc4c0e19150f3f1a085c1121459
9,684
cs
C#
SQMGagagu_source/SQMGagagu/sqmfile/Vehicles.cs
gagagu/SQMGagagu
1ea589add8084d161383cd321b9162ba7f325555
[ "MIT" ]
null
null
null
SQMGagagu_source/SQMGagagu/sqmfile/Vehicles.cs
gagagu/SQMGagagu
1ea589add8084d161383cd321b9162ba7f325555
[ "MIT" ]
null
null
null
SQMGagagu_source/SQMGagagu/sqmfile/Vehicles.cs
gagagu/SQMGagagu
1ea589add8084d161383cd321b9162ba7f325555
[ "MIT" ]
null
null
null
/* * SQLGagagu created by A.Eckers * */ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using SQMGagagu.sqmfile.datatypes; namespace SQMGagagu.sqmfile { /// <summary> /// Vehicle class /// Exists inside Group class and as main class in mission file /// </summary> public class Vehicles { // contains all Vehicle class items private List<Vehicles_Item> ItemsList; /// <summary> /// constructor /// create new list /// </summary> public Vehicles() { ItemsList = new List<Vehicles_Item>(); } public Vehicles_Item GetItemByID(int ItemID) { try { if (ItemsList.Count() == 0) return null; return ItemsList[ItemID]; } catch { return null; } } public int GetItemCount() { try { if (ItemsList != null) return ItemsList.Count(); else return 0; } catch { return 0; } } /// <summary> /// Adds a new item to Vehicle class list /// </summary> /// <param name="id">id of item</param> /// <param name="vehicle">vehicle class name</param> /// <param name="side">sets the side of the item, values: WEST,EAST,GUER,CIV,LOGIC,AMBIENT LIFE,EMPTY</param> /// <param name="position">position array</param> /// <param name="placement">placement radius</param> /// <param name="azimut">rotational radius 0 - 365</param> /// <param name="offsetY">offset in Y direction</param> /// <param name="special">Special flag of item, values: NONE, CARGO, FLY, IN FORMATION</param> /// <param name="player">Control flag, values: PLAY CDG, PLAYER COMMANDER, NON PLAYABLE</param> /// <param name="str_lock">Itel locked flag, values: UNLOCKED, LOCKED, LOCKEDPLAYER,DEFAULT</param> /// <param name="rank">rank of item, values: CORPORAL,SERGEANT,LIEUTENANT,CAPTAIN,MAJOR,COLONEL,PRIVATE</param> /// <param name="age">info age of item, values: ACTUAL, 5 MIN,10 MIN,15 MIN,30 MIN,60 MIN,120 MIN, UNKNOWN</param> /// <param name="text">item name, could be empty</param> /// <param name="init">init code of item, could be empty</param> /// <param name="description">item description, could be empty</param> /// <param name="skill">0.0 - 1.0 skill of item</param> /// <param name="health">0.0 - 1.0 health of item</param> /// <param name="fuel">0.0 - 1.0 fuel of item</param> /// <param name="ammo">0.0 - 1.0 ammo of item</param> /// <param name="presence">0.0 - 1.0 presence of item</param> /// <param name="presenceCondition">presence condition code</param> /// <param name="leader">leader of group 0 or 1</param> public void AddItem(int id, string vehicle, string side, SqmPosition position, double placement, double azimut, double offsetY, string special, string player, string str_lock, string rank, string age, string text, string init, string description, double skill, double health, double fuel, double ammo, double presence, string presenceCondition, int leader ) { Vehicles_Item item = new Vehicles_Item(); item.id = id; item.vehicle = vehicle; item.side = side; item.position = position; item.placement = placement; item.azimut = azimut; item.offsetY = offsetY; item.special = special; item.player = player; item.str_lock = str_lock; item.rank = rank; item.age = age; item.text = text; item.init = init; item.description = description; item.skill = skill; item.health = health; item.fuel = fuel; item.ammo = ammo; item.presence = presence; item.presenceCondition = presenceCondition; item.leader = leader; ItemsList.Add(item); } public void DeleteAll() { ItemsList.Clear(); } public void AddItem(Vehicles_Item item) { ItemsList.Add(item); } /// <summary> /// creates the class Vehicles string for export to file /// </summary> /// <returns>vehicle class string</returns> public string ToClassString(int tabulators) { if (ItemsList.Count == 0) return ""; StringBuilder retval = new StringBuilder(); string tabul = ""; for (int x = 0; x < tabulators; x++) { tabul += "\t"; } retval.AppendLine(tabul + "class Vehicles"); retval.AppendLine(tabul + "{"); retval.AppendLine(tabul + "\titems=" + ItemsList.Count().ToString() + ";"); int y = 0; foreach (Vehicles_Item item in ItemsList) { retval.AppendLine(tabul + "\tclass Item" + y.ToString()); retval.AppendLine(tabul + "\t{"); retval.AppendLine(tabul + "\t\tid=" + item.id.ToString() + ";"); retval.AppendLine(tabul + "\t\tvehicle=\"" + item.vehicle + "\";"); retval.AppendLine(tabul + "\t\tside=\"" + item.side + "\";"); if(item.position!=null) retval.AppendLine(tabul + "\t\tposition[]={" + item.position.X.ToString().Replace(",", ".") + "," + item.position.Z.ToString().Replace(",", ".") + "," + item.position.Y.ToString().Replace(",", ".") + "};"); if(item.placement>0) retval.AppendLine(tabul + "\t\tplacement=" + item.placement.ToString().Replace(",", ".") + ";"); if (item.azimut > 0) retval.AppendLine(tabul + "\t\tazimut=" + item.azimut.ToString().Replace(",", ".") + ";"); if (item.offsetY > 0) retval.AppendLine(tabul + "\t\toffsetY=" + item.offsetY.ToString().Replace(",", ".") + ";"); if (!string.IsNullOrEmpty(item.special) && (!item.special.ToUpper().Contains("IN FORMATION"))) retval.AppendLine(tabul + "\t\tspecial=\"" + item.special.ToUpper() + "\";"); if (!string.IsNullOrEmpty(item.player) && (!item.player.ToUpper().Contains("NON PLAYABLE"))) retval.AppendLine(tabul + "\t\tplayer=\"" + item.player.ToUpper() + "\";"); if (!string.IsNullOrEmpty(item.str_lock) && (!item.str_lock.ToUpper().Contains("DEFAULT"))) retval.AppendLine(tabul + "\t\tlock=\"" + item.str_lock.ToUpper() + "\";"); if (!string.IsNullOrEmpty(item.rank) && (!item.rank.ToUpper().Contains("PRIVATE"))) retval.AppendLine(tabul + "\t\trank=\"" + item.rank.ToUpper() + "\";"); if (!string.IsNullOrEmpty(item.age) && (!item.age.ToUpper().Contains("UNKNOWN"))) retval.AppendLine(tabul + "\t\tage=\"" + item.age.ToUpper() + "\";"); if (!string.IsNullOrEmpty(item.text)) retval.AppendLine(tabul + "\t\ttext=\"" + item.text + "\";"); if (!string.IsNullOrEmpty(item.init)) retval.AppendLine(tabul + "\t\tinit=\"" + item.init + "\";"); if (!string.IsNullOrEmpty(item.description)) retval.AppendLine(tabul + "\t\tdescription=\"" + item.description + "\";"); retval.AppendLine(tabul + "\t\tskill=" + item.skill.ToString().Replace(",", ".") + ";"); if (item.health < 1) retval.AppendLine(tabul + "\t\thealth=" + item.health.ToString().Replace(",", ".") + ";"); if (item.fuel < 1) retval.AppendLine(tabul + "\t\tfuel=" + item.fuel.ToString().Replace(",", ".") + ";"); if (item.ammo < 1) retval.AppendLine(tabul + "\t\tammo=" + item.ammo.ToString().Replace(",", ".") + ";"); if (item.presence < 1) retval.AppendLine(tabul + "\t\tpresence=" + item.presence.ToString().Replace(",", ".") + ";"); if ((!string.IsNullOrEmpty(item.presenceCondition))&& (item.presenceCondition.ToUpper()!="TRUE")) retval.AppendLine(tabul + "\t\tpresenceCondition=\"" + item.presenceCondition + "\";"); if(item.leader>0) retval.AppendLine(tabul + "\t\tleader=" + item.leader.ToString() + ";"); retval.AppendLine(tabul + "\t};"); y += 1; } retval.AppendLine(tabul + "};"); return retval.ToString(); } } }
39.048387
226
0.486886
8c0f0067eca0d4bf0e65494014462bf02503af24
546
cs
C#
src/BotOperate/Models/MicrosoftGraph/TeamsTabConfiguration.cs
kamalanathan82/BotOperate
06a073edc1e16b6214c32d1fcdefae01117ceb9c
[ "MIT" ]
null
null
null
src/BotOperate/Models/MicrosoftGraph/TeamsTabConfiguration.cs
kamalanathan82/BotOperate
06a073edc1e16b6214c32d1fcdefae01117ceb9c
[ "MIT" ]
null
null
null
src/BotOperate/Models/MicrosoftGraph/TeamsTabConfiguration.cs
kamalanathan82/BotOperate
06a073edc1e16b6214c32d1fcdefae01117ceb9c
[ "MIT" ]
null
null
null
using Newtonsoft.Json; namespace BotOperate.Models.MicrosoftGraph { public sealed class TeamsTabConfiguration { [JsonProperty(PropertyName = "entityId")] public string EntityId { get; set; } [JsonProperty(PropertyName = "contentUrl")] public string ContentUrl { get; set; } [JsonProperty(PropertyName = "removeUrl")] public string RemoveUrl { get; set; } [JsonProperty(PropertyName = "websiteUrl")] public string WebsiteUrl { get; set; } } }
28.736842
51
0.619048
e0569430842e97492b62d71dd6cb6d4d61eab042
3,388
h
C
code-readpad/kernel-schema/fs_xfs_xfs_aops.c.h
r4b3rt/kde
b02669373eeae9b836ba83f004ad2f2b642ffac1
[ "MIT" ]
6
2022-03-10T12:04:18.000Z
2022-03-29T03:34:26.000Z
code-readpad/kernel-schema/fs_xfs_xfs_aops.c.h
r4b3rt/kde
b02669373eeae9b836ba83f004ad2f2b642ffac1
[ "MIT" ]
125
2017-06-16T08:00:28.000Z
2017-11-23T07:08:00.000Z
code-readpad/kernel-schema/fs_xfs_xfs_aops.c.h
lkml-likexu/kde
8d650a838db6660c5fe01139cb5edb8640abd01a
[ "MIT" ]
null
null
null
\n struct block_device * xfs_find_bdev_for_inode(struct inode*inode) struct dax_device * xfs_find_daxdev_for_inode(struct inode*inode) static void xfs_finish_page_writeback(struct inode*inode, struct bio_vec*bvec, int error) STATIC void xfs_destroy_ioend(struct xfs_ioend *ioend, int error) static inline bool xfs_ioend_is_append(struct xfs_ioend *ioend) STATIC int xfs_setfilesize_trans_alloc(struct xfs_ioend *ioend) STATIC int __xfs_setfilesize(struct xfs_inode *ip, struct xfs_trans *tp, xfs_off_toffset, size_t size) int xfs_setfilesize(struct xfs_inode *ip, xfs_off_toffset, size_t size) STATIC int xfs_setfilesize_ioend(struct xfs_ioend *ioend, int error) STATIC void xfs_end_io(struct work_struct *work) STATIC void xfs_end_bio(struct bio*bio) STATIC int xfs_map_blocks(struct xfs_writepage_ctx *wpc, struct inode*inode, loff_t offset) STATIC int xfs_submit_ioend(struct writeback_control *wbc, struct xfs_ioend *ioend, int status) static struct xfs_ioend * xfs_alloc_ioend(struct inode*inode, unsigned inttype, xfs_off_toffset, struct block_device *bdev, sector_tsector) static void xfs_chain_bio(struct xfs_ioend *ioend, struct writeback_control *wbc, struct block_device *bdev, sector_tsector) STATIC void xfs_add_to_ioend(struct inode*inode, xfs_off_toffset, struct page*page, struct iomap_page *iop, struct xfs_writepage_ctx *wpc, struct writeback_control *wbc, struct list_head *iolist) STATIC void xfs_vm_invalidatepage(struct page*page, unsigned intoffset, unsigned intlength) STATIC void xfs_aops_discard_page(struct page*page) static int xfs_writepage_map(struct xfs_writepage_ctx *wpc, struct writeback_control *wbc, struct inode*inode, struct page*page, uint64_tend_offset) STATIC int xfs_do_writepage(struct page*page, struct writeback_control *wbc, void *data) STATIC int xfs_vm_writepage(struct page*page, struct writeback_control *wbc) STATIC int xfs_vm_writepages(struct address_space *mapping, struct writeback_control *wbc) STATIC int xfs_dax_writepages(struct address_space *mapping, struct writeback_control *wbc) STATIC int xfs_vm_releasepage(struct page*page, gfp_t gfp_mask) STATIC sector_t xfs_vm_bmap(struct address_space *mapping, sector_tblock) STATIC int xfs_vm_readpage(struct file*unused, struct page*page) STATIC int xfs_vm_readpages(struct file*unused, struct address_space *mapping, struct list_head *pages, unsignednr_pages) static int xfs_iomap_swapfile_activate(struct swap_info_struct*sis, struct file *swap_file, sector_t *span) \n 8 struct writeback_control *wbc 8 struct page*page 7 struct inode*inode 6 struct xfs_ioend *ioend 4 xfs_off_toffset 4 struct address_space *mapping 3 struct xfs_writepage_ctx *wpc 3 int error 2 struct xfs_inode *ip 2 struct file*unused 2 struct block_device *bdev 2 size_t size 2 sector_tsector 1 void *data 1 unsignednr_pages 1 unsigned inttype 1 unsigned intoffset 1 unsigned intlength 1 uint64_tend_offset 1 struct xfs_trans *tp 1 struct work_struct *work 1 struct swap_info_struct*sis 1 struct list_head *pages 1 struct list_head *iolist 1 struct iomap_page *iop 1 struct file *swap_file 1 struct bio_vec*bvec 1 struct bio*bio 1 sector_t *span 1 sector_tblock 1 loff_t offset 1 int status 1 gfp_t gfp_mask
52.123077
195
0.789256
13f679a0c170077b245c4e399085823c03601bce
756
rb
Ruby
app/models/user/academics/term_plans/queries.rb
SusanaParker/calcentral
e2c2fdf53052cc56659ee1171a04e6c0a9c214ae
[ "ECL-2.0" ]
9
2019-03-15T23:40:17.000Z
2021-07-17T02:29:51.000Z
app/models/user/academics/term_plans/queries.rb
SusanaParker/calcentral
e2c2fdf53052cc56659ee1171a04e6c0a9c214ae
[ "ECL-2.0" ]
214
2019-03-15T22:39:57.000Z
2020-11-12T18:43:32.000Z
app/models/user/academics/term_plans/queries.rb
SusanaParker/calcentral
e2c2fdf53052cc56659ee1171a04e6c0a9c214ae
[ "ECL-2.0" ]
21
2019-03-14T22:53:15.000Z
2020-10-31T16:33:53.000Z
module User module Academics module TermPlans class Queries < ::EdoOracle::Connection include ActiveRecordHelper include Concerns::QueryHelper def self.get_student_term_cpp(student_id) query = <<-SQL SELECT TERM_ID as term_id, ACAD_CAREER_CODE as acad_career, ACAD_CAREER_DESCR as acad_career_descr, ACAD_PROGRAM as acad_program, ACAD_PLAN as acad_plan FROM SISEDO.STUDENT_TERM_CPPV00_VW WHERE INSTITUTION = '#{UC_BERKELEY}' AND STUDENT_ID = '#{student_id}' ORDER BY TERM_ID DESC SQL safe_query(query) end end end end end
26.068966
53
0.572751
1a59aa211f09b01a7e358c3944681e10a291e26d
890
py
Python
100 Days Python/day003/src/logicalOperators.py
AiseKaise/100DaysPython
6deba07b3b79bd4fbc11379878ba4f1c2887d315
[ "MIT" ]
null
null
null
100 Days Python/day003/src/logicalOperators.py
AiseKaise/100DaysPython
6deba07b3b79bd4fbc11379878ba4f1c2887d315
[ "MIT" ]
null
null
null
100 Days Python/day003/src/logicalOperators.py
AiseKaise/100DaysPython
6deba07b3b79bd4fbc11379878ba4f1c2887d315
[ "MIT" ]
null
null
null
# In "and" operator if ONE is false the whole is false # in "or" operator if ONE is true the whole is true print("Welcome to the rollercoaster!") height = int(input("What is your height in cms? ")) bill = 0 if height >= 120: print("You can ride the rollercoaster") age = int(input("What is your age? ")) if age < 12: bill = 5 print("Child tickets are $5") elif age <= 18: bill = 7 print("Youth tickets are $7") elif age >= 45 and age <= 55: print("Everything is going to be ok. Have a free ride") else: bill = 14 print("Adult tickets are $14") wants_photo = input("Do you want a photo taken? Y or N.") if wants_photo == "Y": bill += 3 print(f"Your final bill is $ {bill}") else: print("Sorry, your pp isn't grown up to ride the rollercoaster")
27.8125
68
0.570787
07d73bd4d30b616f7a7dbc6e65ac50d51438856e
1,287
css
CSS
static/css/style.css
DhyanilMehta/Resume-Screening-ML-Project
8fe050ef024b7fba381cffc497ec255c473cee0e
[ "MIT" ]
null
null
null
static/css/style.css
DhyanilMehta/Resume-Screening-ML-Project
8fe050ef024b7fba381cffc497ec255c473cee0e
[ "MIT" ]
null
null
null
static/css/style.css
DhyanilMehta/Resume-Screening-ML-Project
8fe050ef024b7fba381cffc497ec255c473cee0e
[ "MIT" ]
null
null
null
* { box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; } body { font-family: 'Montserrat', sans-serif; background: #535c68; } .wrapper { margin: auto; max-width: 640px; padding-top: 60px; text-align: center; } .my-container { background-color: #f9f9f9; padding: 20px; border-radius: 10px; /*border: 0.5px solid rgba(130, 130, 130, 0.25);*/ /*box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.1);*/ } h1 { color: #130f40; font-family: 'Varela Round', sans-serif; letter-spacing: -.5px; font-weight: 700; padding-bottom: 10px; } .upload-container { background-color: rgb(239, 239, 239); border-radius: 6px; padding: 10px; } .border-container { border: 5px dashed rgba(198, 198, 198, 0.65); /* border-radius: 4px; */ padding: 20px; } .border-container p { color: #130f40; font-weight: 600; font-size: 1.1em; letter-spacing: -1px; margin-top: 30px; margin-bottom: 0; opacity: 0.65; } #file-browser { text-decoration: none; color: rgb(22,42,255); border-bottom: 3px dotted rgba(22, 22, 255, 0.85); } #file-browser:hover { color: rgb(0, 0, 255); border-bottom: 3px dotted rgba(0, 0, 255, 0.85); } .icons { color: #95afc0; opacity: 0.55; }
17.875
52
0.622378
b72fcf1fa68c97dc768e7a1736da51362b6394f4
2,950
cs
C#
EasyReportServiceTests/Services/EasyReportServiceTests.cs
bchuang/EasyReportService
138c72ba55b61b7b99640edeb52619e2bd9aa909
[ "MIT" ]
null
null
null
EasyReportServiceTests/Services/EasyReportServiceTests.cs
bchuang/EasyReportService
138c72ba55b61b7b99640edeb52619e2bd9aa909
[ "MIT" ]
null
null
null
EasyReportServiceTests/Services/EasyReportServiceTests.cs
bchuang/EasyReportService
138c72ba55b61b7b99640edeb52619e2bd9aa909
[ "MIT" ]
null
null
null
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using EasyReportService.Entities; using System.Configuration; using System.IO; namespace EasyReportService.Services.Tests { [TestClass()] public class EasyReportServiceTests { [TestMethod()] public void RunTest() { GetEasyReportService().Run(); } [TestMethod()] public void RunWithReportDataTest() { GetEasyReportService().Run(new ReportData { FileName = "Test", Command = "SELECT @@SERVERNAME; " }); } private EasyReportService GetEasyReportService() { return new EasyReportService(GetReportSetting(), GetMailSetting()); } private ReportSetting GetReportSetting() { return new ReportSetting { NeedSend = ConfigurationManager.AppSettings["NeedSend"].ToUpper() == "Y" ? true : false, NeedCmdPause = ConfigurationManager.AppSettings["NeedCmdPause"].ToUpper() == "Y" ? true : false, SqlType = (SQLProviderType)(int.Parse(ConfigurationManager.AppSettings["SQLProviderType"])), ExportType = (ExportType)(int.Parse(ConfigurationManager.AppSettings["ExportType"])), ExportPH = Path.Combine(string.Format("{0}{1}", System.AppDomain.CurrentDomain.BaseDirectory, ConfigurationManager.AppSettings["exportPath"])), QueryPH = Path.Combine(string.Format("{0}{1}", System.AppDomain.CurrentDomain.BaseDirectory, ConfigurationManager.AppSettings["queryPath"])), }; } private MailSetting GetMailSetting() { return new MailSetting { MailServer = ((NameValueCollection)ConfigurationManager.GetSection("mailSettings"))["MailServer"], Port = Convert.ToInt32(((NameValueCollection)ConfigurationManager.GetSection("mailSettings"))["Port"]), EnableSsl = ((NameValueCollection)ConfigurationManager.GetSection("mailSettings"))["EnableSsl"].ToUpper() == "Y" ? true : false, MailFrom = ((NameValueCollection)ConfigurationManager.GetSection("mailSettings"))["MailFrom"], MailTo = ((NameValueCollection)ConfigurationManager.GetSection("mailSettings"))["MailTo"], Mailcc = ((NameValueCollection)ConfigurationManager.GetSection("mailSettings"))["Mailcc"], MailBcc = ((NameValueCollection)ConfigurationManager.GetSection("mailSettings"))["MailBcc"], EnableCredential = ((NameValueCollection)ConfigurationManager.GetSection("mailSettings"))["EnableCredential"].ToUpper() == "Y" ? true : false, MailAccount = ((NameValueCollection)ConfigurationManager.GetSection("mailSettings"))["MailAccount"], MailPwd = ((NameValueCollection)ConfigurationManager.GetSection("mailSettings"))["MailPwd"], }; } } }
49.166667
159
0.648136
0fe61cd60e5d830f5e58f7d431e12bffcd088dc9
1,763
sql
SQL
DB/todo_list_app.sql
mhmiton/ToDo_list_app_ci
781cacee83672f89eb95bbe7d39a3e7fef6dbb83
[ "MIT" ]
null
null
null
DB/todo_list_app.sql
mhmiton/ToDo_list_app_ci
781cacee83672f89eb95bbe7d39a3e7fef6dbb83
[ "MIT" ]
null
null
null
DB/todo_list_app.sql
mhmiton/ToDo_list_app_ci
781cacee83672f89eb95bbe7d39a3e7fef6dbb83
[ "MIT" ]
null
null
null
-- phpMyAdmin SQL Dump -- version 4.1.12 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: May 22, 2018 at 11:17 AM -- Server version: 5.6.16 -- PHP Version: 5.5.11 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 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 utf8 */; -- -- Database: `todo_list_app` -- -- -------------------------------------------------------- -- -- Table structure for table `task` -- CREATE TABLE IF NOT EXISTS `task` ( `id` int(11) NOT NULL AUTO_INCREMENT, `task_name` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ; -- -- Dumping data for table `task` -- INSERT INTO `task` (`id`, `task_name`) VALUES (2, 'Go to Framget for shopping.'), (3, 'Playing Cricket.'), (4, 'In the afternoon, I went to the river.'), (5, 'Prepare cake for the afternoon.'), (8, 'Watch Movie on Youtube'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `usr_name` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `usr_name`, `password`) VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3'); /*!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 */;
25.550725
67
0.651163
93ed0d51cc342d9e3938a284672c05f91600d39e
2,645
cs
C#
EventSubExample/Models/Subscriptions/ChannelSubscriptions/ChannelPointsCustomRewardRedemptionAddNotification.cs
Saschanski/EventSubExample
8ec4510c297114e42797d73a794fd09399c4c7ce
[ "MIT" ]
1
2021-07-22T16:05:00.000Z
2021-07-22T16:05:00.000Z
EventSubExample/Models/Subscriptions/ChannelSubscriptions/ChannelPointsCustomRewardRedemptionAddNotification.cs
Saschanski/EventSubExample
8ec4510c297114e42797d73a794fd09399c4c7ce
[ "MIT" ]
null
null
null
EventSubExample/Models/Subscriptions/ChannelSubscriptions/ChannelPointsCustomRewardRedemptionAddNotification.cs
Saschanski/EventSubExample
8ec4510c297114e42797d73a794fd09399c4c7ce
[ "MIT" ]
null
null
null
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace EventSubExample.Models.Subscriptions.ChannelSubscriptions { /// <summary> /// The channel.channel_points_custom_reward_redemption.add subscription type sends a notification when a viewer has redeemed a custom channel points reward on the specified channel. /// Must have channel:read:redemptions or channel:manage:redemptions scope. /// </summary> public class ChannelPointsCustomRewardRedemptionAddNotification { [JsonProperty("event")] public ChannelPointsCustomRewardRedemptionAddEvent Event { get; set; } [JsonProperty("subscription")] public ChannelPointsCustomRewardRedemptionAddSubscription Subscription { get; set; } } public class ChannelPointsCustomRewardRedemptionAddSubscription : Subscription { [JsonProperty("condition")] public ChannelPointsCustomRewardRedemptionAddCondition Condition { get; set; } } public class ChannelPointsCustomRewardRedemptionAddCondition { [JsonProperty("broadcaster_user_id")] public string BroadcasterUserId { get; set; } } public class ChannelPointsCustomRewardRedemptionAddReward { [JsonProperty("id")] public string Id { get; set; } [JsonProperty("title")] public string Title { get; set; } [JsonProperty("cost")] public int Cost { get; set; } [JsonProperty("prompt")] public string Prompt { get; set; } } public class ChannelPointsCustomRewardRedemptionAddEvent { [JsonProperty("id")] public string Id { get; set; } [JsonProperty("broadcaster_user_id")] public string BroadcasterUserId { get; set; } [JsonProperty("broadcaster_user_login")] public string BroadcasterUserLogin { get; set; } [JsonProperty("broadcaster_user_name")] public string BroadcasterUserName { get; set; } [JsonProperty("user_id")] public string UserId { get; set; } [JsonProperty("user_login")] public string UserLogin { get; set; } [JsonProperty("user_name")] public string UserName { get; set; } [JsonProperty("user_input")] public string UserInput { get; set; } [JsonProperty("status")] public string Status { get; set; } [JsonProperty("reward")] public ChannelPointsCustomRewardRedemptionAddReward Reward { get; set; } [JsonProperty("redeemed_at")] public string RedeemedAt { get; set; } } }
31.117647
186
0.671834
b192605b525578d6c9fe07cb2aed9dd6e6fe98f3
299
py
Python
xv_leak_tools/test_device/router_device.py
RDTCREW/expressvpn_leak_testing
da710573ccbe6472c4e4588058d9ec887e61e0a9
[ "MIT" ]
null
null
null
xv_leak_tools/test_device/router_device.py
RDTCREW/expressvpn_leak_testing
da710573ccbe6472c4e4588058d9ec887e61e0a9
[ "MIT" ]
null
null
null
xv_leak_tools/test_device/router_device.py
RDTCREW/expressvpn_leak_testing
da710573ccbe6472c4e4588058d9ec887e61e0a9
[ "MIT" ]
null
null
null
from xv_leak_tools.log import L from xv_leak_tools.test_device.device import Device class RouterDevice(Device): def os_name(self): # TODO: Make this dynamic return 'linux' def os_version(self): L.warning("TODO: Linux version") return 'TODO: Linux version'
23
51
0.67893
c68152cd50cdad7a8061d4413c8cf518b5742931
1,153
py
Python
plaso/containers/errors.py
ir4n6/plaso
010f9cbdfc82e21ed6658657fd09a7b44115c464
[ "Apache-2.0" ]
null
null
null
plaso/containers/errors.py
ir4n6/plaso
010f9cbdfc82e21ed6658657fd09a7b44115c464
[ "Apache-2.0" ]
null
null
null
plaso/containers/errors.py
ir4n6/plaso
010f9cbdfc82e21ed6658657fd09a7b44115c464
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- """Error attribute containers.""" from __future__ import unicode_literals from plaso.containers import interface from plaso.containers import manager # TODO: add AnalysisError. class ExtractionError(interface.AttributeContainer): """Extraction error attribute container. Attributes: message (str): error message. parser_chain (str): parser chain to which the error applies. path_spec (dfvfs.PathSpec): path specification of the file entry to which the error applies. """ CONTAINER_TYPE = 'extraction_error' def __init__(self, message=None, parser_chain=None, path_spec=None): """Initializes a parse error. Args: message (Optional[str]): error message. parser_chain (Optional[str]): parser chain to which the error applies. path_spec (Optional[dfvfs.PathSpec]): path specification of the file entry to which the error applies. """ super(ExtractionError, self).__init__() self.message = message self.parser_chain = parser_chain self.path_spec = path_spec manager.AttributeContainersManager.RegisterAttributeContainer(ExtractionError)
28.825
78
0.732871
bb05ee9e1fa7254889f8dae1535beeb85cf9d5ef
833
cs
C#
src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/InternalComponentsOnOffPage.cs
belav/roslyn
01124c8bbeacb560271261e97c10317114836299
[ "MIT" ]
null
null
null
src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/InternalComponentsOnOffPage.cs
belav/roslyn
01124c8bbeacb560271261e97c10317114836299
[ "MIT" ]
null
null
null
src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/InternalComponentsOnOffPage.cs
belav/roslyn
01124c8bbeacb560271261e97c10317114836299
[ "MIT" ]
null
null
null
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Runtime.InteropServices; using Microsoft.CodeAnalysis.Editor.Shared.Options; namespace Microsoft.VisualStudio.LanguageServices.Implementation.Options { [Guid(Guids.RoslynOptionPageFeatureManagerComponentsIdString)] internal class InternalComponentsOnOffPage : AbstractOptionPage { protected override AbstractOptionPageControl CreateOptionPage( IServiceProvider serviceProvider, OptionStore optionStore ) { return new InternalOptionsControl(nameof(EditorComponentOnOffOptions), optionStore); } } }
33.32
96
0.753902
46e0b4be89c4b3e5247b42d56d79015ba012896f
2,472
py
Python
tests/test_emulation.py
NeuralMMO/neural-mmo
5cde906245b015a7b7c7d0d1fb4b30a70b3b1a8b
[ "MIT" ]
27
2021-12-15T12:10:06.000Z
2022-03-31T13:59:47.000Z
tests/test_emulation.py
NeuralMMO/neural-mmo
5cde906245b015a7b7c7d0d1fb4b30a70b3b1a8b
[ "MIT" ]
null
null
null
tests/test_emulation.py
NeuralMMO/neural-mmo
5cde906245b015a7b7c7d0d1fb4b30a70b3b1a8b
[ "MIT" ]
4
2021-12-23T16:05:49.000Z
2022-03-22T01:54:30.000Z
from pdb import set_trace as T import numpy as np import nmmo def init_env(config_cls=nmmo.config.Small): env = nmmo.Env(config_cls()) obs = env.reset() return env, obs def test_emulate_flat_obs(): class Config(nmmo.config.Small): EMULATE_FLAT_OBS = True init_env(Config) def test_emulate_flat_atn(): class Config(nmmo.config.Small): EMULATE_FLAT_ATN = True init_env(Config) def test_emulate_const_nent(): class Config(nmmo.config.Small): EMULATE_CONST_NENT = True init_env(Config) def test_all_emulation(): class Config(nmmo.config.Small): EMULATE_FLAT_OBS = True EMULATE_FLAT_ATN = True EMULATE_CONST_POP = True init_env(Config) def test_emulate_single_agent(): class Config(nmmo.config.Small): EMULATE_CONST_NENT = True config = Config() envs = nmmo.emulation.multiagent_to_singleagent(config) for e in envs: ob = e.reset() for i in range(32): ob, reward, done, info = e.step({}) def equals(batch1, batch2): entity_keys = [e[0][0] for e in nmmo.io.stimulus.Serialized] assert list(batch1.keys()) == list(batch2.keys()) == entity_keys for (entity_name,), entity in nmmo.io.stimulus.Serialized: batch1_attrs = batch1[entity_name] batch2_attrs = batch2[entity_name] attr_keys = 'Continuous Discrete N'.split() assert list(batch1_attrs.keys()) == list(batch2_attrs.keys()) == attr_keys for key in attr_keys: assert np.array_equal(batch1_attrs[key], batch2_attrs[key]) def test_pack_unpack_obs(): env, obs = init_env() packed = nmmo.emulation.pack_obs(obs) packed = np.vstack(list(packed.values())) T() unpacked = nmmo.emulation.unpack_obs(env.config, packed) batched = nmmo.emulation.batch_obs(obs) equals(unpacked, batched) def test_obs_pack_speed(benchmark): env, obs = init_env() benchmark(lambda: nmmo.emulation.pack_obs(obs)) def test_obs_unpack_speed(benchmark): env, obs = init_env() packed = nmmo.emulation.pack_obs(obs) packed = np.vstack(list(packed.values())) benchmark(lambda: nmmo.emulation.unpack_obs(env.config, packed)) if __name__ == '__main__': test_flat_obs()
29.082353
82
0.620955
43fecf70276c102b4badd2f979121760065ba3ac
153
ts
TypeScript
src/interfaces/batching.interface.ts
strandls/ecocert-ui
642bb243c911e82d47c691995f4d196979ed64a6
[ "Apache-2.0" ]
null
null
null
src/interfaces/batching.interface.ts
strandls/ecocert-ui
642bb243c911e82d47c691995f4d196979ed64a6
[ "Apache-2.0" ]
null
null
null
src/interfaces/batching.interface.ts
strandls/ecocert-ui
642bb243c911e82d47c691995f4d196979ed64a6
[ "Apache-2.0" ]
null
null
null
export interface IBatching { collectionData, nonSelectable } export interface IBatchingFuncs { getCollectionData; createBatchfromCollections; }
15.3
33
0.803922
0db2871dd24261c04dfbd8f0152940ce83d47029
2,998
cs
C#
Program.cs
borisgr04/jsreport-dotnet-example-consoleapp
73a1de797b1b480241c2d8bff58bc2ad24c42b58
[ "MIT" ]
null
null
null
Program.cs
borisgr04/jsreport-dotnet-example-consoleapp
73a1de797b1b480241c2d8bff58bc2ad24c42b58
[ "MIT" ]
null
null
null
Program.cs
borisgr04/jsreport-dotnet-example-consoleapp
73a1de797b1b480241c2d8bff58bc2ad24c42b58
[ "MIT" ]
null
null
null
using jsreport.Binary; using jsreport.Local; using jsreport.Types; using System; using System.Diagnostics; using System.IO; using System.Linq; namespace ConsoleApp { class Program { static void Main(string[] args) { Console.WriteLine("Initializing local jsreport.exe utility"); var rs = new LocalReporting() .RunInDirectory(Path.Combine(Directory.GetCurrentDirectory(), "jsreport")) .KillRunningJsReportProcesses() .UseBinary(JsReportBinary.GetBinary()) .Configure(cfg => cfg.AllowLocalFilesAccess().FileSystemStore().BaseUrlAsWorkingDirectory()) .AsWebServer() .Create(); rs.StartAsync().Wait(); Console.ReadKey(); Console.WriteLine("Rendering localy stored template jsreport/data/templates/Invoice into invoice.pdf"); var invoiceReport = rs.RenderByNameAsync("Invoice", InvoiceData).Result; invoiceReport.Content.CopyTo(File.OpenWrite("invoice.pdf")); Console.WriteLine("Rendering custom report fully described through the request object into customReport.pdf"); var customReport = rs.RenderAsync(CustomRenderRequest).Result; customReport.Content.CopyTo(File.OpenWrite("customReport.pdf")); byte[] pdfByte = ReadFully(customReport.Content); } private static byte[] ReadFully(Stream input) { using (MemoryStream ms = new MemoryStream()) { input.CopyTo(ms); return ms.ToArray(); } } private static RenderRequest CustomRenderRequest = new RenderRequest() { Template = new Template() { Content = "Helo world from {{message}}", Engine = Engine.Handlebars, Recipe = Recipe.PhantomPdf }, Data = new { message = "jsreport for .NET!!!" } }; static object InvoiceData = new { number = "123", seller = new { name = "Next Step Webs, Inc.", road = "12345 Sunny Road", country = "Sunnyville, TX 12345" }, buyer = new { name = "Acme Corp.", road = "16 Johnson Road", country = "Paris, France 8060" }, items = new[] { new { name = "Website design", price = 300 }, new { name = "Website design", price = 300 } }, usuarios = new[] { new { name = "Boris G", rol = "Proyecto"}, new { name = "Anya B", rol = "Revisó" }, new { name = "Valentina", rol = "Supervisó" }, new { name = "Nicolás", rol = "Autorizó" } }, }; } }
32.945055
122
0.512342
7287eb3a1305d14b45c5958e3dd56021bc21d6ba
757
cs
C#
Czar.Cms/Czar.Cms.Core/Repository/IUnitOfWork.cs
jcsoft-net/Czar.Cms
6a6e686e707775aa1b05044b212d6c61f50b19da
[ "MIT" ]
null
null
null
Czar.Cms/Czar.Cms.Core/Repository/IUnitOfWork.cs
jcsoft-net/Czar.Cms
6a6e686e707775aa1b05044b212d6c61f50b19da
[ "MIT" ]
null
null
null
Czar.Cms/Czar.Cms.Core/Repository/IUnitOfWork.cs
jcsoft-net/Czar.Cms
6a6e686e707775aa1b05044b212d6c61f50b19da
[ "MIT" ]
2
2019-07-23T09:49:21.000Z
2019-11-29T13:40:31.000Z
namespace Czar.Cms.Core.Repository { /// <summary> /// 工作单元接口 /// </summary> public interface IUnitOfWork { // <summary> /// 注册新增操作 /// </summary> /// <param name="entity">实体</param> void Add<TEntity>(TEntity entity) where TEntity : class; /// <summary> /// 注册更新操作 /// </summary> /// <param name="entity">实体</param> void Update<TEntity>(TEntity entity) where TEntity : class; /// <summary> /// 注册删除操作 /// </summary> /// <param name="entity">实体</param> void Delete<TEntity>(TEntity entity) where TEntity : class; /// <summary> /// 提交事务 /// </summary> int Commit(); } }
23.65625
67
0.484808
dd9cde79f686a9d5d450660225e7834f52d09e39
1,725
py
Python
models.py
mazzamani/bike-sharing
61019741541925ef0623fd0ca472c2028582c2d4
[ "MIT" ]
null
null
null
models.py
mazzamani/bike-sharing
61019741541925ef0623fd0ca472c2028582c2d4
[ "MIT" ]
null
null
null
models.py
mazzamani/bike-sharing
61019741541925ef0623fd0ca472c2028582c2d4
[ "MIT" ]
null
null
null
import torch from torch import nn class GRUmodel(nn.Module): def __init__(self, args, input_dim, val_test_batch, class_num): super(GRUmodel, self).__init__() self.args = args self.hidden_dim = args.hidden_dim self.num_layers = args.num_layers self.batch_size = args.batch_size # For the validation and test the whole set is taken at once, so we change the batch size self.inner_batch_size = args.batch_size self.val_test_batch = val_test_batch self.gru = nn.GRU(input_size=input_dim, hidden_size=self.hidden_dim, dropout=args.dropout, num_layers=self.num_layers, batch_first=True) self.init_hidden(mode='train') self.relu = nn.ReLU() self.lin1 = nn.Linear(self.hidden_dim , 64) self.lin2 = nn.Linear(64, class_num) def init_hidden(self, mode): # changing the batch size in case of the validation, test and final graph if mode == 'train': batch_size = self.batch_size elif mode == 'val': batch_size = self.val_test_batch[0] elif mode == 'test' or mode == 'graph': batch_size = self.val_test_batch[1] self.inner_batch_size = batch_size self.hidden = torch.zeros( self.num_layers, batch_size, self.hidden_dim, requires_grad=True) # h def forward(self, input_batch): # feeding input to batch lstm_out, last_hidden = self.gru(input_batch, self.hidden) # taking last hidden state to the fully connected layer out = self.lin1(last_hidden[-1]) # and a fully connected layer out = self.relu(out) out = self.lin2(out) return out
33.173077
104
0.636522
87268a58d509e08ae37b77518ee9467cf1603b23
2,245
sql
SQL
data_sources/sqlite/03-imagestorage.sql
unification-com/haiku-node-prototype
ea77aa90f6b3f08d004be1c24e6b8d62e83bc66b
[ "MIT" ]
3
2018-06-15T18:02:05.000Z
2018-07-06T02:32:18.000Z
data_sources/sqlite/03-imagestorage.sql
unification-com/haiku-node-prototype
ea77aa90f6b3f08d004be1c24e6b8d62e83bc66b
[ "MIT" ]
4
2018-08-17T06:51:34.000Z
2018-08-17T08:39:24.000Z
data_sources/sqlite/03-imagestorage.sql
unification-com/haiku-node-prototype
ea77aa90f6b3f08d004be1c24e6b8d62e83bc66b
[ "MIT" ]
null
null
null
DROP DATABASE IF EXISTS `Imagestorage`; create database Imagestorage; --CREATE USER 'imgstore_user'@'%' IDENTIFIED BY 'password'; --GRANT ALL PRIVILEGES ON * . * TO 'imgstore_user'@'%'; use Imagestorage; --CREATE USER 'imagestorage_user'@'%' IDENTIFIED BY 'password'; --GRANT ALL PRIVILEGES ON * . * TO 'imagestorage_user'@'%'; CREATE TABLE ImageOwners ( OID int NOT NULL, FacebookID int, PRIMARY KEY (OID) ); CREATE TABLE ImageData ( ImageID int NOT NULL, Image varchar(255), TimeStamp TIMESTAMP DEFAULT (STRFTIME('%Y-%m-%d %H:%m:%S', 'NOW')), OwnerID int, PRIMARY KEY (ImageID), FOREIGN KEY (OwnerID) REFERENCES ImageOwners(OID) ); INSERT INTO ImageOwners (OID,FacebookID) VALUES (1, 34983984), (2, 37438784), (3, 93849344); INSERT INTO ImageData (ImageID,Image,OwnerID) VALUES (1, '/data/imageblobs/img1.jpg', 1), (2, '/data/imageblobs/img2.jpg', 1), (3, '/data/imageblobs/img3.jpg', 1), (4, '/data/imageblobs/img4.jpg', 1), (5, '/data/imageblobs/img5.jpg', 1), (6, '/data/imageblobs/img6.jpg', 1), (7, '/data/imageblobs/img7.jpg', 1), (8, '/data/imageblobs/img8.jpg', 1), (9, '/data/imageblobs/img9.jpg', 1), (10, '/data/imageblobs/img10.jpg', 1), (11, '/data/imageblobs/img11.jpg', 2), (12, '/data/imageblobs/img12.jpg', 2), (13, '/data/imageblobs/img13.jpg', 2), (14, '/data/imageblobs/img14.jpg', 2), (15, '/data/imageblobs/img15.jpg', 2), (16, '/data/imageblobs/img16.jpg', 2), (17, '/data/imageblobs/img17.jpg', 2), (18, '/data/imageblobs/img18.jpg', 2), (19, '/data/imageblobs/img19.jpg', 2), (20, '/data/imageblobs/img20.jpg', 2), (21, '/data/imageblobs/img21.jpg', 2), (22, '/data/imageblobs/img22.jpg', 3), (23, '/data/imageblobs/img23.jpg', 3), (24, '/data/imageblobs/img24.jpg', 3), (25, '/data/imageblobs/img25.jpg', 3), (26, '/data/imageblobs/img26.jpg', 3), (27, '/data/imageblobs/img27.jpg', 3), (28, '/data/imageblobs/img28.jpg', 3), (29, '/data/imageblobs/img29.jpg', 3), (30, '/data/imageblobs/img30.jpg', 3), (31, '/data/imageblobs/img31.jpg', 3), (32, '/data/imageblobs/img32.jpg', 3), (33, '/data/imageblobs/img33.jpg', 3);
32.536232
71
0.613808
ffb0aaa362594441e1c7683440b365d525b6912d
278
py
Python
fameTkinter.py
sairam1318/GUI
bd1892a2162993129008fccae0bfccfc11a90f2d
[ "Unlicense" ]
null
null
null
fameTkinter.py
sairam1318/GUI
bd1892a2162993129008fccae0bfccfc11a90f2d
[ "Unlicense" ]
null
null
null
fameTkinter.py
sairam1318/GUI
bd1892a2162993129008fccae0bfccfc11a90f2d
[ "Unlicense" ]
null
null
null
from tkinter import * root = Tk() root.geometry('500x900') f1 = Frame(root, bg = 'pink') f1.pack(side = LEFT) label = Label(f1, text = "hai All") label.pack() f2 = Frame(root, bg = 'grey') f1.pack(side = "top") label = Label(f2, text = "hai All") label.pack() root.mainloop()
18.533333
35
0.636691
999bb5614f433f1469046a3f3087e81cce1d79da
409
sql
SQL
scripts/schema/ccpv1/094-byway-type-4wd.sql
lbouma/Cyclopath
d09d927a1e6f9e07924007fd39e8e807cd9c0f8c
[ "Apache-2.0" ]
15
2015-05-06T05:11:48.000Z
2021-12-03T14:56:58.000Z
scripts/schema/ccpv1/094-byway-type-4wd.sql
landonb/Cyclopath
d09d927a1e6f9e07924007fd39e8e807cd9c0f8c
[ "Apache-2.0" ]
null
null
null
scripts/schema/ccpv1/094-byway-type-4wd.sql
landonb/Cyclopath
d09d927a1e6f9e07924007fd39e8e807cd9c0f8c
[ "Apache-2.0" ]
8
2015-05-06T05:11:36.000Z
2020-11-04T05:11:22.000Z
/* Copyright (c) 2006-2012 Regents of the University of Minnesota. For licensing terms, see the file LICENSE. */ /* Add "4WD Road" byway type to support importing Colorado data. This is not quite right, I think; see bug 1805. */ BEGIN TRANSACTION; SET CONSTRAINTS ALL DEFERRED; insert into byway_type (code, draw_class_code, text) values (12, 11, '4WD Road'); COMMIT;
29.214286
76
0.674817
30ecade0ed9b6212255279036ae2c74950a1cde1
271
sql
SQL
databases/6-relational-calculus/41.sql
nothingelsematters/university
5561969b1b11678228aaf7e6660e8b1a93d10294
[ "WTFPL" ]
1
2018-06-03T17:48:50.000Z
2018-06-03T17:48:50.000Z
databases/6-relational-calculus/41.sql
nothingelsematters/University
b1e188cb59e5a436731b92c914494626a99e1ae0
[ "WTFPL" ]
null
null
null
databases/6-relational-calculus/41.sql
nothingelsematters/University
b1e188cb59e5a436731b92c914494626a99e1ae0
[ "WTFPL" ]
14
2019-04-07T21:27:09.000Z
2021-12-05T13:37:25.000Z
select distinct Students.StudentId from Students, Marks, Plan, Lecturers where Students.StudentId = Marks.StudentId and Students.GroupId = Plan.GroupId and Marks.CourseId = Plan.CourseId and Plan.LecturerId = Lecturers.LecturerId and LecturerName = :LecturerName
33.875
44
0.800738
a3bceec9a96a77d79663051be4447529d98cef8e
24,202
java
Java
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java
SuanChen/hadoop
5b09ba75eccab4c2f1850bcc4cd8e60241cb500e
[ "Apache-2.0", "BSD-2-Clause", "MIT", "MIT-0", "ECL-2.0", "BSD-3-Clause" ]
1
2021-09-30T05:53:41.000Z
2021-09-30T05:53:41.000Z
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java
Gaoyubo1/hadoop
0d78d73973cf8643c4120678ebeea9cde473a2c4
[ "Apache-2.0", "BSD-2-Clause", "MIT", "ECL-2.0", "BSD-3-Clause" ]
null
null
null
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java
Gaoyubo1/hadoop
0d78d73973cf8643c4120678ebeea9cde473a2c4
[ "Apache-2.0", "BSD-2-Clause", "MIT", "ECL-2.0", "BSD-3-Clause" ]
null
null
null
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. */ package org.apache.hadoop.hdfs.server.datanode; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import org.apache.commons.collections.CollectionUtils; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.StorageType; import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsDatasetSpi; import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsVolumeSpi; import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsVolumeSpi.ScanInfo; import org.apache.hadoop.util.Daemon; import org.apache.hadoop.util.StopWatch; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting; import org.apache.hadoop.thirdparty.com.google.common.collect.ArrayListMultimap; import org.apache.hadoop.thirdparty.com.google.common.collect.ListMultimap; /** * Periodically scans the data directories for block and block metadata files. * Reconciles the differences with block information maintained in the dataset. */ @InterfaceAudience.Private public class DirectoryScanner implements Runnable { private static final Logger LOG = LoggerFactory.getLogger(DirectoryScanner.class); private static final int DEFAULT_MAP_SIZE = 32768; private static final int RECONCILE_BLOCKS_BATCH_SIZE = 1000; private final FsDatasetSpi<?> dataset; private final ExecutorService reportCompileThreadPool; private final ScheduledExecutorService masterThread; private final long scanPeriodMsecs; private final long throttleLimitMsPerSec; private final AtomicBoolean shouldRun = new AtomicBoolean(); private boolean retainDiffs = false; /** * Total combined wall clock time (in milliseconds) spent by the report * compiler threads executing. Used for testing purposes. */ @VisibleForTesting final AtomicLong timeRunningMs = new AtomicLong(0L); /** * Total combined wall clock time (in milliseconds) spent by the report * compiler threads blocked by the throttle. Used for testing purposes. */ @VisibleForTesting final AtomicLong timeWaitingMs = new AtomicLong(0L); /** * The complete list of block differences indexed by block pool ID. */ @VisibleForTesting final BlockPoolReport diffs = new BlockPoolReport(); /** * Statistics about the block differences in each blockpool, indexed by block * pool ID. */ @VisibleForTesting final Map<String, Stats> stats; /** * Allow retaining diffs for unit test and analysis. Defaults to false (off). * * @param b whether to retain diffs */ @VisibleForTesting public void setRetainDiffs(boolean b) { retainDiffs = b; } /** * Stats tracked for reporting and testing, per blockpool */ @VisibleForTesting static class Stats { final String bpid; long totalBlocks = 0; long missingMetaFile = 0; long missingBlockFile = 0; long missingMemoryBlocks = 0; long mismatchBlocks = 0; long duplicateBlocks = 0; /** * Create a new Stats object for the given blockpool ID. * * @param bpid blockpool ID */ public Stats(String bpid) { this.bpid = bpid; } @Override public String toString() { return "BlockPool " + bpid + " Total blocks: " + totalBlocks + ", missing metadata files: " + missingMetaFile + ", missing block files: " + missingBlockFile + ", missing blocks in memory: " + missingMemoryBlocks + ", mismatched blocks: " + mismatchBlocks; } } /** * Helper class for compiling block info reports from report compiler threads. * Contains a volume, a set of block pool IDs, and a collection of ScanInfo * objects. If a block pool exists but has no ScanInfo objects associated with * it, there will be no mapping for that particular block pool. */ @VisibleForTesting public static class ScanInfoVolumeReport { @SuppressWarnings("unused") private static final long serialVersionUID = 1L; private final FsVolumeSpi volume; private final BlockPoolReport blockPoolReport; /** * Create a new info list. * * @param volume */ ScanInfoVolumeReport(final FsVolumeSpi volume) { this.volume = volume; this.blockPoolReport = new BlockPoolReport(); } /** * Create a new info list initialized to the given expected size. * * @param volume * @param blockPools list of known block pools */ ScanInfoVolumeReport(final FsVolumeSpi volume, final Collection<String> blockPools) { this.volume = volume; this.blockPoolReport = new BlockPoolReport(blockPools); } public void addAll(final String bpid, final Collection<ScanInfo> scanInfos) { this.blockPoolReport.addAll(bpid, scanInfos); } public Set<String> getBlockPoolIds() { return this.blockPoolReport.getBlockPoolIds(); } public List<ScanInfo> getScanInfo(final String bpid) { return this.blockPoolReport.getScanInfo(bpid); } public FsVolumeSpi getVolume() { return volume; } @Override public String toString() { return "ScanInfoVolumeReport [volume=" + volume + ", blockPoolReport=" + blockPoolReport + "]"; } } /** * Helper class for compiling block info reports per block pool. */ @VisibleForTesting public static class BlockPoolReport { @SuppressWarnings("unused") private static final long serialVersionUID = 1L; private final Set<String> blockPools; private final ListMultimap<String, ScanInfo> map; /** * Create a block pool report. */ BlockPoolReport() { this.blockPools = new HashSet<>(2); this.map = ArrayListMultimap.create(2, DEFAULT_MAP_SIZE); } /** * Create a new block pool report initialized to the given expected size. * * @param blockPools initial list of known block pools */ BlockPoolReport(final Collection<String> blockPools) { this.blockPools = new HashSet<>(blockPools); this.map = ArrayListMultimap.create(blockPools.size(), DEFAULT_MAP_SIZE); } public void addAll(final String bpid, final Collection<ScanInfo> scanInfos) { this.blockPools.add(bpid); this.map.putAll(bpid, scanInfos); } public void sortBlocks() { for (final String bpid : this.map.keySet()) { final List<ScanInfo> list = this.map.get(bpid); // Sort array based on blockId Collections.sort(list); } } public Set<String> getBlockPoolIds() { return Collections.unmodifiableSet(this.blockPools); } public List<ScanInfo> getScanInfo(final String bpid) { return this.map.get(bpid); } public Collection<Map.Entry<String, ScanInfo>> getEntries() { return Collections.unmodifiableCollection(this.map.entries()); } public void clear() { this.map.clear(); this.blockPools.clear(); } @Override public String toString() { return "BlockPoolReport [blockPools=" + blockPools + ", map=" + map + "]"; } } /** * Create a new directory scanner, but don't cycle it running yet. * * @param dataset the dataset to scan * @param conf the Configuration object */ public DirectoryScanner(FsDatasetSpi<?> dataset, Configuration conf) { this.dataset = dataset; this.stats = new HashMap<>(DEFAULT_MAP_SIZE); int interval = (int) conf.getTimeDuration( DFSConfigKeys.DFS_DATANODE_DIRECTORYSCAN_INTERVAL_KEY, DFSConfigKeys.DFS_DATANODE_DIRECTORYSCAN_INTERVAL_DEFAULT, TimeUnit.SECONDS); scanPeriodMsecs = TimeUnit.SECONDS.toMillis(interval); int throttle = conf.getInt( DFSConfigKeys.DFS_DATANODE_DIRECTORYSCAN_THROTTLE_LIMIT_MS_PER_SEC_KEY, DFSConfigKeys.DFS_DATANODE_DIRECTORYSCAN_THROTTLE_LIMIT_MS_PER_SEC_DEFAULT); if (throttle >= TimeUnit.SECONDS.toMillis(1)) { LOG.warn( "{} set to value above 1000 ms/sec. Assuming default value of {}", DFSConfigKeys.DFS_DATANODE_DIRECTORYSCAN_THROTTLE_LIMIT_MS_PER_SEC_KEY, DFSConfigKeys.DFS_DATANODE_DIRECTORYSCAN_THROTTLE_LIMIT_MS_PER_SEC_DEFAULT); throttle = DFSConfigKeys.DFS_DATANODE_DIRECTORYSCAN_THROTTLE_LIMIT_MS_PER_SEC_DEFAULT; } throttleLimitMsPerSec = throttle; int threads = conf.getInt(DFSConfigKeys.DFS_DATANODE_DIRECTORYSCAN_THREADS_KEY, DFSConfigKeys.DFS_DATANODE_DIRECTORYSCAN_THREADS_DEFAULT); reportCompileThreadPool = Executors.newFixedThreadPool(threads, new Daemon.DaemonFactory()); masterThread = new ScheduledThreadPoolExecutor(1, new Daemon.DaemonFactory()); } /** * Start the scanner. The scanner will run every * {@link DFSConfigKeys#DFS_DATANODE_DIRECTORYSCAN_INTERVAL_KEY} seconds. */ @VisibleForTesting public void start() { shouldRun.set(true); long firstScanTime = ThreadLocalRandom.current().nextLong(scanPeriodMsecs); LOG.info( "Periodic Directory Tree Verification scan starting in {}ms with interval of {}ms and throttle limit of {}ms/s", firstScanTime, scanPeriodMsecs, throttleLimitMsPerSec); masterThread.scheduleAtFixedRate(this, firstScanTime, scanPeriodMsecs, TimeUnit.MILLISECONDS); } /** * Return whether the scanner has been started. * * @return whether the scanner has been started */ @VisibleForTesting boolean getRunStatus() { return shouldRun.get(); } /** * Clear the current cache of diffs and statistics. */ private void clear() { synchronized (diffs) { diffs.clear(); } stats.clear(); } /** * Main program loop for DirectoryScanner. Runs {@link reconcile()} and * handles any exceptions. */ @Override public void run() { if (!shouldRun.get()) { // shutdown has been activated LOG.warn( "This cycle terminating immediately because 'shouldRun' has been deactivated"); return; } try { reconcile(); } catch (Exception e) { // Log and continue - allows Executor to run again next cycle LOG.error( "Exception during DirectoryScanner execution - will continue next cycle", e); } catch (Error er) { // Non-recoverable error - re-throw after logging the problem LOG.error( "System Error during DirectoryScanner execution - permanently terminating periodic scanner", er); throw er; } } /** * Stops the directory scanner. This method will wait for 1 minute for the * main thread to exit and an additional 1 minute for the report compilation * threads to exit. If a thread does not exit in that time period, it is left * running, and an error is logged. */ void shutdown() { LOG.info("Shutdown has been called"); if (!shouldRun.getAndSet(false)) { LOG.warn("Shutdown has been called, but periodic scanner not started"); } if (masterThread != null) { masterThread.shutdown(); } if (reportCompileThreadPool != null) { reportCompileThreadPool.shutdownNow(); } if (masterThread != null) { try { masterThread.awaitTermination(1, TimeUnit.MINUTES); } catch (InterruptedException e) { LOG.error( "interrupted while waiting for masterThread to " + "terminate", e); } } if (reportCompileThreadPool != null) { try { reportCompileThreadPool.awaitTermination(1, TimeUnit.MINUTES); } catch (InterruptedException e) { LOG.error("interrupted while waiting for reportCompileThreadPool to " + "terminate", e); } } if (!retainDiffs) { clear(); } } /** * Reconcile differences between disk and in-memory blocks */ @VisibleForTesting public void reconcile() throws IOException { LOG.debug("reconcile start DirectoryScanning"); scan(); // HDFS-14476: run checkAndUpadte with batch to avoid holding the lock too // long int loopCount = 0; synchronized (diffs) { for (final Map.Entry<String, ScanInfo> entry : diffs.getEntries()) { dataset.checkAndUpdate(entry.getKey(), entry.getValue()); if (loopCount % RECONCILE_BLOCKS_BATCH_SIZE == 0) { try { Thread.sleep(2000); } catch (InterruptedException e) { // do nothing } } loopCount++; } } if (!retainDiffs) { clear(); } } /** * Scan for the differences between disk and in-memory blocks Scan only the * "finalized blocks" lists of both disk and memory. */ private void scan() { BlockPoolReport blockPoolReport = new BlockPoolReport(); clear(); Collection<ScanInfoVolumeReport> volumeReports = getVolumeReports(); for (ScanInfoVolumeReport volumeReport : volumeReports) { for (String blockPoolId : volumeReport.getBlockPoolIds()) { List<ScanInfo> scanInfos = volumeReport.getScanInfo(blockPoolId); blockPoolReport.addAll(blockPoolId, scanInfos); } } // Pre-sort the reports outside of the lock blockPoolReport.sortBlocks(); for (final String bpid : blockPoolReport.getBlockPoolIds()) { List<ScanInfo> blockpoolReport = blockPoolReport.getScanInfo(bpid); Stats statsRecord = new Stats(bpid); stats.put(bpid, statsRecord); Collection<ScanInfo> diffRecord = new ArrayList<>(); statsRecord.totalBlocks = blockpoolReport.size(); final List<ReplicaInfo> bl; bl = dataset.getSortedFinalizedBlocks(bpid); int d = 0; // index for blockpoolReport int m = 0; // index for memReprot while (m < bl.size() && d < blockpoolReport.size()) { ReplicaInfo memBlock = bl.get(m); ScanInfo info = blockpoolReport.get(d); if (info.getBlockId() < memBlock.getBlockId()) { if (!dataset.isDeletingBlock(bpid, info.getBlockId())) { // Block is missing in memory statsRecord.missingMemoryBlocks++; addDifference(diffRecord, statsRecord, info); } d++; continue; } if (info.getBlockId() > memBlock.getBlockId()) { // Block is missing on the disk addDifference(diffRecord, statsRecord, memBlock.getBlockId(), info.getVolume()); m++; continue; } // Block file and/or metadata file exists on the disk // Block exists in memory if (info.getBlockFile() == null) { // Block metadata file exits and block file is missing addDifference(diffRecord, statsRecord, info); } else if (info.getGenStamp() != memBlock.getGenerationStamp() || info.getBlockLength() != memBlock.getNumBytes()) { // Block metadata file is missing or has wrong generation stamp, // or block file length is different than expected statsRecord.mismatchBlocks++; addDifference(diffRecord, statsRecord, info); } else if (memBlock.compareWith(info) != 0) { // volumeMap record and on-disk files do not match. statsRecord.duplicateBlocks++; addDifference(diffRecord, statsRecord, info); } d++; if (d < blockpoolReport.size()) { // There may be multiple on-disk records for the same block, do not // increment the memory record pointer if so. ScanInfo nextInfo = blockpoolReport.get(d); if (nextInfo.getBlockId() != info.getBlockId()) { ++m; } } else { ++m; } } while (m < bl.size()) { ReplicaInfo current = bl.get(m++); addDifference(diffRecord, statsRecord, current.getBlockId(), current.getVolume()); } while (d < blockpoolReport.size()) { if (!dataset.isDeletingBlock(bpid, blockpoolReport.get(d).getBlockId())) { statsRecord.missingMemoryBlocks++; addDifference(diffRecord, statsRecord, blockpoolReport.get(d)); } d++; } synchronized (diffs) { diffs.addAll(bpid, diffRecord); } LOG.info("Scan Results: {}", statsRecord); } } /** * Add the ScanInfo object to the list of differences and adjust the stats * accordingly. This method is called when a block is found on the disk, but * the in-memory block is missing or does not match the block on the disk. * * @param diffRecord the collection to which to add the info * @param statsRecord the stats to update * @param info the differing info */ private void addDifference(Collection<ScanInfo> diffRecord, Stats statsRecord, ScanInfo info) { statsRecord.missingMetaFile += info.getMetaFile() == null ? 1 : 0; statsRecord.missingBlockFile += info.getBlockFile() == null ? 1 : 0; diffRecord.add(info); } /** * Add a new ScanInfo object to the collection of differences and adjust the * stats accordingly. This method is called when a block is not found on the * disk. * * @param diffRecord the collection to which to add the info * @param statsRecord the stats to update * @param blockId the id of the missing block * @param vol the volume that contains the missing block */ private void addDifference(Collection<ScanInfo> diffRecord, Stats statsRecord, long blockId, FsVolumeSpi vol) { statsRecord.missingBlockFile++; statsRecord.missingMetaFile++; diffRecord.add(new ScanInfo(blockId, null, null, null, vol)); } /** * Get the lists of blocks on the disks in the data set. */ @VisibleForTesting public Collection<ScanInfoVolumeReport> getVolumeReports() { List<ScanInfoVolumeReport> volReports = new ArrayList<>(); List<Future<ScanInfoVolumeReport>> compilersInProgress = new ArrayList<>(); // First get list of data directories try (FsDatasetSpi.FsVolumeReferences volumes = dataset.getFsVolumeReferences()) { for (final FsVolumeSpi volume : volumes) { // Disable scanning PROVIDED volumes to keep overhead low if (volume.getStorageType() != StorageType.PROVIDED) { ReportCompiler reportCompiler = new ReportCompiler(volume); Future<ScanInfoVolumeReport> result = reportCompileThreadPool.submit(reportCompiler); compilersInProgress.add(result); } } for (Future<ScanInfoVolumeReport> future : compilersInProgress) { try { final ScanInfoVolumeReport result = future.get(); if (!CollectionUtils.addIgnoreNull(volReports, result)) { // This compiler thread were interrupted, give up on this run volReports.clear(); break; } } catch (Exception ex) { LOG.warn("Error compiling report. Continuing.", ex); } } } catch (IOException e) { LOG.error("Unexpected IOException by closing FsVolumeReference", e); } return volReports; } /** * The ReportCompiler class encapsulates the process of searching a datanode's * disks for block information. It operates by performing a DFS of the volume * to discover block information. * * When the ReportCompiler discovers block information, it create a new * ScanInfo object for it and adds that object to its report list. The report * list is returned by the {@link #call()} method. */ public class ReportCompiler implements Callable<ScanInfoVolumeReport> { private final FsVolumeSpi volume; // Variable for tracking time spent running for throttling purposes private final StopWatch throttleTimer = new StopWatch(); // Variable for tracking time spent running and waiting for testing // purposes private final StopWatch perfTimer = new StopWatch(); /** * Create a report compiler for the given volume. * * @param volume the target volume */ public ReportCompiler(FsVolumeSpi volume) { this.volume = volume; } /** * Run this report compiler thread. * * @return the block info report list * @throws IOException if the block pool is not found */ @Override public ScanInfoVolumeReport call() throws IOException { String[] bpList = volume.getBlockPoolList(); ScanInfoVolumeReport result = new ScanInfoVolumeReport(volume, Arrays.asList(bpList)); perfTimer.start(); throttleTimer.start(); for (String bpid : bpList) { List<ScanInfo> report = new ArrayList<>(DEFAULT_MAP_SIZE); perfTimer.reset().start(); throttleTimer.reset().start(); try { // ScanInfos are added directly to 'report' list volume.compileReport(bpid, report, this); result.addAll(bpid, report); } catch (InterruptedException ex) { // Exit quickly and flag the scanner to do the same result = null; break; } } LOG.trace("Scanner volume report: {}", result); return result; } /** * Called by the thread before each potential disk scan so that a pause can * be optionally inserted to limit the number of scans per second. The limit * is controlled by * {@link DFSConfigKeys#DFS_DATANODE_DIRECTORYSCAN_THROTTLE_LIMIT_MS_PER_SEC_KEY}. */ public void throttle() throws InterruptedException { accumulateTimeRunning(); if (throttleLimitMsPerSec > 0L) { final long runningTime = throttleTimer.now(TimeUnit.MILLISECONDS); if (runningTime >= throttleLimitMsPerSec) { final long sleepTime; if (runningTime >= 1000L) { LOG.warn("Unable to throttle within the second. Blocking for 1s."); sleepTime = 1000L; } else { // Sleep for the expected time plus any time processing ran over final long overTime = runningTime - throttleLimitMsPerSec; sleepTime = (1000L - throttleLimitMsPerSec) + overTime; } Thread.sleep(sleepTime); throttleTimer.reset().start(); } accumulateTimeWaiting(); } } /** * Helper method to measure time running. */ private void accumulateTimeRunning() { timeRunningMs.getAndAdd(perfTimer.now(TimeUnit.MILLISECONDS)); perfTimer.reset().start(); } /** * Helper method to measure time waiting. */ private void accumulateTimeWaiting() { timeWaitingMs.getAndAdd(perfTimer.now(TimeUnit.MILLISECONDS)); perfTimer.reset().start(); } } }
33.017735
120
0.67044
0652c6998b3eb95f952d55bff43cd8228e4b396d
1,680
sql
SQL
laundry-jt/db_script/merchant_ddl.sql
yinxiaoer/jietu-laundry
742bede1a834068edd732ac9f9fa9b7b06b4d7ba
[ "MIT" ]
9
2021-11-18T06:06:26.000Z
2022-02-25T09:09:48.000Z
laundry-jt/db_script/merchant_ddl.sql
yinxiaoer/jietu-laundry
742bede1a834068edd732ac9f9fa9b7b06b4d7ba
[ "MIT" ]
1
2022-02-25T09:15:24.000Z
2022-02-25T09:15:24.000Z
laundry-jt/db_script/merchant_ddl.sql
yinxiaoer/jietu-laundry
742bede1a834068edd732ac9f9fa9b7b06b4d7ba
[ "MIT" ]
null
null
null
CREATE TABLE `mt_merchant` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '名称', `info` varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '简介', `province` char(6) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '省', `city` char(6) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '市', `area` char(6) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '区', `address` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '地址', `business_license_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '营业执照编号', `contact_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '联系人姓名', `contact_mobile` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '联系人手机号', `contact_mail` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '联系人邮箱', `user_id` bigint(20) NOT NULL COMMENT '用户id', `create_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '创建人', `create_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '更新人', `update_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (`id`), KEY `idx_user_id` (`user_id`), KEY `idx_name` (`name`), KEY `idx_contact_name` (`contact_name`), KEY `idx_contact_mobile` (`contact_mobile`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商户表';
73.043478
111
0.760119
e414f08259f44244f572fcb503475ad17517c607
764
cs
C#
src/EntryPoint/Common/CustomExtensions.cs
TheColonel2688/EntryPoint
3db363a901bcb0b6170630c1f8272d9b03c3b0e3
[ "MIT" ]
152
2016-12-26T22:28:28.000Z
2021-07-25T14:40:37.000Z
src/EntryPoint/Common/CustomExtensions.cs
TheColonel2688/EntryPoint
3db363a901bcb0b6170630c1f8272d9b03c3b0e3
[ "MIT" ]
53
2016-12-25T19:43:54.000Z
2019-07-22T20:47:17.000Z
src/EntryPoint/Common/CustomExtensions.cs
TheColonel2688/EntryPoint
3db363a901bcb0b6170630c1f8272d9b03c3b0e3
[ "MIT" ]
13
2017-03-12T10:27:37.000Z
2021-04-22T17:46:52.000Z
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace EntryPoint.Common { internal static class CustomExtensions { internal static List<T> Duplicates<T>(this IEnumerable<T> items, IEqualityComparer<T> comparer = null) { HashSet<T> hash = new HashSet<T>(comparer); List<T> result = new List<T>(); foreach (var item in items) { if (hash.Contains(item)) { result.Add(item); } else { hash.Add(item); } } return result; } internal static T IfTrue<T>(this bool b, T show) { return b ? show : default(T); } } }
25.466667
112
0.530105
31024244df142a69eee330048e165e1f49e426b8
184
sql
SQL
service/src/main/resources/db/migration/V202003201445__jira_csv.sql
CTY-git/sapling
2e9919e51158ce7682a70f4271d67b857b9cad84
[ "MIT" ]
36
2020-03-14T22:36:51.000Z
2021-11-09T11:05:03.000Z
service/src/main/resources/db/migration/V202003201445__jira_csv.sql
CTY-git/sapling
2e9919e51158ce7682a70f4271d67b857b9cad84
[ "MIT" ]
9
2020-06-27T11:54:01.000Z
2020-07-25T03:42:41.000Z
service/src/main/resources/db/migration/V202003201445__jira_csv.sql
CTY-git/sapling
2e9919e51158ce7682a70f4271d67b857b9cad84
[ "MIT" ]
5
2020-03-24T01:19:06.000Z
2021-05-05T17:48:45.000Z
CREATE TABLE jira_csv ( board_id BIGINT NOT NULL, csv TEXT NOT NULL, PRIMARY KEY (board_id), FOREIGN KEY (board_id) REFERENCES boards (id) ON DELETE CASCADE );
20.444444
67
0.668478
33e86e973e113dc737747b3a14e65be681968635
683
h
C
Utilities/include/Utilities/Logger.h
MotoLegacy/Stardust-Engine
1dafed3913b033935336883e663186d0fc07fba2
[ "MIT" ]
null
null
null
Utilities/include/Utilities/Logger.h
MotoLegacy/Stardust-Engine
1dafed3913b033935336883e663186d0fc07fba2
[ "MIT" ]
null
null
null
Utilities/include/Utilities/Logger.h
MotoLegacy/Stardust-Engine
1dafed3913b033935336883e663186d0fc07fba2
[ "MIT" ]
null
null
null
#pragma once #include <Platform/Platform.h> #include <string> #include <fstream> #include <sstream> namespace Stardust::Utilities { enum LoggerLevel { LOGGER_LEVEL_TRACE = -2, LOGGER_LEVEL_DEBUG = -1, LOGGER_LEVEL_INFO = 0, LOGGER_LEVEL_WARN = 1, LOGGER_LEVEL_ERROR = 2, }; class Logger { public: Logger(std::string name, std::string path = "stardust_log.log"); ~Logger(); void flushLog(); void log(std::string message, LoggerLevel level = LOGGER_LEVEL_INFO); int currentLevel; private: std::ofstream m_file; std::stringstream m_filebuf; std::string m_name; }; namespace detail { extern Logger* core_Logger; } extern Logger* app_Logger; }
18.459459
71
0.710102
e11e2235587e080e233547e7e4fa3f1795fcb161
1,156
go
Go
config.go
motopig/sendsms
ce71964b6cea9f436d3de3a4d402e955dab75903
[ "Apache-2.0" ]
1
2017-04-28T12:36:35.000Z
2017-04-28T12:36:35.000Z
config.go
motopig/sendsms
ce71964b6cea9f436d3de3a4d402e955dab75903
[ "Apache-2.0" ]
null
null
null
config.go
motopig/sendsms
ce71964b6cea9f436d3de3a4d402e955dab75903
[ "Apache-2.0" ]
null
null
null
package smservice import ( "io/ioutil" "gopkg.in/yaml.v2" ) type Config struct { ServiceList map[string]*ServiceConfig `yaml:"servicelist"` Errormsg map[string]string `yaml:"errormsg"` RedisConf map[string]string `yaml:"redisconf"` MysqlConf map[string]string `yaml:"mysqlconf"` BlueConf map[string]string `yaml:"blueconf"` DayuConf map[string]string `yaml:"dayuconf"` } type ServiceConfig struct { Agent string `yaml:"agent"` Tpl string `yaml:"smstpl"` Signame string `yaml:"signname"` Callback string `yaml:"callback"` Maxsendnums string `yaml:"maxsendnums"` Validtime string `yaml:"validtime"` } var ( config Config configFile = "./conf.yaml" ) func (cfg *Config) ParseConfigData(data []byte) error { if err := yaml.Unmarshal([]byte(data), &cfg); err != nil { return err } return nil } func (cfg *Config) ParseConfigFile(fileName string) error { data, err := ioutil.ReadFile(fileName) if err != nil { return err } return cfg.ParseConfigData(data) } func LoadConfig() { // 加载配置文件 config = Config{} config.ParseConfigFile(configFile) }
21.811321
59
0.66609
5dce530424b87c168b126ff86d52f7deab82eb32
375
hpp
C++
src/texture.hpp
Honeybunch/raycaster
7fc70e1cae2a4959fec6e99a94ccf57f36420c88
[ "MIT" ]
null
null
null
src/texture.hpp
Honeybunch/raycaster
7fc70e1cae2a4959fec6e99a94ccf57f36420c88
[ "MIT" ]
null
null
null
src/texture.hpp
Honeybunch/raycaster
7fc70e1cae2a4959fec6e99a94ccf57f36420c88
[ "MIT" ]
null
null
null
#pragma once #include "texture_types.hpp" namespace raycaster { texture load_texture(const char *filepath); const uint8_t *texture_get_image(texture t); uint32_t texture_get_width(texture t); uint32_t texture_get_height(texture t); uint32_t texture_get_channels(texture t); uint32_t texture_get_size(texture t); void destroy_texture(texture t); } // namespace raycaster
22.058824
44
0.810667
c97e82a6c15135ce6ad92dbc0f5b258bb31b6660
1,431
ts
TypeScript
saleor/static/dashboard-next/orders/views/OrderDetails/urls.ts
johnchendev/urbanradder
aab7d2a3e84c1a14a27b2039e120de1e7cdd28cc
[ "BSD-3-Clause" ]
null
null
null
saleor/static/dashboard-next/orders/views/OrderDetails/urls.ts
johnchendev/urbanradder
aab7d2a3e84c1a14a27b2039e120de1e7cdd28cc
[ "BSD-3-Clause" ]
null
null
null
saleor/static/dashboard-next/orders/views/OrderDetails/urls.ts
johnchendev/urbanradder
aab7d2a3e84c1a14a27b2039e120de1e7cdd28cc
[ "BSD-3-Clause" ]
null
null
null
import * as urlJoin from "url-join"; import { orderUrl } from "../../urls"; export const orderCancelUrl = (id: string) => urlJoin(orderUrl(id), "cancel"); export const orderMarkAsPaidUrl = (id: string) => urlJoin(orderUrl(id), "markAsPaid"); export const orderPaymentVoidUrl = (id: string) => urlJoin(orderUrl(id), "voidPayment"); export const orderPaymentRefundUrl = (id: string) => urlJoin(orderUrl(id), "refundPayment"); export const orderPaymentCaptureUrl = (id: string) => urlJoin(orderUrl(id), "capturePayment"); export const orderFulfillUrl = (id: string) => urlJoin(orderUrl(id), "fulfill"); export const orderFulfillmentCancelUrl = ( orderId: string, fulfillmentId: string ) => urlJoin(orderUrl(orderId), "fulfillment", fulfillmentId, "cancel"); export const orderFulfillmentEditTrackingUrl = ( orderId: string, fulfillmentId: string ) => urlJoin(orderUrl(orderId), "fulfillment", fulfillmentId, "tracking"); export const orderBillingAddressEditUrl = (id: string) => urlJoin(orderUrl(id), "editAddress", "billing"); export const orderShippingAddressEditUrl = (id: string) => urlJoin(orderUrl(id), "editAddress", "shipping"); export const orderDraftFinalizeUrl = (id: string) => urlJoin(orderUrl(id), "finalize"); export const orderDraftShippingMethodUrl = (id: string) => urlJoin(orderUrl(id), "shipping"); export const orderDraftLineAddUrl = (id: string) => urlJoin(orderUrl(id), "addLine");
42.088235
80
0.728861