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
8330b464e582767016af8d4734e10a6cae427420
2,007
ps1
PowerShell
Functions/New-OpsGenieConnction.ps1
skjaerhus/PS-OpsGenie
08070abcd25e66b8f7e85d322bcc0e4f2a8a3b81
[ "MIT" ]
null
null
null
Functions/New-OpsGenieConnction.ps1
skjaerhus/PS-OpsGenie
08070abcd25e66b8f7e85d322bcc0e4f2a8a3b81
[ "MIT" ]
null
null
null
Functions/New-OpsGenieConnction.ps1
skjaerhus/PS-OpsGenie
08070abcd25e66b8f7e85d322bcc0e4f2a8a3b81
[ "MIT" ]
null
null
null
<# .SYNOPSIS Connects to an OpsGenie HTTP Integration. .DESCRIPTION Connects to OpsGenie using the API Key from an HTTP integration. .INPUTS None. .OUTPUTS None, saves script variables with needed information for the module. .EXAMPLE PS> New-OpsGenieConnection -APIKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Connect without proxy and using default base url for OpsGenie EU Datacenter. .EXAMPLE PS> $mycred = get-credential PS> New-OpsGenieConnection -APIKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -ProxyCredential $mycred -ProxyUrl "http://myproxy:8080" Connect using proxy information. .LINK https://github.com/skjaerhus/PS-OpsGenie #> Function New-OpsGenieConnection { Param( [Parameter(Mandatory=$true)][string]$APIKey = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", [string]$BaseUrl = "https://api.eu.opsgenie.com", [pscredential]$ProxyCredential, [string]$ProxyUrl ) [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 if($ProxyUrl){ $Script:proxyurl = $ProxyUrl } elseif(!$proxyurl -and !$ProxyCredential){ #No Proxy defined and no credential, assuming no proxy, but check system info still. $dest = $BaseUrl $proxytest = ([System.Net.WebRequest]::GetSystemWebproxy()).GetProxy($dest) if ($proxytest.OriginalString -ne $BaseUrl){ #Proxy detected, set details and use it. $Script:ProxyUrl = $proxytest } } else{ $dest = $BaseUrl $Script:proxyurl = ([System.Net.WebRequest]::GetSystemWebproxy()).GetProxy($dest) $Script:proxyurl } $Script:headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" $Script:headers.Add("Authorization", 'GenieKey ' + $($APIKey)) $Script:BaseUrl = $BaseUrl if($ProxyCredential){ $Script:ProxyCredentials = $ProxyCredential Write-Host "Will Connect using credentials..." } Write-Host $Script:BaseUrl }
27.493151
128
0.684106
93952dc9134c8ff014e2210e684ec9f40b8c146f
1,924
cs
C#
backend/src/Squidex.Domain.Apps.Entities/Assets/AssetExtensions.cs
MartijnDijkgraaf/squidex
fefd23a63bb7b6b868b33555037a6edd3ce20251
[ "MIT" ]
null
null
null
backend/src/Squidex.Domain.Apps.Entities/Assets/AssetExtensions.cs
MartijnDijkgraaf/squidex
fefd23a63bb7b6b868b33555037a6edd3ce20251
[ "MIT" ]
null
null
null
backend/src/Squidex.Domain.Apps.Entities/Assets/AssetExtensions.cs
MartijnDijkgraaf/squidex
fefd23a63bb7b6b868b33555037a6edd3ce20251
[ "MIT" ]
null
null
null
// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschraenkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using System.Text; using Squidex.Infrastructure; using Squidex.Infrastructure.ObjectPool; namespace Squidex.Domain.Apps.Entities.Assets { public static class AssetExtensions { private const string HeaderNoEnrichment = "X-NoAssetEnrichment"; public static bool ShouldSkipAssetEnrichment(this Context context) { return context.Headers.ContainsKey(HeaderNoEnrichment); } public static ICloneBuilder WithoutAssetEnrichment(this ICloneBuilder builder, bool value = true) { return builder.WithBoolean(HeaderNoEnrichment, value); } public static async Task<string> GetTextAsync(this IAssetFileStore assetFileStore, DomainId appId, DomainId id, long fileVersion, string? encoding) { using (var stream = DefaultPools.MemoryStream.GetStream()) { await assetFileStore.DownloadAsync(appId, id, fileVersion, null, stream); stream.Position = 0; var bytes = stream.ToArray(); switch (encoding?.ToLowerInvariant()) { case "base64": return Convert.ToBase64String(bytes); case "ascii": return Encoding.ASCII.GetString(bytes); case "unicode": return Encoding.Unicode.GetString(bytes); default: return Encoding.UTF8.GetString(bytes); } } } } }
36.301887
155
0.523389
07267d9b2fb5d9be7a4f7784fc1e2f67b0ab8ff5
1,296
css
CSS
css/style.css
MURADALSHORMAN/CSSWireframe-
c41841e15f0e7d35e19f24431ea19790c7383914
[ "MIT" ]
null
null
null
css/style.css
MURADALSHORMAN/CSSWireframe-
c41841e15f0e7d35e19f24431ea19790c7383914
[ "MIT" ]
null
null
null
css/style.css
MURADALSHORMAN/CSSWireframe-
c41841e15f0e7d35e19f24431ea19790c7383914
[ "MIT" ]
null
null
null
body { font-family: Arial, Helvetica, sans-serif; padding: 25px; background-color: rgb(226, 225, 213); } header { padding: 20px; background-color: black; color: #ffffff; } header nav ul { float: left; position: absolute; left: 600px; } header nav ul li { background-color: black; font-size: 20px; display: inline-block; padding: 10px; margin-right: 50px; } header section img { float: left; position: absolute; left: 00px; } #img1 { padding: 15px; display: block; margin-left: auto; margin-right: auto; width: 50%; } #img21 { padding: 14px; margin-right: auto; margin-left: 24%; } #img22, #img23 { padding: 14px; margin-right: auto; margin-left: auto; } #last { padding: 15px; display: block; margin-left: auto; margin-right: auto; float: left; position: absolute; left: 467px; } #fix{ clear: both; } #text1 { font-size: 36px; padding: 15px; display: block; margin-left: auto; margin-right: auto; position: absolute; left: 900px; } #text2 { padding: 70px; display: block; margin-left: auto; margin-right: auto; position: absolute; left: 900px; } footer { background-color: gray; }
13.935484
46
0.590278
da76224e9acfc42e75fe059fc0ad0af12faf4764
16,516
php
PHP
Core/FileSystem/File.php
faelv/re3
d8bf5b16db2706d3aa521faacafb6375ec32cb6e
[ "0BSD" ]
2
2019-03-04T14:07:27.000Z
2022-02-12T09:13:03.000Z
Core/FileSystem/File.php
faelv/re3
d8bf5b16db2706d3aa521faacafb6375ec32cb6e
[ "0BSD" ]
null
null
null
Core/FileSystem/File.php
faelv/re3
d8bf5b16db2706d3aa521faacafb6375ec32cb6e
[ "0BSD" ]
null
null
null
<?php /** * File class * * @author faelv <[email protected]> * @license ISC License * @see https://github.com/faelv/re3 */ namespace Core\FileSystem; use Core\FileSystem\FileSystemObject; use Core\Exceptions\CoreException; /** * Class for operations with files in a OO way. * * @package Core */ class File extends FileSystemObject { /** * Opens a file for reading only. */ const MODE_READ = 0; /** * Opens a file for reading and writing. */ const MODE_READ_WRITE = 1; /** * Opens a file for writing only, erasing all it's contents first. */ const MODE_WRITE_ERASE = 2; /** * Opens a file for reading and writing, erasing all it's contents first. */ const MODE_READ_WRITE_ERASE = 3; /** * Opens a file for writing only, putting the cursor at it's end. */ const MODE_WRITE_APPEND = 4; /** * Opens a file for reading and writing, putting the cursor at it's end. */ const MODE_READ_WRITE_APPEND = 5; /** * Locks a file for writing, allowing reads. */ const LOCK_SHARED = LOCK_SH; /** * Locks a file for writing, not allowing reads. */ const LOCK_EXCLUSIVE = LOCK_EX; /** * Internal file object * @var SplFileObject */ protected $splFile = null; /** * Defines if the file is open or not. * @var boolean */ protected $openState = false; /** * Checks if a given file exists. * * @param string $filename Filename, complete including it's path. * * @return bool True if the file exists. */ public static function exists(string $filename) : bool { return file_exists($filename); } /** * Changes the file mode. * * @param string $filename Filename, complete including it's path. * @param int $mode Permission mode. * * @return bool True on success. */ public static function changeMode(string $filename, int $mode) : bool { return chmod($filename, $mode); } /** * Copies a file. If the destination file already exists, it will be overwritten. * * @param string $filename The source file. * @param string $destination The destination file. * * @return bool True if success. */ public static function copy(string $filename, string $destination) : bool { return copy($filename, $destination); } /** * Moves a file. If the destination file already exists, it will be overwritten. * * @param string $filename The source file. * @param string $destination The destination file. * * @return bool True if success. */ public static function move(string $filename, string $destination) : bool { return rename($filename, $destination); } /** * Deletes a file. * * @param string $filename The file. * * @return bool True if success. */ public static function delete(string $filename) : bool { return unlink($filename); } /** * Renames a file, optionally changing it's extension. If a file with the same name and extension already exists, it * will be overwritten. * * @param string $filename The file. * @param string $newname New name of the file, without extension. * @param string|boolean $extension The new extension as a string or False to not change it. * * @return boolean|string The complete file path as a string if success, False otherwise. */ public static function rename(string $filename, string $newname, bool $extension = false) { $info = pathinfo($filename); if (!isset($info['extension'])) { $info['extension'] = ''; } if ($extension !== false) { $info['extension'] = $extension; } if (!isset($info['dirname'])) { $info['dirname'] = ''; } $destination = empty($info['dirname']) ? '' : (DIRECTORY_SEPARATOR . $newname); if (!empty($info['extension'])) { $destination .= '.' . $info['extension']; } if (rename($filename, $destination)) { return $destination; } else { return false; } } /** * Resets (recreates) the internal SplFileInfo. * * @param string $filename File name * * @return void */ protected function resetInternalFileObject(string $filename) { $this->openState = false; $this->splFile = null; if (!empty($filename)) { $this->splFile = new \SplFileInfo($filename); } } /** * Convenience method. If the file is not open throws an exception. * * @param string $opName Name of the operation. * * @return void * @throws \Core\Exceptions\FileSystemException */ protected function checkFileClosedOperation(string $opName) { if (!$this->isOpen()) { throw CoreException::create('FileSystemException', "$opName cannot be performed on a closed file: {$this->splFile->getPathname()}"); } } /** * Convenience method. If the file is open throws an exception. * * @param string $opName Name of the operation. * * @return void * @throws \Core\Exceptions\FileSystemException */ protected function checkFileOpenOperation(string $opName) { if ($this->isOpen()) { throw CoreException::create('FileSystemException', "$opName cannot be performed on a open file: {$this->splFile->getPathname()}"); } } /** * Constructor. * * @param string $filename The file name. */ public function __construct(string $filename) { $this->resetInternalFileObject($filename); } /** * Opens the file with the specified access type. Some methods can only be performed while the file is open. * * @param int $mode One the MODE_* constants. * * @return bool True if success. */ public function open(int $mode) : bool { if ($this->openState) { return false; } switch ($mode) { case self::MODE_READ_WRITE: $mode = 'r+b'; break; case self::MODE_WRITE_ERASE: $mode = 'wb'; break; case self::MODE_READ_WRITE_ERASE: $mode = 'w+b'; break; case self::MODE_WRITE_APPEND: $mode = 'ab'; break; case self::MODE_READ_WRITE_APPEND: $mode = 'a+b'; break; default: //MODE_READ $mode = 'rb'; } try { $this->splFile = $this->splFile->openFile($mode); $this->openState = true; return true; } catch (\Exception $ex) { return false; } } /** * Close the file. Some methods can only be performed while the file is closed. * * @return bool True if success. */ public function close() : bool { $this->resetInternalFileObject($this->splFile->getPathname()); return true; } /** * Checks if the the file is open. * * @return bool True if the file is open. */ public function isOpen() : bool { return $this->openState; } /** * Checks if the file is readable. * * @return bool True if the file is readable. */ public function isReadable() : bool { return $this->splFile->isReadable(); } /** * Tells if this is a directory. * * @return boolean */ public function isDirectory() : bool { return false; } /** * Tells if this is a file. * * @return boolean */ public function isFile() : bool { return true; } /** * Checks if the file is writable. * * @return bool True if the file is writable. */ public function isWritable() : bool { return $this->splFile->isWritable(); } /** * Gets the size of the file in bytes. * * @return int|boolean The file size as an int or false on failure. */ public function size() { try { return $this->splFile->getSize(); } catch (\Exception $ex) { try { return array_get_if_set($this->splFile->fstat(), 'size', false); } catch (\Exception $ex) { return false; } } } /** * Gets the complete path to file, including it's name and extension. * * @return string The file path. */ public function path() : string { return $this->splFile->getPathname(); } /** * Gets the file directory, omitting any trailing slash. * * @return string The file directory. */ public function directory() : string { return $this->splFile->getPath(); } /** * Gets only the name of the file, optionally including it's extension. * * @param bool $extension True if you want the extension. * * @return string The file name. */ public function name(bool $extension = true) : string { if ($extension) { return $this->splFile->getFilename(); } else { return $this->splFile->getBasename('.' . $this->splFile->getExtension()); } } /** * Gets the extension of the file. * * @return string The file extension or an empty string if the file has no extension. */ public function extension() : string { return $this->splFile->getExtension(); } /** * Gets the file last modified date and time. * * @return \DateTime The date. */ public function modifiedDate() : \DateTime { $mtime = 0; try { $mtime = $this->splFile->getMTime(); } catch (\Exception $ex) { $mtime = array_get_if_set($this->splFile->fstat(), 'mtime', $mtime); } return \DateTime::createFromFormat('U', $mtime); } /** * Reads a line from the file and advances to the next line. * * @return string|boolean The line as a string or false on failure. * @throws \Core\Exceptions\FileSystemException */ public function readLine() { $this->checkFileClosedOperation(__FUNCTION__); try { return $this->splFile->fgets(); } catch (\Exception $ex) { return false; } } /** * Reads the given number of bytes from the file. * * @param int $length The number of bytes to read. * * @return string|boolean Returns the string read from the file or False on failure. * @throws \Core\Exceptions\FileSystemException */ public function read(int $length) { $this->checkFileClosedOperation(__FUNCTION__); if ($length > 0) { return $this->splFile->fread($length); } else { return ''; } } /** * Reads the file contents. * * @return string|boolean Returns the file contents or False on failure. */ public function readAll() { $this->checkFileClosedOperation(__FUNCTION__); $this->set(0); return $this->read($this->size()); } /** * Writes to the file. * * @param string $data The string to be written to the file. * * @return int|boolean Returns the number of bytes written, or False on failure. * @throws \Core\Exceptions\FileSystemException */ public function write(string $data) { $this->checkFileClosedOperation(__FUNCTION__); $bytesWritten = $this->splFile->fwrite($data); return ($bytesWritten === 0) ? false : $bytesWritten; } /** * Forces a write of all buffered output to the file. * * @return bool True on success. * @throws \Core\Exceptions\FileSystemException */ public function flush() : bool { $this->checkFileClosedOperation(__FUNCTION__); return $this->splFile->fflush(); } /** * Determine whether the end of file has been reached * * @return bool True if the file is at eof. * @throws \Core\Exceptions\FileSystemException */ public function eof() : bool { $this->checkFileClosedOperation(__FUNCTION__); return $this->splFile->eof(); } /** * Moves the file pointer ahead by a number of bytes. Seeking past EOF is valid. * * @param int $bytes Number of bytes. * * @return bool True on success. * @throws \Core\Exceptions\FileSystemException */ public function seek(int $bytes) : bool { $this->checkFileClosedOperation(__FUNCTION__); return ($this->splFile->fseek($bytes, SEEK_CUR) === 0); } /** * Sets the file pointer at a specified position. * * @param type $position Position in bytes. * * @return bool True on success. * @throws \Core\Exceptions\FileSystemException */ public function set(int $position) : bool { $this->checkFileClosedOperation(__FUNCTION__); return ($this->splFile->fseek($position, SEEK_SET) === 0); } /** * Gets the current file pointer position. * * @return int|boolean The pointer position as an int or False on failure. * @throws \Core\Exceptions\FileSystemException */ public function position() { $this->checkFileClosedOperation(__FUNCTION__); return $this->splFile->ftell(); } /** * Truncates the file to a given length. * * @param int $size Length (size) in bytes. If the size is larger than the file, it will be extended with null bytes. * If the size is smaller than the file, the excess data will be lost. * * @return bool True on success. * @throws \Core\Exceptions\FileSystemException */ public function truncate(int $size) : bool { $this->checkFileClosedOperation(__FUNCTION__); return $this->splFile->ftruncate($size); } /** * Erases all the contents of the file. * * @return bool True on success. * @throws \Core\Exceptions\FileSystemException */ public function erase() : bool { $this->checkFileClosedOperation(__FUNCTION__); return $this->splFile->ftruncate(0); } /** * Try to acquire a lock to the file. * * @param int $mode One the LOCK_* constants. * * @return bool True on success. * @throws \Core\Exceptions\FileSystemException */ public function lock(int $mode = self::LOCK_EXCLUSIVE) : bool { $this->checkFileClosedOperation(__FUNCTION__); return $this->splFile->flock($mode); } /** * Releases a file lock. * * @return bool True on success. * @throws \Core\Exceptions\FileSystemException */ public function unlock() : bool { $this->checkFileClosedOperation(__FUNCTION__); return $this->splFile->flock(LOCK_UN); } /** * Outputs all the file data, from the current pointer position, as a string. * * @return int The number of characters. * @throws \Core\Exceptions\FileSystemException */ public function output() : int { $this->checkFileClosedOperation(__FUNCTION__); return $this->splFile->fpassthru(); } /** * Copy the file to another location. * * @param string $destination Destination. * * @return boolean|\Core\Files\File A File object of the new file or false on failure. */ public function copyTo(string $destination) { if (self::copy($this->splFile->getPathname(), $destination)) { return new File($destination); } else { return false; } } /** * Move the file to another location. * * @param type $destination Destination. * * @return bool True on success. * @throws \Core\Exceptions\FileSystemException */ public function moveTo(string $destination) : bool { $this->checkFileOpenOperation(__FUNCTION__); $moved = self::move($this->splFile->getPathname(), $destination); if ($moved) { $this->resetInternalFileObject($destination); } return $moved; } /** * Rename the file, optionally changing it's extension. * * @param string $newname New name of the file, without extension. * @param string|boolean $extension The new extension as a string or False to not change it. * * @return bool True on success. * @throws \Core\Exceptions\FileSystemException */ public function renameMe(string $newname, bool $extension = false) : bool { $this->checkFileOpenOperation(__FUNCTION__); $renamed = self::rename($this->splFile->getPathname(), $newname, $extension); if ($renamed === false) { $this->resetInternalFileObject($renamed); return true; } return false; } /** * Changes the file mode. * * @param int $mode Permission mode. * * @return bool True on success. */ public function changeMyMode(int $mode) : bool { return self::changeMode($this->splFile->getPathname(), $mode); } /** * Delete the file. Pratically all methods will return errors after calling deleteMe. * * @return bool True on success. * @throws \Core\Exceptions\FileSystemException */ public function deleteMe() : bool { $this->checkFileOpenOperation(__FUNCTION__); $filename = $this->splFile->getPathname(); $this->resetInternalFileObject(''); $deleted = self::delete($filename); if (!$deleted) { $this->resetInternalFileObject($filename); } return $deleted; } }
25.80625
138
0.629692
80325d2c7aebf755131a0a658bea04cb698bf9c9
1,095
sh
Shell
run_tests.sh
Cacodaimon/CacoCloud
e662cfe85a2e2d596091266cf87c318f6be7a411
[ "MIT" ]
91
2015-01-02T21:23:49.000Z
2021-12-23T02:50:23.000Z
run_tests.sh
bobwol/CacoCloud
e662cfe85a2e2d596091266cf87c318f6be7a411
[ "MIT" ]
11
2015-01-01T15:07:18.000Z
2016-11-05T07:17:15.000Z
run_tests.sh
bobwol/CacoCloud
e662cfe85a2e2d596091266cf87c318f6be7a411
[ "MIT" ]
15
2015-02-04T20:06:34.000Z
2017-11-10T12:09:53.000Z
#!/bin/bash . ./tools.sh # # Easy run frisby.js tests script. # function install_node_modules () { echo_blue "Installing modules for running frisby.js" npm_module_install jasmine-node npm_module_install frisby npm_module_install sleep } function create_test_user () { echo_blue "Creating test user" php cli/run_cli.php --cli=Caco\\Slim\\Auth\\UserManagement -a create -u TEST_USER -p TEST_PASSWORD } function delete_test_user () { echo_blue "Delete test user" php cli/run_cli.php --cli=Caco\\Slim\\Auth\\UserManagement -a delete -u TEST_USER } function start_php_build_in_http_server () { echo_blue "Starting PHP build in webserver" php -S 127.0.0.1:8000 -t public & PHP_SERVER_PID="$!" } function stop_php_build_in_http_server () { echo_blue "Stopping PHP build in webserver" kill "$PHP_SERVER_PID" } function run_tests () { echo_blue "Running the tests now..." node_modules/jasmine-node/bin/jasmine-node --junitreport spec/api/ } install_node_modules create_test_user start_php_build_in_http_server run_tests stop_php_build_in_http_server delete_test_user
23.804348
100
0.768037
8a3a376cbaa85608f3b9bc3d3d5c541a576c1bdf
666
sql
SQL
panel/protected/data/daemon/update.mysql.3.sql
connor4312/multicraft
8cd4848435456a1fe176b5931293a64ecd103ba8
[ "Unlicense" ]
12
2015-01-05T05:01:11.000Z
2021-05-02T07:39:42.000Z
panel/protected/data/daemon/update.mysql.3.sql
connor4312/multicraft
8cd4848435456a1fe176b5931293a64ecd103ba8
[ "Unlicense" ]
5
2015-01-27T12:30:31.000Z
2015-04-06T17:37:54.000Z
panel/protected/data/daemon/update.mysql.3.sql
connor4312/multicraft
8cd4848435456a1fe176b5931293a64ecd103ba8
[ "Unlicense" ]
14
2015-01-02T22:25:20.000Z
2020-10-01T09:15:56.000Z
create table if not exists `ftp_user` ( `id` integer not null primary key auto_increment, `name` varchar(128) not null, `password` varchar(128) not null ) default charset=utf8; create table if not exists `ftp_user_server` ( `user_id` integer not null, `server_id` integer not null, `perms` varchar(16) not null default 'elr', primary key (`user_id`, `server_id`), foreign key(`user_id`) references `ftp_user`(`id`) on delete cascade on update cascade, foreign key(`server_id`) references `server`(`id`) on delete cascade on update cascade ) default charset=utf8;
47.571429
91
0.636637
c6c781c61ef5b75b863013433ca2a45faf367c4b
878
css
CSS
public/css/style.css
zhangxiaos/node-blog
524cea7ea9c73470f8007f2f22f9900b5e76a31b
[ "MIT" ]
null
null
null
public/css/style.css
zhangxiaos/node-blog
524cea7ea9c73470f8007f2f22f9900b5e76a31b
[ "MIT" ]
null
null
null
public/css/style.css
zhangxiaos/node-blog
524cea7ea9c73470f8007f2f22f9900b5e76a31b
[ "MIT" ]
null
null
null
/* ---------- 全局样式 ----------*/ body { margin: 0 auto; padding-top: 40px; width: 1100px; height: 100%; } a:hover { border-bottom: 3px solid #4fc08d; } .button { color: #fff !important; background-color: #4fc08d !important; } .avatar { float: right; width: 48px; height: 48px; border-radius: 3px; } /* ---------- nav-setting ----------*/ .nav-setting { position: fixed; right: 30px; top: 35px; z-index: 999; } .nav-setting .ui.dropdown.button { padding: 10px 10px 0 10px; background-color: #fff !important; } .nav-setting .icon.bars { color: #000; font-size: 18px; } /* ---------- post-content ---------- */ .post-content h3 a { color: #4fc08d !important; } .post-content .tag { font-size: 13px; margin-right: 5px; color: #999; } .post-content .tag.right { float: right; margin-right: 0; } .post-content .tag.right a { color: #999; }
14.16129
40
0.591116
215eb3b49944cf6c058d9383dcdaa6347907f34e
664
js
JavaScript
migrations/1_initial_migration.js
getsafle/safleID-Contracts
f0106655587bfb0c28c668bb13b2930442833dba
[ "MIT" ]
null
null
null
migrations/1_initial_migration.js
getsafle/safleID-Contracts
f0106655587bfb0c28c668bb13b2930442833dba
[ "MIT" ]
4
2021-03-17T09:30:28.000Z
2021-12-13T11:39:27.000Z
migrations/1_initial_migration.js
getsafle/safleID-contracts
f0106655587bfb0c28c668bb13b2930442833dba
[ "MIT" ]
2
2021-06-26T16:54:30.000Z
2021-07-31T15:04:29.000Z
const Migrations = artifacts.require("Migrations"); const MainContract = artifacts.require("RegistrarMain"); const RegistrarStorage = artifacts.require("RegistrarStorage"); const Auction = artifacts.require("Auction"); const Checking = artifacts.require("checkingContract"); module.exports = function(deployer) { deployer.deploy(Migrations); deployer.deploy(MainContract, '0x543BF648644E38528A35b593466cEA45D002bBC8') .then(function() { return deployer.deploy(RegistrarStorage, MainContract.address) .then(function() { return deployer.deploy(Auction, RegistrarStorage.address); });; }); deployer.deploy(Checking); };
36.888889
77
0.740964
05a30d0dbff653653fc618df07ed749747a331ce
1,610
py
Python
plugin/settings.py
andykingking/sublime-format
d1d9e2192729ffdecf9f09e54bdfc2c13890542f
[ "MIT" ]
null
null
null
plugin/settings.py
andykingking/sublime-format
d1d9e2192729ffdecf9f09e54bdfc2c13890542f
[ "MIT" ]
null
null
null
plugin/settings.py
andykingking/sublime-format
d1d9e2192729ffdecf9f09e54bdfc2c13890542f
[ "MIT" ]
null
null
null
import sublime PLUGIN_NAME = 'Format' PLUGIN_SETTINGS = '{}.sublime-settings'.format(PLUGIN_NAME) class Settings: @staticmethod def load(): return sublime.load_settings(PLUGIN_SETTINGS) @staticmethod def save(): sublime.save_settings(PLUGIN_SETTINGS) @staticmethod def on_change(callback): Settings.load().add_on_change(PLUGIN_NAME, callback) @staticmethod def stop_listening_for_changes(): Settings.load().clear_on_change(PLUGIN_NAME) @staticmethod def formatter(name): return Settings.load().get('{}_formatter'.format(name), default={}) @staticmethod def paths(): return Settings.load().get('paths', default=[]) @staticmethod def update_formatter(name, value): Settings.load().set('{}_formatter'.format(name), value) Settings.save() class FormatterSettings: def __init__(self, name): self.__name = name self.__settings = Settings.formatter(name) def get(self, value, default=None): return self.__settings.get(value, default) def set(self, key, value): self.__settings[key] = value Settings.update_formatter(self.__name, self.__settings) @property def format_on_save(self): return self.get('format_on_save', default=False) @format_on_save.setter def format_on_save(self, value): return self.set('format_on_save', value) @property def sources(self): return self.get('sources', default=[]) @property def options(self): return self.get('options', default=[])
24.769231
75
0.660248
93f5b5af82fac3028f59f2895ef1febd03c0cbc9
3,884
cs
C#
Black_Rabbit_Pro/Assets/BlackRabbitPro/Scripts/Editor/BuildTools/BuildTools.cs
Fungus-Light/Black-Rabbit-Pro
27e1e5e4d439033be9e494eba99460afa3bf254a
[ "Apache-2.0" ]
3
2021-03-22T13:45:29.000Z
2021-11-05T10:01:03.000Z
Black_Rabbit_Pro/Assets/BlackRabbitPro/Scripts/Editor/BuildTools/BuildTools.cs
Fungus-Light/Black-Rabbit-Pro
27e1e5e4d439033be9e494eba99460afa3bf254a
[ "Apache-2.0" ]
null
null
null
Black_Rabbit_Pro/Assets/BlackRabbitPro/Scripts/Editor/BuildTools/BuildTools.cs
Fungus-Light/Black-Rabbit-Pro
27e1e5e4d439033be9e494eba99460afa3bf254a
[ "Apache-2.0" ]
null
null
null
using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; using UnityEditor; using Puerts; public class BuildTools { [MenuItem("Build/Clear Persist")] public static void ClearPersist() { DirectoryInfo info = new DirectoryInfo(Application.persistentDataPath); info.Delete(true); } [MenuItem("Build/Init Packs")] public static void InitPacks() { JsEnv env = new JsEnv(); env.Eval("require(\"PacksManager\").InitPacks()"); env.Dispose(); } [MenuItem("Build/Auto Configure Packs")] public static void ConfigurePacks() { JsEnv env = new JsEnv(); env.Eval("require(\"PacksManager\").ConfigurePacks()"); env.Dispose(); } [MenuItem("Build/Build All Packs")] public static void BuildAllPacks() { ConfigurePacks(); List<AssetBundleBuild> builds = new List<AssetBundleBuild>(); DirectoryInfo packDir = new DirectoryInfo(Path.Combine(Application.dataPath, "Games")); foreach (DirectoryInfo game in packDir.GetDirectories()) { string configFile = Path.Combine("Assets", "Games", game.Name, "config.asset"); if (File.Exists(configFile)) { PackConfig config = AssetDatabase.LoadAssetAtPath<PackConfig>(configFile); if (config.entrance == null) { Debug.LogError(configFile + " must asign entrance!!!"); return; } else { AssetBundleBuild build = new AssetBundleBuild(); build.assetBundleName = game.Name.ToLower(); List<string> Assets = new List<string>(); foreach (FileInfo file in game.GetFiles()) { if (file.Extension == ".unity") { bool exclude = false; foreach (SceneAsset s in config.exclude) { if (file.Name.ToLower().IndexOf(s.name.ToLower()) != -1) { exclude = true; } } if (exclude == false) { Assets.Add(Path.Combine("Assets/Games", game.Name, file.Name).Replace("\\", "/")); } } } build.assetNames = Assets.ToArray(); builds.Add(build); } } else { Debug.LogError("Please Init Packs First!!!"); return; } } DirectoryInfo uiDir = new DirectoryInfo(Path.Combine(Application.dataPath, "UIs")); AssetBundleBuild uibuild = new AssetBundleBuild(); uibuild.assetBundleName = uiDir.Name.ToLower(); List<string> UIAssets = new List<string>(); foreach (FileInfo file in uiDir.GetFiles()) { if (file.Extension == ".prefab") { UIAssets.Add(Path.Combine("Assets", uiDir.Name, file.Name).Replace("\\", "/")); } } uibuild.assetNames = UIAssets.ToArray(); builds.Add(uibuild); string output = Path.Combine(Application.dataPath, "StreamingAssets", "GamePacks").Replace("\\", "/"); if (Directory.Exists(output) == false) { Directory.CreateDirectory(output); } BuildPipeline.BuildAssetBundles(output, builds.ToArray(), BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget); AssetDatabase.Refresh(); } }
32.099174
139
0.501545
54f27e43d274da065ab4af4cfbc81a8b3226e02c
171
css
CSS
css/LinkField.css
iqnection-programming/iqnection-silverstripe-modules-linkfield
7a57d6e27a3fc1f05fe7d12f8d017f9b10e7a6f4
[ "BSD-3-Clause" ]
null
null
null
css/LinkField.css
iqnection-programming/iqnection-silverstripe-modules-linkfield
7a57d6e27a3fc1f05fe7d12f8d017f9b10e7a6f4
[ "BSD-3-Clause" ]
null
null
null
css/LinkField.css
iqnection-programming/iqnection-silverstripe-modules-linkfield
7a57d6e27a3fc1f05fe7d12f8d017f9b10e7a6f4
[ "BSD-3-Clause" ]
null
null
null
.field.link { padding:10px 0; border-bottom:1px solid #e5e8eb; } .field.link > .field { padding-bottom:0; } .field.link > .field:after { display:none; }
34.2
72
0.614035
581391788cba7481368414823bd865e06d86d988
88
go
Go
handlers/doc.go
crissto/golang-start
3d194185c38c2261cca6eba3dd9ead9fec15431d
[ "MIT" ]
15
2021-04-26T16:16:36.000Z
2022-03-25T14:00:31.000Z
handlers/doc.go
crissto/golang-start
3d194185c38c2261cca6eba3dd9ead9fec15431d
[ "MIT" ]
null
null
null
handlers/doc.go
crissto/golang-start
3d194185c38c2261cca6eba3dd9ead9fec15431d
[ "MIT" ]
4
2021-05-12T15:45:28.000Z
2022-01-19T17:37:56.000Z
// Package handlers contains HTTP handlers used by the server package. package handlers
29.333333
70
0.818182
409db38d70cf2f6f67287e97775cc8a75d2ea49a
1,412
ts
TypeScript
packages/mvc/src/services/RouteChecker.ts
zhouhoujun/type-mvc
202fb9b1968f13500a9a7c5503d99b3df828e55e
[ "MIT" ]
6
2017-12-13T00:57:11.000Z
2019-12-27T01:24:39.000Z
packages/mvc/src/services/RouteChecker.ts
zhouhoujun/type-mvc
202fb9b1968f13500a9a7c5503d99b3df828e55e
[ "MIT" ]
null
null
null
packages/mvc/src/services/RouteChecker.ts
zhouhoujun/type-mvc
202fb9b1968f13500a9a7c5503d99b3df828e55e
[ "MIT" ]
2
2018-10-21T02:14:28.000Z
2019-08-20T11:44:14.000Z
import { IocCoreService, Singleton } from '@tsdi/ioc'; import { IContext } from '../IContext'; const urlReg = /\/((\w|%|\.))+\.\w+$/; const noParms = /\/\s*$/; const hasParms = /\?\S*$/; const subStart = /^\s*\/|\?/; @Singleton() export class RouteChecker extends IocCoreService { private assertUrlRegExp = urlReg; isRoute(ctxUrl: string): boolean { return !this.assertUrlRegExp.test(ctxUrl); } getReqRoute(ctx: IContext): string { let reqUrl = this.vaildify(ctx.url, true); let config = ctx.mvcContext.getConfiguration(); if (config.routePrefix) { return reqUrl.replace(config.routePrefix, ''); } return reqUrl; } vaildify(routePath: string, foreNull = false): string { if (foreNull && routePath === '/') { routePath = ''; } if (noParms.test(routePath)) { routePath = routePath.substring(0, routePath.lastIndexOf('/')); } if (hasParms.test(routePath)) { routePath = routePath.substring(0, routePath.lastIndexOf('?')); } return routePath; } isActiveRoute(ctx: IContext, route: string) { let routeUrl = this.getReqRoute(ctx); if (route === '' || route === routeUrl) { return true; } return routeUrl.startsWith(route) && subStart.test(routeUrl.substring(route.length)); } }
28.816327
93
0.577195
b758578b94442795754abc3bccdd5a85647c9325
677
cpp
C++
sources codes/tute30b.cpp
darkrabel/c-personal-reference-code-
0ea62666a6f8b7ea876e96498e3c0b6b4e773a7f
[ "MIT" ]
2
2021-06-17T11:05:01.000Z
2021-11-15T11:39:46.000Z
sources codes/tute30b.cpp
darkrabel/c-personal-reference-code-
0ea62666a6f8b7ea876e96498e3c0b6b4e773a7f
[ "MIT" ]
null
null
null
sources codes/tute30b.cpp
darkrabel/c-personal-reference-code-
0ea62666a6f8b7ea876e96498e3c0b6b4e773a7f
[ "MIT" ]
null
null
null
#include<iostream> using namespace std; class Point{ int x, y; public: Point(int a, int b){ x = a; y = b; } void displayPoint(){ cout<<"The point is ("<<x<<", "<<y<<")"<<endl; } }; // Create a function (Hint: Make it a friend function) which takes 2 point objects and computes the distance between those 2 points // Use these examples to check your code: // Distance between (1, 1) and (1, 1) is 0 // Distance between (0, 1) and (0, 6) is 5 // Distance between (1, 0) and (70, 0) is 69 int main(){ Point p(1, 1); p.displayPoint(); Point q(4, 6); q.displayPoint(); return 0; }
21.83871
131
0.552437
4bcbceef617aca642d9de99d9532ffb483d8f642
758
dart
Dart
mod-account/client/lib/modules/home_screen.dart
joe-getcouragenow/core-runtime
244e87ed7337ff005f2e6f8e0e63c64d70d5ed81
[ "Apache-2.0" ]
null
null
null
mod-account/client/lib/modules/home_screen.dart
joe-getcouragenow/core-runtime
244e87ed7337ff005f2e6f8e0e63c64d70d5ed81
[ "Apache-2.0" ]
null
null
null
mod-account/client/lib/modules/home_screen.dart
joe-getcouragenow/core-runtime
244e87ed7337ff005f2e6f8e0e63c64d70d5ed81
[ "Apache-2.0" ]
null
null
null
import 'package:flutter/material.dart'; import 'package:flutter_modular/flutter_modular.dart'; class HomeScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ RaisedButton( child: Text("Sign Up"), onPressed: () => Navigator.of(context).pushNamed("/signup"), ), SizedBox( height: 16, ), RaisedButton( child: Text("Settings"), onPressed: () => Navigator.of(context).pushNamed("/settings"), ) ], ), ), ); } }
26.137931
76
0.529024
ff85f8e9bd36662cd169f6b5277701cadb3098b6
1,264
py
Python
examples/beammap.py
abeelen/kidsdata
76c798b102a407e29d162aafceb01c518d848536
[ "BSD-3-Clause" ]
null
null
null
examples/beammap.py
abeelen/kidsdata
76c798b102a407e29d162aafceb01c518d848536
[ "BSD-3-Clause" ]
null
null
null
examples/beammap.py
abeelen/kidsdata
76c798b102a407e29d162aafceb01c518d848536
[ "BSD-3-Clause" ]
null
null
null
import numpy as np import matplotlib.pyplot as plt from astropy.wcs import WCS from kidsdata import KissData from kidsdata.db import list_scan, get_scan plt.ion() # Open the scan 431 kd = KissData(get_scan(431)) # Read All the valid data from array B list_data = kd.names.DataSc + kd.names.DataUc + ["I", "Q"] kd.read_data(list_data=list_data, list_detector=kd.get_list_detector("B", flag=0, typedet=1), silent=True) # Compute and plot the beam map beammap, (datas, wcs, popts) = kd.plot_beammap( coord="pdiff", flatfield=None, cm_func="kidsdata.common_mode.pca_filtering", ncomp=2 ) # Update the kidpar for key in ["x0", "y0"]: popts[key] -= np.nanmedian(popts[key]) kd._extended_kidpar = popts # Plot geometry geometry, fwhm = kd.plot_kidpar() # select good detector, ie within 60 arcmin of the center and fwhm 25 +- 10 kidpar = kd.kidpar.loc[kd.list_detector] pos = np.array([kidpar["x0"], kidpar["y0"]]) * 60 # arcmin fwhm = np.array(np.abs(kidpar["fwhm_x"]) + np.abs(kidpar["fwhm_y"])) / 2 * 60 ikid = np.where((np.sqrt(pos[0] ** 2 + pos[1] ** 2) < 60) & (np.abs(fwhm - 25) < 10))[0] data, weight, hits = kd.continuum_map(coord="pdiff", ikid=ikid, cdelt=0.05) plt.subplot(projection=WCS(data.header)) plt.imshow(data.data, origin="lower")
30.829268
106
0.703323
c07a58c275b0c944268146536adedf6f2971c965
1,072
rs
Rust
take-while-in-action-baby/src/main.rs
elsuizo/Rust_work
18ba8a616528a3d42d64e7ce00be9bdc4748a6db
[ "MIT" ]
null
null
null
take-while-in-action-baby/src/main.rs
elsuizo/Rust_work
18ba8a616528a3d42d64e7ce00be9bdc4748a6db
[ "MIT" ]
null
null
null
take-while-in-action-baby/src/main.rs
elsuizo/Rust_work
18ba8a616528a3d42d64e7ce00be9bdc4748a6db
[ "MIT" ]
null
null
null
// NOTE(elsuizo:2020-05-12): // El iterador `take_while` // aplica el predicado a cada item y retorna `None` en lugar donde los items producen un `false` al // predicado del clousure y para cada subsecuente llama a el proximo. Por ejemplo, dado un mail con // una linea blanca separando el header del body del mensaje, podemos utilizar `take_while` para // iterar solo en los headers: fn main() { let message = "To: jimb\r\n\ From: superego<[email protected]>\r\n\ \r\n\ Did you get any writing done today???\r\n\ When will you stop wasting time plotting fractals???\r\n"; // iteramos solo sobre los headers!!! for header in message.lines().take_while(|line| !line.is_empty()) { println!("header: {:}", header); } println!("------------------bodys---------------"); // NOTE(elsuizo:2020-05-12): le ponemos un skip(1) para que saltee la linea en blanco for body in message.lines().skip_while(|line| !line.is_empty()).skip(1) { println!("body: {:}", body); } }
44.666667
99
0.612873
1a695381e35065e3c64911837384be7a40ac5d53
502
py
Python
Microsoft-weightedRandom.py
pflun/learningAlgorithms
3101e989488dfc8a56f1bf256a1c03a837fe7d97
[ "MIT" ]
null
null
null
Microsoft-weightedRandom.py
pflun/learningAlgorithms
3101e989488dfc8a56f1bf256a1c03a837fe7d97
[ "MIT" ]
null
null
null
Microsoft-weightedRandom.py
pflun/learningAlgorithms
3101e989488dfc8a56f1bf256a1c03a837fe7d97
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # import random class Solution(object): def weightedRandom(self, objects, probabilities): if len(objects) != len(probabilities): return revisedP = [] for i in range(len(probabilities)): for _ in range(probabilities[i]): revisedP.append(objects[i]) index = random.randint(0, len(revisedP) - 1) return revisedP[index] test = Solution() print test.weightedRandom(['a','b','c','d'], [1,2,3,4])
25.1
55
0.579681
a079d37f4da8d2e6316a61fe4191e3933d9a987f
624
rs
Rust
mailin-embedded/src/ssl.rs
trevyn/mailin
368bfe2b97b94ca19b9234d05ba0030cfacc6b3f
[ "Apache-2.0", "MIT" ]
null
null
null
mailin-embedded/src/ssl.rs
trevyn/mailin
368bfe2b97b94ca19b9234d05ba0030cfacc6b3f
[ "Apache-2.0", "MIT" ]
null
null
null
mailin-embedded/src/ssl.rs
trevyn/mailin
368bfe2b97b94ca19b9234d05ba0030cfacc6b3f
[ "Apache-2.0", "MIT" ]
null
null
null
use std::io::{Read, Write}; /// `SslConfig` is used to configure the STARTTLS configuration of the server pub enum SslConfig { /// Do not support STARTTLS None, /// Use a self-signed certificate for STARTTLS SelfSigned { /// Certificate path cert_path: String, /// Path to key file key_path: String, }, /// Use a certificate from an authority Trusted { /// Certificate path cert_path: String, /// Key file path key_path: String, /// Path to CA bundle chain_path: String, }, } pub trait Stream: Read + Write {}
24
77
0.586538
14307ed28ad08a97a6031c4ba3fd7c490d7eeb67
545
tsx
TypeScript
src/components/button-arrow/button-arrow.tsx
Matte478/bachelor-thesis-components
eae4c5a03c700e61b41c18e44bda3b3d5c5f8b7e
[ "MIT" ]
null
null
null
src/components/button-arrow/button-arrow.tsx
Matte478/bachelor-thesis-components
eae4c5a03c700e61b41c18e44bda3b3d5c5f8b7e
[ "MIT" ]
null
null
null
src/components/button-arrow/button-arrow.tsx
Matte478/bachelor-thesis-components
eae4c5a03c700e61b41c18e44bda3b3d5c5f8b7e
[ "MIT" ]
null
null
null
import { Component, h, Prop } from '@stencil/core' @Component({ tag: 'obd-button-arrow', styleUrl: 'button-arrow.scss', shadow: true }) export class ButtonArrow { @Prop({ mutable: true, reflect: true }) right: boolean = false render() { return ( <button class={'arrow ' + (this.right ? 'right' : '')} onClick={() => this.right = !this.right} > <i class="fas fa-angle-double-left" /> </button> ) } }
21.8
62
0.473394
da43aa05ded53073a678a9dda480615e4281e119
364
php
PHP
app/Models/Api/Comment.php
7codeRO/hackathon-challange-accepted
542f2a066d6e01e75487fea74e726c9eb4c0dd22
[ "MIT" ]
null
null
null
app/Models/Api/Comment.php
7codeRO/hackathon-challange-accepted
542f2a066d6e01e75487fea74e726c9eb4c0dd22
[ "MIT" ]
1
2021-05-10T21:07:28.000Z
2021-05-10T21:07:28.000Z
app/Models/Api/Comment.php
7codeRO/hackathon-challange-accepted
542f2a066d6e01e75487fea74e726c9eb4c0dd22
[ "MIT" ]
null
null
null
<?php namespace App\Models\Api; use App\Models\Auth\User; use Illuminate\Database\Eloquent\Model; class Comment extends Model { protected $table = "comments"; protected $fillable = ['user_id', 'question_id', 'content', 'likes', 'dislikes', 'isAnswer']; public function user(){ return $this->belongsTo(User::class, 'user_id', 'id'); } }
21.411765
97
0.664835
f6d09ae9c81365f7bcfebefbe398f899ef6bae6d
872
sql
SQL
data/test/sql/f6d09ae9c81365f7bcfebefbe398f899ef6bae6dl_google_visits.sql
aliostad/deep-learning-lang-detection
d6b031f3ebc690cf2ffd0ae1b08ffa8fb3b38a62
[ "MIT" ]
84
2017-10-25T15:49:21.000Z
2021-11-28T21:25:54.000Z
data/test/sql/f6d09ae9c81365f7bcfebefbe398f899ef6bae6dl_google_visits.sql
vassalos/deep-learning-lang-detection
cbb00b3e81bed3a64553f9c6aa6138b2511e544e
[ "MIT" ]
5
2018-03-29T11:50:46.000Z
2021-04-26T13:33:18.000Z
data/test/sql/f6d09ae9c81365f7bcfebefbe398f899ef6bae6dl_google_visits.sql
vassalos/deep-learning-lang-detection
cbb00b3e81bed3a64553f9c6aa6138b2511e544e
[ "MIT" ]
24
2017-11-22T08:31:00.000Z
2022-03-27T01:22:31.000Z
SET DEFINE OFF; CREATE TABLE L_GOOGLE_VISITS ( FISCALYEAR CHAR(20 BYTE), MONTHS CHAR(10 BYTE), WEBVISITS CHAR(20 BYTE), UNIQUE_VISITORS CHAR(20 BYTE), PAGEVIWES CHAR(20 BYTE), PAGES_VISIT CHAR(20 BYTE), AVGVISIT_DURATION CHAR(20 BYTE), BOUNCERATE CHAR(20 BYTE), NEWVISITS CHAR(20 BYTE), BRANDID CHAR(20 BYTE) ) TABLESPACE DTW_ADV_TABLES RESULT_CACHE (MODE DEFAULT) PCTUSED 0 PCTFREE 10 INITRANS 1 MAXTRANS 255 STORAGE ( INITIAL 80K NEXT 1M MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT ) LOGGING NOCOMPRESS NOCACHE NOPARALLEL MONITORING;
24.222222
38
0.565367
238a56661ebcd8e0bc279f0d101ae7e9e7e15548
2,873
js
JavaScript
src/metrize/emailLuminosity.js
danielkov/react-icons-kit
160bc967ed1ba9cad75a86fb40a449e1f79d1fe0
[ "MIT" ]
372
2017-01-07T01:54:27.000Z
2022-03-02T10:16:01.000Z
src/metrize/emailLuminosity.js
danielkov/react-icons-kit
160bc967ed1ba9cad75a86fb40a449e1f79d1fe0
[ "MIT" ]
72
2016-12-17T04:04:02.000Z
2022-02-26T03:35:19.000Z
src/metrize/emailLuminosity.js
qza7849467chensh5/react-icons-kit
09aeaf39d13e33c45bd032cc1b42a64c5a334dd9
[ "MIT" ]
66
2017-05-14T21:52:41.000Z
2021-12-08T12:15:09.000Z
export const emailLuminosity = {"viewBox":"0 0 512 512","children":[{"name":"path","attribs":{"d":"M256,0C114.609,0,0,114.609,0,256s114.609,256,256,256s256-114.609,256-256S397.391,0,256,0z M256,472\r\n\tc-119.297,0-216-96.703-216-216S136.703,40,256,40s216,96.703,216,216S375.297,472,256,472z"},"children":[]},{"name":"g","attribs":{},"children":[{"name":"rect","attribs":{"x":"248","y":"144","width":"16","height":"32"},"children":[{"name":"rect","attribs":{"x":"248","y":"144","width":"16","height":"32"},"children":[]}]},{"name":"rect","attribs":{"x":"248","y":"336","width":"16","height":"32"},"children":[{"name":"rect","attribs":{"x":"248","y":"336","width":"16","height":"32"},"children":[]}]},{"name":"rect","attribs":{"x":"315.876","y":"172.127","transform":"matrix(0.7071 0.7071 -0.7071 0.7071 227.8853 -173.9137)","width":"15.998","height":"31.997"},"children":[{"name":"rect","attribs":{"x":"315.876","y":"172.127","transform":"matrix(0.7071 0.7071 -0.7071 0.7071 227.8853 -173.9137)","width":"15.998","height":"31.997"},"children":[]}]},{"name":"rect","attribs":{"x":"180.126","y":"307.877","transform":"matrix(-0.7071 -0.7071 0.7071 -0.7071 92.1353 685.9137)","width":"15.998","height":"31.997"},"children":[{"name":"rect","attribs":{"x":"180.126","y":"307.877","transform":"matrix(-0.7071 -0.7071 0.7071 -0.7071 92.1353 685.9137)","width":"15.998","height":"31.997"},"children":[]}]},{"name":"rect","attribs":{"x":"172.127","y":"180.126","transform":"matrix(0.7071 0.7071 -0.7071 0.7071 188.125 -77.9239)","width":"31.997","height":"15.998"},"children":[{"name":"rect","attribs":{"x":"172.127","y":"180.126","transform":"matrix(0.7071 0.7071 -0.7071 0.7071 188.125 -77.9239)","width":"31.997","height":"15.998"},"children":[]}]},{"name":"rect","attribs":{"x":"307.877","y":"315.876","transform":"matrix(-0.7071 -0.7071 0.7071 -0.7071 323.875 781.9034)","width":"31.997","height":"15.998"},"children":[{"name":"rect","attribs":{"x":"307.877","y":"315.876","transform":"matrix(-0.7071 -0.7071 0.7071 -0.7071 323.875 781.9034)","width":"31.997","height":"15.998"},"children":[]}]},{"name":"rect","attribs":{"x":"144","y":"248","width":"32","height":"16"},"children":[{"name":"rect","attribs":{"x":"144","y":"248","width":"32","height":"16"},"children":[]}]},{"name":"rect","attribs":{"x":"336","y":"248","width":"32","height":"16"},"children":[{"name":"rect","attribs":{"x":"336","y":"248","width":"32","height":"16"},"children":[]}]},{"name":"path","attribs":{"d":"M256,192c-35.297,0-64,28.719-64,64s28.703,64,64,64c35.281,0,64-28.719,64-64S291.281,192,256,192z M256,304v-96\r\n\t\tc26.469,0,48,21.531,48,48S282.469,304,256,304z"},"children":[{"name":"path","attribs":{"d":"M256,192c-35.297,0-64,28.719-64,64s28.703,64,64,64c35.281,0,64-28.719,64-64S291.281,192,256,192z M256,304v-96\r\n\t\tc26.469,0,48,21.531,48,48S282.469,304,256,304z"},"children":[]}]}]}]};
2,873
2,873
0.607727
50aac9cf9152348178a58bef29613e9cf9aa4538
287
sql
SQL
src/test/resources/sql/beans-create.sql
mfursov/mini-jdbc
512746c2faf866863859d95a55f631d361b396c7
[ "Apache-2.0" ]
16
2017-03-11T00:53:25.000Z
2021-03-19T04:47:16.000Z
src/test/resources/sql/beans-create.sql
mfursov/mini-jdbc
512746c2faf866863859d95a55f631d361b396c7
[ "Apache-2.0" ]
5
2015-11-01T15:45:16.000Z
2020-09-24T19:35:31.000Z
src/test/resources/sql/beans-create.sql
mfursov/mini-jdbc
512746c2faf866863859d95a55f631d361b396c7
[ "Apache-2.0" ]
4
2016-01-14T11:56:56.000Z
2021-04-26T18:53:35.000Z
CREATE TABLE bean ( id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( START WITH 1, INCREMENT BY 1), boolean_field BOOLEAN NOT NULL, int_field INTEGER NOT NULL, string_field VARCHAR(100) DEFAULT NULL, int_value_field INTEGER DEFAULT NULL );
28.7
96
0.675958
54bc32b08b943db8e921f1eca44a7c3662372170
9,032
rb
Ruby
spec/schema_tools/hash_spec.rb
salesking/json_schema_tools
acaaecd2f104f2dc4cc6dfeb52770e60ab291553
[ "MIT" ]
24
2015-01-06T07:08:38.000Z
2021-11-08T12:01:26.000Z
spec/schema_tools/hash_spec.rb
salesking/json_schema_tools
acaaecd2f104f2dc4cc6dfeb52770e60ab291553
[ "MIT" ]
16
2015-03-19T16:47:54.000Z
2017-06-01T08:58:53.000Z
spec/schema_tools/hash_spec.rb
salesking/json_schema_tools
acaaecd2f104f2dc4cc6dfeb52770e60ab291553
[ "MIT" ]
8
2015-03-19T10:48:08.000Z
2021-01-10T17:50:30.000Z
require 'spec_helper' ################################################################################ # classes used in tests their naming is important because the respecting # json schema is derived from it ################################################################################ class Client attr_accessor :first_name, :id, :addresses, :work_address, :created_at end class Address attr_accessor :city, :zip end class Contact attr_accessor :first_name, :last_name, :addresses, :id, :organisation end class OneOfDefinition attr_accessor :person end # see fixtures/lead.json class Lead < Contact attr_accessor :links_clicked, :conversion end class Conversion attr_accessor :from, :to end class AnotherAddress include SchemaTools::Modules::Attributes has_schema_attrs 'address' end class NestedObjectNoProperties include SchemaTools::Modules::Attributes has_schema_attrs 'nested_object_no_properties' end describe SchemaTools::Hash do context 'from_schema to hash conversion' do let(:contact){Contact.new} let(:client){Client.new} before :each do contact.first_name = 'Peter' contact.last_name = 'Paul' contact.id = 'SomeID' client.created_at = Time.now end after :each do SchemaTools::Reader.registry_reset end it 'should return hash' do hash = SchemaTools::Hash.from_schema(contact) hash['last_name'].should == 'Paul' end it 'should format date-time fields to iso8601' do hash = SchemaTools::Hash.from_schema(client) hash['created_at'].should == client.created_at.iso8601 end it 'keeps nil values' do hash = SchemaTools::Hash.from_schema(contact) hash.keys.should include('organisation') hash['organisation'].should be_nil # hash['birthday'].should be_nil end it 'skips unknown fields values' do hash = SchemaTools::Hash.from_schema(contact) # not defined in the Contact class above, but defined in the contact.json schema hash.keys.should_not include('birthday') end it 'should use custom reader' do reader = SchemaTools::Reader.new reader.read_all File.expand_path('../../fixtures/schemata', __FILE__) client = Client.new client.first_name = 'Egon' a1 = Address.new a1.city = 'Cologne' client.addresses = [a1] # use a object with nesting as this is problematic hash = SchemaTools::Hash.from_schema(client, reader: reader) hash['first_name'].should == 'Egon' hash['addresses'][0]['city'].should == 'Cologne' end it 'should use custom schema path' do custom_path = File.expand_path('../../fixtures/schemata', __FILE__) hash = SchemaTools::Hash.from_schema(contact, path: custom_path) hash['last_name'].should == 'Paul' end it 'should use custom schema' do hash = SchemaTools::Hash.from_schema(contact, class_name: :client) hash['last_name'].should == 'Paul' end it 'should use only give fields' do hash = SchemaTools::Hash.from_schema(contact, fields: ['id', 'last_name']) hash.keys.length.should == 2 hash['last_name'].should == contact.last_name hash['id'].should == contact.id hash['first_name'].should be_nil end it 'has _links on object if exclude root' do hash = SchemaTools::Hash.from_schema(contact, links: true, class_name: :client) hash['_links'].length.should == 7 end end context 'with nested values referencing a schema that is different from the class name' do let(:client){Client.new} it 'has an empty array if values are missing' do hash = SchemaTools::Hash.from_schema(client) hash['addresses'].should == [] end it 'does not have the key if nested object is missing' do hash = SchemaTools::Hash.from_schema(client) hash.has_key?('work_address').should == false end it 'has nested array values' do a1 = AnotherAddress.new a1.city = 'Cologne' a1.zip = 50733 client.addresses = [a1] hash = SchemaTools::Hash.from_schema(client) hash['addresses'].should == [{"id" => nil, "city"=>"Cologne", "address1" => nil, "zip"=>"50733", "country" => nil, "address_type" => nil}] end it 'has nested array values without root' do a1 = AnotherAddress.new a1.city = 'Cologne' a1.zip = 50733 client.addresses = [a1] hash = SchemaTools::Hash.from_schema(client, exclude_root: true) hash['addresses'].should == [{"id" => nil, "city"=>"Cologne", "address1" => nil, "zip"=>"50733", "country" => nil, "address_type" => nil}] end it 'has nested object value' do a1 = AnotherAddress.new a1.city = 'Cologne' a1.zip = 50733 client.work_address = a1 hash = SchemaTools::Hash.from_schema(client) hash['work_address'].should == {"id" => nil, "city"=>"Cologne", "address1" => nil, "zip"=>"50733", "country" => nil, "address_type" => nil} end end context 'with nested values referencing a schema' do let(:client){Client.new} it 'has an empty array if values are missing' do hash = SchemaTools::Hash.from_schema(client) hash['addresses'].should == [] end it 'does not have the key if nested object is missing' do hash = SchemaTools::Hash.from_schema(client) hash.has_key?('work_address').should == false end it 'has nested array values' do a1 = Address.new a1.city = 'Cologne' a1.zip = 50733 client.addresses = [a1] hash = SchemaTools::Hash.from_schema(client) hash['addresses'].should == [{"city"=>"Cologne", "zip"=>"50733"}] end it 'has nested array values without root' do a1 = Address.new a1.city = 'Cologne' a1.zip = 50733 client.addresses = [a1] hash = SchemaTools::Hash.from_schema(client, exclude_root: true) hash['addresses'].should == [{"city"=>"Cologne", "zip"=>"50733"}] end it 'has nested object value' do a1 = Address.new a1.city = 'Cologne' a1.zip = 50733 client.work_address = a1 hash = SchemaTools::Hash.from_schema(client) hash['work_address'].should == {"city"=>"Cologne", "zip"=>"50733"} end it 'has nested oneOf type object ' do contact = Contact.new contact.first_name = 'Pit' i = OneOfDefinition.new i.person = contact hash = SchemaTools::Hash.from_schema(i, exclude_root: true) hash['person']['first_name'].should == 'Pit' end end context 'with plain nested values' do let(:lead){Lead.new} before :each do lead.links_clicked = ['2012-12-12', '2012-12-15', '2012-12-16'] conversion = Conversion.new conversion.from = 'whatever' conversion.to = 'whatever' lead.conversion = conversion @hash = SchemaTools::Hash.from_schema(lead) end after :each do SchemaTools::Reader.registry_reset end it 'should create array with values' do @hash['links_clicked'].should == lead.links_clicked end it 'should create object with values' do @hash['conversion']['from'].should == lead.conversion.from @hash['conversion']['to'].should == lead.conversion.to end end context 'with links' do let(:client){Client.new} before :each do client.first_name = 'Peter' client.id = 'SomeID' end after :each do SchemaTools::Reader.registry_reset end it 'has links' do hash = SchemaTools::Hash.from_schema(client, links: true) hash['_links'].length.should == 7 end it 'should prepend base_url' do hash = SchemaTools::Hash.from_schema(client, base_url: 'http://json-hell.com', links: true) hash['_links'].first['href'].should include( 'http://json-hell.com') end it 'should replace placeholders' do client.id = 123 hash = SchemaTools::Hash.from_schema(client, base_url: 'http://json-hell.com', links: true) hash['_links'].last['href'].should == 'http://json-hell.com/clients/123/Peter' end end context 'with a nested object that does not have properties' do let(:input_hash) { { foo: 'bar', baz: 'boom' } } let(:nested_object_no_properties) { NestedObjectNoProperties.from_hash(user_data: input_hash) } it 'should output the input hash' do hash = SchemaTools::Hash.from_schema(nested_object_no_properties) hash['user_data'].should == input_hash end end end
30.616949
99
0.600864
e28ded5b9c0f7fe3f7a4b3fcd95af0ae22d4edd4
3,094
bzl
Python
dev/bazel/repos.bzl
SmirnovEgorRu/oneDAL
00095d72d858c17fdb895de18e23c86dadbbd7cf
[ "Apache-2.0" ]
null
null
null
dev/bazel/repos.bzl
SmirnovEgorRu/oneDAL
00095d72d858c17fdb895de18e23c86dadbbd7cf
[ "Apache-2.0" ]
null
null
null
dev/bazel/repos.bzl
SmirnovEgorRu/oneDAL
00095d72d858c17fdb895de18e23c86dadbbd7cf
[ "Apache-2.0" ]
null
null
null
#=============================================================================== # Copyright 2020 Intel Corporation # # 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. #=============================================================================== load("@onedal//dev/bazel:utils.bzl", "utils", "paths") def _create_symlinks(repo_ctx, root, entries, substitutions={}): for entry in entries: entry_fmt = utils.substitude(entry, substitutions) src_entry_path = paths.join(root, entry_fmt) dst_entry_path = entry_fmt repo_ctx.symlink(src_entry_path, dst_entry_path) def _download(repo_ctx): output = repo_ctx.path("archive") repo_ctx.download_and_extract( url = repo_ctx.attr.url, sha256 = repo_ctx.attr.sha256, output = output, stripPrefix = repo_ctx.attr.strip_prefix, ) return str(output) def _prebuilt_libs_repo_impl(repo_ctx): root = repo_ctx.os.environ.get(repo_ctx.attr.root_env_var) if not root: if repo_ctx.attr.url: root = _download(repo_ctx) elif repo_ctx.attr.fallback_root: root = repo_ctx.attr.fallback_root else: fail("Cannot locate {} dependency".format(repo_ctx.name)) substitutions = { # TODO: Detect OS "%{os}": "lnx", } _create_symlinks(repo_ctx, root, repo_ctx.attr.includes, substitutions) _create_symlinks(repo_ctx, root, repo_ctx.attr.libs, substitutions) repo_ctx.template( "BUILD", repo_ctx.attr.build_template, substitutions = substitutions, ) def prebuilt_libs_repo_rule(includes, libs, build_template, root_env_var="", fallback_root="", url="", sha256="", strip_prefix=""): return repository_rule( implementation = _prebuilt_libs_repo_impl, environ = [ root_env_var, ], local = True, configure = True, attrs = { "root_env_var": attr.string(default=root_env_var), "fallback_root": attr.string(default=fallback_root), "url": attr.string(default=url), "sha256": attr.string(default=sha256), "strip_prefix": attr.string(default=strip_prefix), "includes": attr.string_list(default=includes), "libs": attr.string_list(default=libs), "build_template": attr.label(allow_files=True, default=Label(build_template)), } ) repos = struct( prebuilt_libs_repo_rule = prebuilt_libs_repo_rule, )
37.277108
80
0.612799
6d87fbee073eea5e32aca06bb61b1e98b5f14682
952
ts
TypeScript
src/theme/material/text-input.m.css.d.ts
redaktor/widgets
e41d0c43d949695bb241e29a839e696ccbc07913
[ "MIT" ]
1
2021-03-04T19:48:26.000Z
2021-03-04T19:48:26.000Z
src/theme/material/text-input.m.css.d.ts
redaktor/widgets
e41d0c43d949695bb241e29a839e696ccbc07913
[ "MIT" ]
null
null
null
src/theme/material/text-input.m.css.d.ts
redaktor/widgets
e41d0c43d949695bb241e29a839e696ccbc07913
[ "MIT" ]
null
null
null
export const root: string; export const raised: string; export const shaped: string; export const filled: string; export const input: string; export const wrapper: string; export const responsive: string; export const inputWrapper: string; export const animated: string; export const addonFilled: string; export const box: string; export const flat: string; export const outlined: string; export const disabled: string; export const invalid: string; export const focusedContent: string; export const label: string; export const noLabel: string; export const slideLabel: string; export const staticLabel: string; export const prefix: string; export const suffix: string; export const required: string; export const enabled: string; export const focused: string; export const readonly: string; export const addonRoot: string; export const hasLeading: string; export const hasTrailing: string; export const helperText: string; export const valid: string;
29.75
36
0.804622
f63b5454495be1e86fc57d5738dd59c2995f20ef
643
swift
Swift
Sources/Presenter/View - General/ViewBuilder.swift
Apodini/Presenter
ea7630c2c115c72a61f607c574e453470167b925
[ "MIT" ]
null
null
null
Sources/Presenter/View - General/ViewBuilder.swift
Apodini/Presenter
ea7630c2c115c72a61f607c574e453470167b925
[ "MIT" ]
2
2021-06-17T16:36:33.000Z
2021-09-09T07:47:55.000Z
Sources/Presenter/View - General/ViewBuilder.swift
Apodini/Presenter
ea7630c2c115c72a61f607c574e453470167b925
[ "MIT" ]
null
null
null
@resultBuilder public struct ViewBuilder { // MARK: Static Functions public static func buildBlock<V: View>(_ item: V) -> some View { item } public static func buildBlock(_ items: _CodableView...) -> some View { ArrayView(content: items) } public static func buildBlock(_ items: [_CodableView]) -> some View { ArrayView(content: items) } public static func buildEither<V: View>(first: V) -> V { first } public static func buildEither<V: View>(second: V) -> V { second } static func buildIf<V: View>(_ content: V?) -> V? { content } }
20.09375
74
0.589425
c3cf70993aed074deb21c8f614d1ffea4ebfe1b1
432
cs
C#
src/Service.Authorization/Utils/MonitoringLocator.cs
MyJetWallet/Service.Authorization
66801c3ee704c909c813cf660cbde705ec287c5a
[ "MIT" ]
null
null
null
src/Service.Authorization/Utils/MonitoringLocator.cs
MyJetWallet/Service.Authorization
66801c3ee704c909c813cf660cbde705ec287c5a
[ "MIT" ]
null
null
null
src/Service.Authorization/Utils/MonitoringLocator.cs
MyJetWallet/Service.Authorization
66801c3ee704c909c813cf660cbde705ec287c5a
[ "MIT" ]
null
null
null
using Prometheus; namespace Service.Authorization.Utils { public static class MonitoringLocator { public static readonly Gauge ItemsInAuthLogQueue = Metrics.CreateGauge("auth_grpc_authlog_queue", "Count items in authlog queue"); public static readonly Counter TotalItemsInAuthLogQueue = Metrics.CreateCounter("auth_grpc_authlog_queue_total", "Count items in authlog queue"); } }
33.230769
99
0.731481
030d37e96aed834f55f2032e97030ec7fd503fcd
359
sql
SQL
tests/SchemaGenerator/examples/lm-indexes/dump-mysql.sql
inlm/schema-generator
d52a2c3714f06e560cb5cbc2e176558bb687d6c1
[ "BSD-3-Clause" ]
6
2019-09-13T20:34:35.000Z
2021-02-22T07:01:58.000Z
tests/SchemaGenerator/examples/lm-indexes/dump-mysql.sql
inlm/schema-generator
d52a2c3714f06e560cb5cbc2e176558bb687d6c1
[ "BSD-3-Clause" ]
6
2018-06-12T08:47:42.000Z
2022-01-01T18:32:34.000Z
tests/SchemaGenerator/examples/lm-indexes/dump-mysql.sql
inlm/schema-generator
d52a2c3714f06e560cb5cbc2e176558bb687d6c1
[ "BSD-3-Clause" ]
1
2018-04-24T18:00:07.000Z
2018-04-24T18:00:07.000Z
SET foreign_key_checks = 1; SET time_zone = "SYSTEM"; SET sql_mode = "TRADITIONAL"; CREATE TABLE `book` ( `id` TEXT NOT NULL, `name` TEXT NOT NULL, `description` TEXT NULL, `website` TEXT NULL, PRIMARY KEY (`id`), UNIQUE KEY `website` (`website`), KEY `name_website` (`name`, `website`) ) ENGINE=InnoDB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_czech_ci;
21.117647
39
0.707521
97a9fb34e69cb03afe2aa8ac1a212d426ea3742e
238
sql
SQL
sql/grid-banner/site/data.0.1-0.sql
webriq/banner
6d3615927461dd916ee7100d5c72b93b1361e877
[ "BSD-3-Clause" ]
null
null
null
sql/grid-banner/site/data.0.1-0.sql
webriq/banner
6d3615927461dd916ee7100d5c72b93b1361e877
[ "BSD-3-Clause" ]
null
null
null
sql/grid-banner/site/data.0.1-0.sql
webriq/banner
6d3615927461dd916ee7100d5c72b93b1361e877
[ "BSD-3-Clause" ]
null
null
null
-- remove data DELETE FROM "module" WHERE "module" = 'Grid\Banner'; DELETE FROM "user_right" WHERE "group" = 'banner' AND "resource" = 'banner' AND "privilege" IN ( 'view', 'edit', 'create', 'delete' );
23.8
66
0.563025
f26a33db4e3161a6983016723f1d632c03f36a61
7,090
dart
Dart
lib/models/api_user.dart
prasso/prasso_app
03b3c2a7d40289502995da9327fd6d279c95cbf0
[ "MIT" ]
1
2021-12-02T12:16:45.000Z
2021-12-02T12:16:45.000Z
lib/models/api_user.dart
prasso/prasso_app
03b3c2a7d40289502995da9327fd6d279c95cbf0
[ "MIT" ]
4
2021-12-02T12:36:33.000Z
2022-03-15T12:48:42.000Z
lib/models/api_user.dart
prasso/prasso_app
03b3c2a7d40289502995da9327fd6d279c95cbf0
[ "MIT" ]
1
2021-03-03T02:32:08.000Z
2021-03-03T02:32:08.000Z
// import 'dart:developer'; // Dart imports: import 'dart:convert'; // Flutter imports: import 'package:flutter/foundation.dart'; // Package imports: import 'package:firebase_auth/firebase_auth.dart'; import 'package:meta/meta.dart'; import 'package:prasso_app/app_widgets/account/edit_user_profile_viewmodel.dart'; import 'package:prasso_app/models/role_model.dart'; import 'package:prasso_app/models/team_member_model.dart'; @immutable class ApiUser { const ApiUser( {@required this.uid, this.email, this.photoURL, this.displayName, this.appConfig, this.appToken, this.initialized, this.roles, this.personalTeamId, this.teamCoachId, this.teamMembers, this.pnToken, this.appName}) : assert(uid != null, 'User can only be created with a non-null uid'); final String uid; final String email; final String photoURL; final String displayName; final String appConfig; final String appToken; //the token which identifies this user's app final bool initialized; final List<RoleModel> roles; final int personalTeamId; final int teamCoachId; final List<TeamMemberModel> teamMembers; final String pnToken; final String appName; factory ApiUser.fromLocatorUpdated( ApiUser user, EditUserProfileViewModel vm) { return ApiUser( uid: user.uid, email: vm.email, photoURL: vm.photoURL, displayName: vm.displayName, appToken: user.appToken, initialized: true, roles: vm.roles, personalTeamId: vm.personalTeamId, teamCoachId: vm.teamCoachId, teamMembers: vm.teamMembers, pnToken: vm.pnToken, appName: vm.appName); } factory ApiUser.fromAPIJson( dynamic _user, String appConfig, String appToken) { if (_user == null) { return null; } if (_user is User) { final User usr = _user; if (!(appConfig?.isEmpty ?? true)) { final dynamic jsonAppData = jsonDecode(appConfig); if (jsonAppData != null && jsonAppData.containsKey('data') == true) { return ApiUser( uid: usr.uid, email: usr.email, displayName: jsonAppData['data']['name'], photoURL: jsonAppData['data']['photoURL'], appConfig: appConfig, appToken: jsonAppData['data']['token'], initialized: true, roles: RoleModel.convertFromJson(jsonAppData['data']['roles']) .toString() ?? RoleModel.defaultRole(), personalTeamId: jsonAppData['data']['personal_team_id'], teamCoachId: jsonAppData['data']['team_coach_id'], teamMembers: TeamMemberModel.convertFromJson( jsonAppData['data']['team_members']) .toString() ?? defaultTeamMembers(), pnToken: jsonAppData['data']['pn_token'], appName: jsonAppData['data']['appName']); } } return ApiUser( uid: usr.uid, email: usr.email, displayName: usr.displayName, photoURL: usr.photoURL, appConfig: appConfig, appToken: appToken, initialized: false, roles: RoleModel.defaultRole(), personalTeamId: 0, teamCoachId: 0, teamMembers: defaultTeamMembers(), pnToken: '', appName: ''); } else { if (_user is ApiUser) { return _user; } final dynamic jsonResponse = jsonDecode(_user); if (jsonResponse['data'] != null) { final String jsonusr = jsonEncode(_user); return ApiUser( uid: _user['data']['uid'].toString(), email: _user['data']['email'], displayName: _user['data']['name'], photoURL: _user['data']['photoURL'].toString(), appConfig: jsonusr, appToken: _user['data']['token'], initialized: true, roles: RoleModel.convertFromJson(_user['data']['roles']).toString() ?? RoleModel.defaultRole(), personalTeamId: _user['data']['personal_team_id'], teamCoachId: _user['data']['team_coach_id'], teamMembers: TeamMemberModel.convertFromJson( _user['data']['team_members'].toString()) ?? defaultTeamMembers(), pnToken: _user['data']['pn_token'], appName: _user['data']['appName']); } else { return ApiUser( uid: jsonResponse['uid'].toString(), email: jsonResponse['email'], displayName: jsonResponse['displayName'] ?? jsonResponse['name'], photoURL: jsonResponse['photoURL'], appConfig: jsonResponse['appConfig'] ?? appConfig, appToken: jsonResponse['appToken'] ?? appToken, initialized: true, roles: RoleModel.convertFromJson(jsonResponse['roles'].toString()) ?? RoleModel.defaultRole(), personalTeamId: jsonResponse['personal_team_id'] ?? 0, teamCoachId: jsonResponse['team_coach_id'] ?? 0, teamMembers: TeamMemberModel.convertFromJson( jsonResponse['team_members'].toString()) ?? defaultTeamMembers(), pnToken: jsonResponse['pn_token'], appName: jsonResponse['appName']); } } } factory ApiUser.fromStorage(String _user, String appConfig, String appToken) { final dynamic userFromStorage = jsonDecode(_user); return ApiUser( uid: userFromStorage['uid'], email: userFromStorage['email'], displayName: userFromStorage['displayName'], photoURL: userFromStorage['photoURL'], appConfig: appConfig, appToken: appToken, initialized: true, roles: RoleModel.convertFromJson(userFromStorage['roles'].toString()) ?? RoleModel.defaultRole(), personalTeamId: userFromStorage['personalTeamId'], teamCoachId: userFromStorage['teamCoachId'], teamMembers: TeamMemberModel.convertFromJson( userFromStorage['teamMembers'].toString()) ?? defaultTeamMembers(), pnToken: userFromStorage['pnToken'], appName: userFromStorage['appName']); } static List<TeamMemberModel> defaultTeamMembers() { final List<TeamMemberModel> defaultTeamMembers = []; return defaultTeamMembers; } @override String toString() { return jsonEncode(toMap()); } Map<String, dynamic> toMap() { return { 'uid': uid, 'email': email, 'photoURL': photoURL, 'displayName': displayName, 'appConfig': appConfig, 'appToken': appToken?.replaceAll('"', ''), 'roles': jsonEncode(roles), 'personalTeamId': personalTeamId, 'teamCoachId': teamCoachId, 'teamMembers': jsonEncode(teamMembers), 'pnToken': jsonEncode(pnToken), 'appName': jsonEncode(appName) }; } }
33.761905
81
0.597461
cdf153271f5133ac569b230c48aca25dbb5dca65
840
cs
C#
src/Algorithms/Multithreading/ReadersWritersProblem/Reader.cs
Miltt/Console
df47ded80d9d2c7e48013b310ec5866f8a2b0f6b
[ "MIT" ]
1
2022-02-08T20:09:26.000Z
2022-02-08T20:09:26.000Z
src/Algorithms/Multithreading/ReadersWritersProblem/Reader.cs
Miltt/Console
df47ded80d9d2c7e48013b310ec5866f8a2b0f6b
[ "MIT" ]
null
null
null
src/Algorithms/Multithreading/ReadersWritersProblem/Reader.cs
Miltt/Console
df47ded80d9d2c7e48013b310ec5866f8a2b0f6b
[ "MIT" ]
2
2019-10-07T16:48:22.000Z
2020-02-22T09:57:20.000Z
using System; using System.Threading; namespace Cnsl.Algorithms.Multithreading { public class Reader { public enum EventType { Unknown = 0, Read = 1, Sleep = 2 } public int ActionTimeoutMs => 1500; public int SleepTimeoutMs => 500; public event EventHandler<ReaderEventArgs> EventRaised; public void Read() { AddEvent(EventType.Read, "Read..."); Thread.Sleep(ActionTimeoutMs); } public void Sleep() { AddEvent(EventType.Sleep, "Sleep..."); Thread.Sleep(SleepTimeoutMs); } private void AddEvent(EventType type, string message) => EventRaised?.Invoke(this, new ReaderEventArgs(Thread.CurrentThread.Name, type, message)); } }
24
104
0.566667
a8b32276cdd89809d7cc9b8c5d0b7ce324262245
847
dart
Dart
graphql_schema/example/example.dart
triskell/graphql_dart
2d4ebc4957d5670433a415764758ec93d64a8f1e
[ "MIT" ]
8
2021-06-17T14:05:58.000Z
2022-03-08T02:26:10.000Z
graphql_schema/example/example.dart
triskell/graphql_dart
2d4ebc4957d5670433a415764758ec93d64a8f1e
[ "MIT" ]
1
2022-03-06T12:26:41.000Z
2022-03-10T09:23:31.000Z
graphql_schema/example/example.dart
triskell/graphql_dart
2d4ebc4957d5670433a415764758ec93d64a8f1e
[ "MIT" ]
2
2021-06-29T13:13:58.000Z
2021-11-09T17:30:29.000Z
import 'package:graphql_schema2/graphql_schema2.dart'; final GraphQLSchema todoSchema = GraphQLSchema( queryType: objectType('Todo', fields: [ field( 'text', graphQLString.nonNullable(), resolve: resolveToNull, ), field( 'created_at', graphQLDate, resolve: resolveToNull, ), ]), ); void main() { // Validation var validation = todoSchema.queryType!.validate( '@root', { 'foo': 'bar', 'text': null, 'created_at': 24, }, ); if (validation.successful) { print('This is valid data!!!'); } else { print('Invalid data.'); validation.errors.forEach((s) => print(' * $s')); } // Serialization print(todoSchema.queryType!.serialize({ 'text': 'Clean your room!', 'created_at': DateTime.now().subtract(Duration(days: 10)) })); }
20.166667
61
0.59268
3033ae792ef8366be1fd116932fda8b1bbaedc5e
1,885
swift
Swift
ElCanari/document-project-transient-CommentInSchematic/transient-CommentInSchematic-objectDisplay.swift
pierremolinaro/ElCanari-dev
e5368983cf1558f6f4d567e7171beda56b5218b8
[ "MIT" ]
3
2019-12-18T12:47:51.000Z
2020-12-21T14:07:43.000Z
ElCanari/document-project-transient-CommentInSchematic/transient-CommentInSchematic-objectDisplay.swift
pierremolinaro/ElCanari-dev
e5368983cf1558f6f4d567e7171beda56b5218b8
[ "MIT" ]
1
2018-09-11T09:11:45.000Z
2018-09-12T12:13:10.000Z
ElCanari/document-project-transient-CommentInSchematic/transient-CommentInSchematic-objectDisplay.swift
pierremolinaro/ElCanari-dev
e5368983cf1558f6f4d567e7171beda56b5218b8
[ "MIT" ]
null
null
null
//—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— // THIS FILE IS REGENERATED BY EASY BINDINGS, ONLY MODIFY IT WITHIN USER ZONES //—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— import Cocoa //—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— //--- START OF USER ZONE 1 //--- END OF USER ZONE 1 //—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— func transient_CommentInSchematic_objectDisplay ( _ self_mComment : String, _ self_mColor : NSColor, _ self_mSize : Double, _ self_mHorizontalAlignment : HorizontalAlignment, _ self_mVerticalAlignment : VerticalAlignment, _ self_mX : Int, _ self_mY : Int ) -> EBShape { //--- START OF USER ZONE 2 // Swift.print ("self_mSize \(self_mSize)") let s = CGFloat (self_mSize) let font = NSFont (name: "LucidaGrande", size: s)! let p = CanariPoint (x: self_mX, y: self_mY).cocoaPoint let textAttributes : [NSAttributedString.Key : Any] = [ NSAttributedString.Key.font : font, NSAttributedString.Key.foregroundColor : self_mColor ] return EBShape ( text: (self_mComment == "") ? "Empty comment" : self_mComment, p, textAttributes, self_mHorizontalAlignment.ebTextShapeHorizontalAlignment, self_mVerticalAlignment.ebTextShapeVerticalAlignment ) //--- END OF USER ZONE 2 } //——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
41.888889
120
0.407958
d5b9a750ff3e57012d0bd279af478938d2daf774
2,121
lua
Lua
main.lua
OpenGestureControl/Browser-module
c7152fd02b36f6cbddafc135e6ba6a6ecb149ef3
[ "MIT" ]
null
null
null
main.lua
OpenGestureControl/Browser-module
c7152fd02b36f6cbddafc135e6ba6a6ecb149ef3
[ "MIT" ]
null
null
null
main.lua
OpenGestureControl/Browser-module
c7152fd02b36f6cbddafc135e6ba6a6ecb149ef3
[ "MIT" ]
null
null
null
-- Copyright (c) 2017 ICT Group -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. -- Browser module for OpenGestureControl -- Controls any browser with basic hotkeys function return_options() local entries = {}; table.insert(entries, {name = "Open", icon = "OSwindow_500px.png"}) table.insert(entries, {name = "Forward", icon = "Forward_500px.png"}) table.insert(entries, {name = "Close", icon = "Close_500px.png"}) table.insert(entries, {name = "Refresh", icon = "Refresh_500px.png"}) table.insert(entries, {name = "Back", icon = "Back_500px.png"}) return entries; end function handle(selection) if selection == "Open" then ModuleHelperSendKeyboardKey("Ctrl+T") elseif selection == "Forward" then ModuleHelperSendKeyboardKey("Alt+Right") elseif selection == "Close" then ModuleHelperSendKeyboardKey("Ctrl+W") elseif selection == "Refresh" then ModuleHelperSendKeyboardKey("F5") elseif selection == "Back" then ModuleHelperSendKeyboardKey("Alt+Left") else error("Unknown selection made") end end
44.1875
81
0.724658
c68dc3037164a58e8972fb3c805e51e5b0b5198b
3,066
py
Python
test/test_derivatives.py
gelijergensen/Constrained-Neural-Nets-Workbook
d71049939ace04b8baa672c7a8f632f5e01da24b
[ "MIT" ]
3
2019-09-25T10:04:46.000Z
2020-03-03T10:04:15.000Z
test/test_derivatives.py
gelijergensen/Constrained-Neural-Nets-Workbook
d71049939ace04b8baa672c7a8f632f5e01da24b
[ "MIT" ]
null
null
null
test/test_derivatives.py
gelijergensen/Constrained-Neural-Nets-Workbook
d71049939ace04b8baa672c7a8f632f5e01da24b
[ "MIT" ]
2
2019-09-21T21:27:04.000Z
2021-02-12T19:42:47.000Z
import numpy as np import torch from src.derivatives import jacobian, trace def test_jacobian(): batchsize = int(np.random.randint(1, 10)) # vector * matrix -- # Unbatched rand_lengths = np.random.randint(1, 10, 2) ins = torch.rand(tuple(list(rand_lengths[-1:])), requires_grad=True) factor = torch.rand(tuple(list(rand_lengths))) out = factor @ ins jac = jacobian(out, ins) assert torch.allclose(jac, factor) # Batched ins = ins.unsqueeze(0).expand(batchsize, *ins.size()) out = torch.einsum("ij,kj->ki", factor, ins) assert torch.allclose(torch.squeeze(out), out) bat_jac = jacobian(out, ins, batched=True) for i in range(batchsize): assert torch.allclose(bat_jac[i], factor) # test nonlinear case rand_lengths = np.random.randint(1, 10, 2) ins = torch.rand( batchsize, *tuple(list(rand_lengths[-1:])), requires_grad=True ) out = torch.sin(3.15 * ins + 2.91) bat_jac = jacobian(out, ins, batched=True) expected = torch.diag_embed(3.15 * torch.cos(3.15 * ins + 2.91)) assert torch.allclose(bat_jac, expected) # matrix * matrix -- # Unbatched rand_lengths = np.random.randint(1, 10, 3) ins = torch.rand(tuple(list(rand_lengths[-2:])), requires_grad=True) factor = torch.rand(tuple(list(rand_lengths[:-1]))) out = factor @ ins jac = jacobian(out, ins) ans = jac.new_zeros(jac.size()) for i in range(jac.size()[-1]): ans[:, i, :, i] = factor assert torch.allclose(jac, ans) # Batched ins = ins.unsqueeze(0).expand(batchsize, *ins.size()) out = torch.einsum("ij,kjl->kil", factor, ins) bat_jac = jacobian(out, ins, batched=True) ans = jac.new_zeros(bat_jac.size()) for b in range(batchsize): for i in range(bat_jac.size()[-1]): ans[b, :, i, :, i] = factor assert torch.allclose(bat_jac, ans) # Confirm agreement in complex case -- # Unbatched rand_lengths = np.random.randint(1, 7, 5) ins = torch.rand(tuple(list(rand_lengths)), requires_grad=True) out = torch.relu(ins) jac = jacobian(out, ins) # Check that lists work correctly out = torch.relu(ins) list_jac = jacobian(out, [ins, ins]) assert all(torch.allclose(jac, list_jac[i]) for i in range(len(list_jac))) # Batched ins = ins.view(-1, *ins.size()) out = torch.relu(ins) bat_jac = jacobian(out, ins, batched=True) assert torch.allclose(jac, bat_jac[0]) def test_trace(): # Unbatched rand_length = int(np.random.randint(1, 10, 1)) ins = torch.rand((rand_length, rand_length)) trc = trace(ins) assert torch.allclose(trc, torch.trace(ins)) # Check that lists work correctly list_trc = trace([ins, ins]) assert all(torch.allclose(list_trc[i], trc) for i in range(len(list_trc))) # Batched batchsize = int(np.random.randint(1, 10)) ins = ins.unsqueeze(0).expand(batchsize, *ins.size()) ans = trace(ins) for b in range(batchsize): assert torch.allclose(ans[b], trc)
29.2
78
0.634703
a35933064fe5a8c5c9154b8bd204f941c1415aa8
11,446
java
Java
core/src/main/java/org/web3j/protocol/rx/JsonRpc2_0Rx.java
xwc1125/web3j
a167aa595e7b995204d0c76a359d215463e3ac17
[ "Apache-2.0" ]
3
2021-05-30T01:43:03.000Z
2022-02-09T07:25:16.000Z
core/src/main/java/org/web3j/protocol/rx/JsonRpc2_0Rx.java
xwc1125/web3j
a167aa595e7b995204d0c76a359d215463e3ac17
[ "Apache-2.0" ]
1
2020-01-21T06:58:58.000Z
2020-01-21T06:58:58.000Z
core/src/main/java/org/web3j/protocol/rx/JsonRpc2_0Rx.java
xwc1125/web3j
a167aa595e7b995204d0c76a359d215463e3ac17
[ "Apache-2.0" ]
2
2021-05-30T01:43:05.000Z
2021-09-30T15:40:41.000Z
/* * Copyright 2019 Web3 Labs LTD. * * 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. */ package org.web3j.protocol.rx; import java.io.IOException; import java.math.BigInteger; import java.util.List; import java.util.concurrent.ScheduledExecutorService; import java.util.stream.Collectors; import io.reactivex.BackpressureStrategy; import io.reactivex.Flowable; import io.reactivex.FlowableEmitter; import io.reactivex.Scheduler; import io.reactivex.schedulers.Schedulers; import org.web3j.protocol.Web3j; import org.web3j.protocol.core.DefaultBlockParameter; import org.web3j.protocol.core.DefaultBlockParameterName; import org.web3j.protocol.core.DefaultBlockParameterNumber; import org.web3j.protocol.core.filters.BlockFilter; import org.web3j.protocol.core.filters.LogFilter; import org.web3j.protocol.core.filters.PendingTransactionFilter; import org.web3j.protocol.core.methods.response.EthBlock; import org.web3j.protocol.core.methods.response.Log; import org.web3j.protocol.core.methods.response.Transaction; import org.web3j.utils.Flowables; /** web3j reactive API implementation. */ public class JsonRpc2_0Rx { private final Web3j web3j; private final ScheduledExecutorService scheduledExecutorService; private final Scheduler scheduler; public JsonRpc2_0Rx(Web3j web3j, ScheduledExecutorService scheduledExecutorService) { this.web3j = web3j; this.scheduledExecutorService = scheduledExecutorService; this.scheduler = Schedulers.from(scheduledExecutorService); } public Flowable<String> ethBlockHashFlowable(long pollingInterval) { return Flowable.create( subscriber -> { BlockFilter blockFilter = new BlockFilter(web3j, subscriber::onNext); run(blockFilter, subscriber, pollingInterval); }, BackpressureStrategy.BUFFER); } public Flowable<String> ethPendingTransactionHashFlowable(long pollingInterval) { return Flowable.create( subscriber -> { PendingTransactionFilter pendingTransactionFilter = new PendingTransactionFilter(web3j, subscriber::onNext); run(pendingTransactionFilter, subscriber, pollingInterval); }, BackpressureStrategy.BUFFER); } public Flowable<Log> ethLogFlowable( org.web3j.protocol.core.methods.request.EthFilter ethFilter, long pollingInterval) { return Flowable.create( subscriber -> { LogFilter logFilter = new LogFilter(web3j, subscriber::onNext, ethFilter); run(logFilter, subscriber, pollingInterval); }, BackpressureStrategy.BUFFER); } private <T> void run( org.web3j.protocol.core.filters.Filter<T> filter, FlowableEmitter<? super T> emitter, long pollingInterval) { filter.run(scheduledExecutorService, pollingInterval); emitter.setCancellable(filter::cancel); } public Flowable<Transaction> transactionFlowable(long pollingInterval) { return blockFlowable(true, pollingInterval).flatMapIterable(JsonRpc2_0Rx::toTransactions); } public Flowable<Transaction> pendingTransactionFlowable(long pollingInterval) { return ethPendingTransactionHashFlowable(pollingInterval) .flatMap( transactionHash -> web3j.ethGetTransactionByHash(transactionHash).flowable()) .filter(ethTransaction -> ethTransaction.getTransaction().isPresent()) .map(ethTransaction -> ethTransaction.getTransaction().get()); } public Flowable<EthBlock> blockFlowable(boolean fullTransactionObjects, long pollingInterval) { return ethBlockHashFlowable(pollingInterval) .flatMap( blockHash -> web3j.ethGetBlockByHash(blockHash, fullTransactionObjects) .flowable()); } public Flowable<EthBlock> replayBlocksFlowable( DefaultBlockParameter startBlock, DefaultBlockParameter endBlock, boolean fullTransactionObjects) { return replayBlocksFlowable(startBlock, endBlock, fullTransactionObjects, true); } public Flowable<EthBlock> replayBlocksFlowable( DefaultBlockParameter startBlock, DefaultBlockParameter endBlock, boolean fullTransactionObjects, boolean ascending) { // We use a scheduler to ensure this Flowable runs asynchronously for users to be // consistent with the other Flowables return replayBlocksFlowableSync(startBlock, endBlock, fullTransactionObjects, ascending) .subscribeOn(scheduler); } private Flowable<EthBlock> replayBlocksFlowableSync( DefaultBlockParameter startBlock, DefaultBlockParameter endBlock, boolean fullTransactionObjects) { return replayBlocksFlowableSync(startBlock, endBlock, fullTransactionObjects, true); } private Flowable<EthBlock> replayBlocksFlowableSync( DefaultBlockParameter startBlock, DefaultBlockParameter endBlock, boolean fullTransactionObjects, boolean ascending) { BigInteger startBlockNumber = null; BigInteger endBlockNumber = null; try { startBlockNumber = getBlockNumber(startBlock); endBlockNumber = getBlockNumber(endBlock); } catch (IOException e) { Flowable.error(e); } if (ascending) { return Flowables.range(startBlockNumber, endBlockNumber) .flatMap( i -> web3j.ethGetBlockByNumber( new DefaultBlockParameterNumber(i), fullTransactionObjects) .flowable()); } else { return Flowables.range(startBlockNumber, endBlockNumber, false) .flatMap( i -> web3j.ethGetBlockByNumber( new DefaultBlockParameterNumber(i), fullTransactionObjects) .flowable()); } } public Flowable<Transaction> replayTransactionsFlowable( DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { return replayBlocksFlowable(startBlock, endBlock, true) .flatMapIterable(JsonRpc2_0Rx::toTransactions); } public Flowable<EthBlock> replayPastBlocksFlowable( DefaultBlockParameter startBlock, boolean fullTransactionObjects, Flowable<EthBlock> onCompleteFlowable) { // We use a scheduler to ensure this Flowable runs asynchronously for users to be // consistent with the other Flowables return replayPastBlocksFlowableSync(startBlock, fullTransactionObjects, onCompleteFlowable) .subscribeOn(scheduler); } public Flowable<EthBlock> replayPastBlocksFlowable( DefaultBlockParameter startBlock, boolean fullTransactionObjects) { return replayPastBlocksFlowable(startBlock, fullTransactionObjects, Flowable.empty()); } private Flowable<EthBlock> replayPastBlocksFlowableSync( DefaultBlockParameter startBlock, boolean fullTransactionObjects, Flowable<EthBlock> onCompleteFlowable) { BigInteger startBlockNumber; BigInteger latestBlockNumber; try { startBlockNumber = getBlockNumber(startBlock); latestBlockNumber = getLatestBlockNumber(); } catch (IOException e) { return Flowable.error(e); } if (startBlockNumber.compareTo(latestBlockNumber) > -1) { return onCompleteFlowable; } else { return Flowable.concat( replayBlocksFlowableSync( new DefaultBlockParameterNumber(startBlockNumber), new DefaultBlockParameterNumber(latestBlockNumber), fullTransactionObjects), Flowable.defer( () -> replayPastBlocksFlowableSync( new DefaultBlockParameterNumber( latestBlockNumber.add(BigInteger.ONE)), fullTransactionObjects, onCompleteFlowable))); } } public Flowable<Transaction> replayPastTransactionsFlowable(DefaultBlockParameter startBlock) { return replayPastBlocksFlowable(startBlock, true, Flowable.empty()) .flatMapIterable(JsonRpc2_0Rx::toTransactions); } public Flowable<EthBlock> replayPastAndFutureBlocksFlowable( DefaultBlockParameter startBlock, boolean fullTransactionObjects, long pollingInterval) { return replayPastBlocksFlowable( startBlock, fullTransactionObjects, blockFlowable(fullTransactionObjects, pollingInterval)); } public Flowable<Transaction> replayPastAndFutureTransactionsFlowable( DefaultBlockParameter startBlock, long pollingInterval) { return replayPastAndFutureBlocksFlowable(startBlock, true, pollingInterval) .flatMapIterable(JsonRpc2_0Rx::toTransactions); } private BigInteger getLatestBlockNumber() throws IOException { return getBlockNumber(DefaultBlockParameterName.LATEST); } private BigInteger getBlockNumber(DefaultBlockParameter defaultBlockParameter) throws IOException { if (defaultBlockParameter instanceof DefaultBlockParameterNumber) { return ((DefaultBlockParameterNumber) defaultBlockParameter).getBlockNumber(); } else { EthBlock latestEthBlock = web3j.ethGetBlockByNumber(defaultBlockParameter, false).send(); return latestEthBlock.getBlock().getNumber(); } } private static List<Transaction> toTransactions(EthBlock ethBlock) { // If you ever see an exception thrown here, it's probably due to an incomplete chain in // Geth/Parity. You should resync to solve. return ethBlock.getBlock().getTransactions().stream() .map(transactionResult -> (Transaction) transactionResult.get()) .collect(Collectors.toList()); } }
42.392593
118
0.641796
b586d20de69fc71735ba1babca8ce7022ed5ca1f
2,141
sql
SQL
database/src/main/resources/db/migration/V1_0__init.sql
peterfigure/explorer-service
c9b14b38d22a76450b0644d693ade4fc18fc69b7
[ "Apache-2.0" ]
1
2021-04-01T16:36:14.000Z
2021-04-01T16:36:14.000Z
database/src/main/resources/db/migration/V1_0__init.sql
peterfigure/explorer-service
c9b14b38d22a76450b0644d693ade4fc18fc69b7
[ "Apache-2.0" ]
159
2021-03-08T18:05:44.000Z
2022-03-29T18:39:55.000Z
database/src/main/resources/db/migration/V1_0__init.sql
peterfigure/explorer-service
c9b14b38d22a76450b0644d693ade4fc18fc69b7
[ "Apache-2.0" ]
1
2022-01-12T18:54:50.000Z
2022-01-12T18:54:50.000Z
CREATE TABLE block_cache ( height INT PRIMARY KEY, tx_count INT NOT NULL DEFAULT(0), block_timestamp TIMESTAMP NOT NULL, block JSONB NOT NULL, last_hit TIMESTAMP NOT NULL, hit_count INT NOT NULL ); CREATE TABLE block_index ( id INT PRIMARY KEY, max_height_read INT NULL, min_height_read INT NULL, last_update TIMESTAMP NOT NULL ); CREATE TABLE validator_addresses ( id SERIAL PRIMARY KEY, consensus_address VARCHAR(96) NOT NULL UNIQUE, consensus_pubkey_address VARCHAR(96) NOT NULL UNIQUE, operator_address VARCHAR(96) NOT NULL UNIQUE ); CREATE TABLE validators_cache ( height INT PRIMARY KEY, validators JSONB NOT NULL, last_hit TIMESTAMP NOT NULL, hit_count INT NOT NULL ); CREATE TABLE staking_validator_cache ( operator_address VARCHAR(128) PRIMARY KEY, staking_validator JSONB NOT NULL, last_hit TIMESTAMP NOT NULL, hit_count INT NOT NULL ); CREATE TABLE validator_delegations_cache ( operator_address VARCHAR(128) PRIMARY KEY, validator_delegations JSONB NOT NULL, last_hit TIMESTAMP NOT NULL, hit_count INT NOT NULL ); CREATE TABLE transaction_cache ( hash VARCHAR(64) PRIMARY KEY, height INT NOT NULL, tx_type VARCHAR(64) NOT NULL, signer VARCHAR(128), gas_wanted INT NOT NULL, gas_used INT NOT NULL, tx_timestamp TIMESTAMP NOT NULL, error_code INT DEFAULT NULL, codespace VARCHAR(16) DEFAULT NULL, tx JSONB NOT NULL, tx_v2 JSONB NOT NULL, last_hit TIMESTAMP NOT NULL, hit_count INT NOT NULL ); CREATE TABLE spotlight_cache ( id SMALLINT PRIMARY KEY, spotlight JSONB NOT NULL, last_hit TIMESTAMP NOT NULL ); CREATE TABLE marker_cache ( marker_address VARCHAR(128) NOT NULL PRIMARY KEY, marker_type VARCHAR(128) NOT NULL, denom VARCHAR(64) NOT NULL, status VARCHAR(128) NOT NULL, total_supply DECIMAL NOT NULL, data JSONB NOT NULL ); CREATE TABLE account ( account_address VARCHAR(128) NOT NULL, type VARCHAR(128) NOT NULL, account_number BIGINT NOT NULL, base_account JSONB NOT NULL, data JSONB NOT NULL )
23.021505
57
0.722092
fd76ee15348b160fc492994627e72c35229fc195
221
dart
Dart
lib/data/remote/endpoints/county_endpoints.dart
Gandharvdalal/mobile-app
4749a085a6b86a3c58564496fca027e6ec93a992
[ "MIT" ]
1
2019-12-09T04:31:29.000Z
2019-12-09T04:31:29.000Z
lib/data/remote/endpoints/county_endpoints.dart
Emanuz/mobile-app
f631aea74d5e9766400eeea12dfd3af43b83cd45
[ "MIT" ]
null
null
null
lib/data/remote/endpoints/county_endpoints.dart
Emanuz/mobile-app
f631aea74d5e9766400eeea12dfd3af43b83cd45
[ "MIT" ]
null
null
null
import 'package:dio/dio.dart'; import 'package:vost/constants.dart'; class CountyEndpoints { final Dio _dio; CountyEndpoints(this._dio); Future<Response> getCounties() { return _dio.get(pathCounties); } }
15.785714
37
0.714932
8865c79a8dfcd8d324b605c12e0cde8181fc3629
1,101
psm1
PowerShell
lib/webserver/New-IcingaTCPSocket.psm1
moreamazingnick/icinga-powershell-framework
211d9d3a1d7e1672dbeafc00da2ea0860080d173
[ "MIT" ]
45
2019-10-31T16:51:08.000Z
2022-01-28T13:17:14.000Z
lib/webserver/New-IcingaTCPSocket.psm1
moreamazingnick/icinga-powershell-framework
211d9d3a1d7e1672dbeafc00da2ea0860080d173
[ "MIT" ]
210
2019-11-05T10:42:10.000Z
2022-03-31T15:51:23.000Z
lib/webserver/New-IcingaTCPSocket.psm1
moreamazingnick/icinga-powershell-framework
211d9d3a1d7e1672dbeafc00da2ea0860080d173
[ "MIT" ]
31
2019-11-26T13:50:30.000Z
2022-03-25T14:53:18.000Z
function New-IcingaTCPSocket() { param ( [string]$Address = '', [int]$Port = 0, [switch]$Start = $FALSE ); if ($Port -eq 0) { throw 'Please specify a valid port to open a TCP socket for'; } # Listen on localhost by default $ListenAddress = New-Object System.Net.IPEndPoint([IPAddress]::Loopback, $Port); if ([string]::IsNullOrEmpty($Address) -eq $FALSE) { $ListenAddress = New-Object System.Net.IPEndPoint([IPAddress]::Parse($Address), $Port); } $TCPSocket = New-Object 'System.Net.Sockets.TcpListener' $ListenAddress; Write-IcingaDebugMessage -Message ( [string]::Format( 'Creating new TCP socket on Port {0}. Endpoint configuration {1}', $Port, $TCPSocket.LocalEndpoint ) ); if ($Start) { Write-IcingaDebugMessage -Message ( [string]::Format( 'Starting TCP socket for endpoint {0}', $TCPSocket.LocalEndpoint ) ); $TCPSocket.Start(); } return $TCPSocket; }
26.214286
95
0.5604
cc4f6c09bfaae493a9692ddf2d80fed3afc48ae1
226
rb
Ruby
lib/poke_api/move_battle_style.rb
archbloom/poke-api-v2
65ac612d28e26242e49541429f94be4823d7758c
[ "MIT" ]
28
2019-05-07T18:30:29.000Z
2022-02-28T10:30:56.000Z
lib/poke_api/move_battle_style.rb
archbloom/poke-api-v2
65ac612d28e26242e49541429f94be4823d7758c
[ "MIT" ]
73
2019-03-03T17:45:45.000Z
2022-02-27T19:34:41.000Z
lib/poke_api/move_battle_style.rb
archbloom/poke-api-v2
65ac612d28e26242e49541429f94be4823d7758c
[ "MIT" ]
3
2020-10-13T07:56:34.000Z
2022-02-24T14:39:20.000Z
module PokeApi # MoveBattleStyle object handling all data fetched from /move-battle-style class MoveBattleStyle < NamedApiResource attr_reader :names def initialize(data) assign_data(data) end end end
20.545455
76
0.743363
6d281dae0e7847fcdadbbec644722435f0f37d8f
559
kt
Kotlin
app/src/main/java/org/traccar/client/utils/networkutils/Resources.kt
ilhamhadisyah/ceria-nugraha-indotama-fms
429efeaf55dd468c9b9434ce7a6dec789027d5a9
[ "Apache-2.0" ]
null
null
null
app/src/main/java/org/traccar/client/utils/networkutils/Resources.kt
ilhamhadisyah/ceria-nugraha-indotama-fms
429efeaf55dd468c9b9434ce7a6dec789027d5a9
[ "Apache-2.0" ]
null
null
null
app/src/main/java/org/traccar/client/utils/networkutils/Resources.kt
ilhamhadisyah/ceria-nugraha-indotama-fms
429efeaf55dd468c9b9434ce7a6dec789027d5a9
[ "Apache-2.0" ]
null
null
null
package org.traccar.client.utils.networkutils data class Resources<out T>(val status: Status, val data: T?, val message: String?) { companion object { fun <T> success(data: T): Resources<T> = Resources(status = Status.SUCCESS, data = data, message = null) fun <T> error(data: T?, message: String?): Resources<T> = Resources(status = Status.ERROR, data = data, message = message) fun <T> loading(data: T?): Resources<T> = Resources(status = Status.LOADING, data = data, message = null) } }
39.928571
85
0.620751
0dc079c53443f6952f757ea2a4a9e2cdaa92a248
1,626
rb
Ruby
test/ractor/tvar_test.rb
ko1/ractor-tvar
e57244747ef75df0c71b223bb28585a67a643720
[ "MIT" ]
54
2020-11-18T22:38:18.000Z
2022-03-18T18:31:12.000Z
test/ractor/tvar_test.rb
ko1/ractor_tvar
e57244747ef75df0c71b223bb28585a67a643720
[ "MIT" ]
3
2020-11-20T09:24:48.000Z
2021-02-04T12:50:21.000Z
test/ractor/tvar_test.rb
ko1/ractor_tvar
e57244747ef75df0c71b223bb28585a67a643720
[ "MIT" ]
1
2020-12-14T23:24:49.000Z
2020-12-14T23:24:49.000Z
# frozen_string_literal: true require "test_helper" class Ractor::TVarTest < Test::Unit::TestCase test "VERSION" do assert do ::Ractor::TVar.const_defined?(:VERSION) end end test 'Ractor::TVar can has a value' do tv = Ractor::TVar.new(1) assert_equal 1, tv.value end test 'Ractor::TVar without initial value will return nil' do tv = Ractor::TVar.new assert_equal nil, tv.value end test 'Ractor::TVar can change the value' do tv = Ractor::TVar.new assert_equal nil, tv.value Ractor::atomically do tv.value = :ok end assert_equal :ok, tv.value end test 'Ractor::TVar update without atomically will raise an exception' do tv = Ractor::TVar.new assert_raise Ractor::TransactionError do tv.value = :ng end end test 'Ractor::TVar#increment increments the value' do tv = Ractor::TVar.new(0) tv.increment assert_equal 1, tv.value tv.increment 2 assert_equal 3, tv.value Ractor::atomically do tv.increment 3 end assert_equal 6, tv.value Ractor::atomically do tv.value = 1.5 end tv.increment(-1.5) assert_equal 0.0, tv.value end test 'Ractor::TVar can not set the unshareable value' do assert_raise ArgumentError do Ractor::TVar.new [1] end end ## with Ractors N = 10_000 test 'Ractor::TVar consistes with other Ractors' do tv = Ractor::TVar.new(0) rs = 4.times.map{ Ractor.new tv do |tv| N.times{ Ractor::atomically{ tv.increment } } end } rs.each{|r| r.take} assert_equal N * 4 , tv.value end end
21.116883
74
0.644526
7f8ac65a94b2f720a75b9dc72e3e48db0284f6db
3,752
php
PHP
src/Controller/Stations/RemotesController.php
CodeSteele/AzuraCast
862bafbebe14f4166429c3ef721c8dd1d0989a78
[ "Apache-2.0" ]
1
2019-03-30T18:31:41.000Z
2019-03-30T18:31:41.000Z
src/Controller/Stations/RemotesController.php
CodeSteele/AzuraCast
862bafbebe14f4166429c3ef721c8dd1d0989a78
[ "Apache-2.0" ]
2
2021-03-11T01:59:58.000Z
2021-05-06T16:21:26.000Z
src/Controller/Stations/RemotesController.php
CodeSteele/AzuraCast
862bafbebe14f4166429c3ef721c8dd1d0989a78
[ "Apache-2.0" ]
null
null
null
<?php namespace App\Controller\Stations; use Doctrine\ORM\EntityManager; use App\Entity; use App\Http\Request; use App\Http\Response; use Psr\Http\Message\ResponseInterface; class RemotesController { /** @var EntityManager */ protected $em; /** @var string */ protected $csrf_namespace = 'stations_remotes'; /** @var array */ protected $form_config; /** * @param EntityManager $em * @param array $form_config * @see \App\Provider\StationsProvider */ public function __construct(EntityManager $em, array $form_config) { $this->em = $em; $this->form_config = $form_config; } public function indexAction(Request $request, Response $response): ResponseInterface { $station = $request->getStation(); return $request->getView()->renderToResponse($response, 'stations/remotes/index', [ 'remotes' => $station->getRemotes(), 'csrf' => $request->getSession()->getCsrf()->generate($this->csrf_namespace), ]); } public function editAction(Request $request, Response $response, $station_id, $id = null): ResponseInterface { $station = $request->getStation(); /** @var \Azura\Doctrine\Repository $remote_repo */ $remote_repo = $this->em->getRepository(Entity\StationRemote::class); $form = new \AzuraForms\Form($this->form_config); if (!empty($id)) { $record = $remote_repo->findOneBy([ 'id' => $id, 'station_id' => $station_id, ]); $form->populate($remote_repo->toArray($record)); } else { $record = null; } if (!empty($_POST) && $form->isValid($_POST)) { $data = $form->getValues(); if (!($record instanceof Entity\StationRemote)) { $record = new Entity\StationRemote($station); } $remote_repo->fromArray($record, $data); $this->em->persist($record); $uow = $this->em->getUnitOfWork(); $uow->computeChangeSets(); if ($uow->isEntityScheduled($record)) { $station->setNeedsRestart(true); $this->em->persist($station); } $this->em->flush(); $this->em->refresh($station); $request->getSession()->flash('<b>' . sprintf(($id) ? __('%s updated.') : __('%s added.'), __('Remote Relay')) . '</b>', 'green'); return $response->withRedirect($request->getRouter()->fromHere('stations:remotes:index')); } return $request->getView()->renderToResponse($response, 'stations/remotes/edit', [ 'form' => $form, 'render_mode' => 'edit', 'title' => sprintf(($id) ? __('Edit %s') : __('Add %s'), __('Remote Relay')) ]); } public function deleteAction(Request $request, Response $response, $station_id, $id, $csrf_token): ResponseInterface { $request->getSession()->getCsrf()->verify($csrf_token, $this->csrf_namespace); $station = $request->getStation(); $record = $this->em->getRepository(Entity\StationRemote::class)->findOneBy([ 'id' => $id, 'station_id' => $station_id ]); if ($record instanceof Entity\StationRemote) { $this->em->remove($record); } $station->setNeedsRestart(true); $this->em->persist($station); $this->em->flush(); $this->em->refresh($station); $request->getSession()->flash('<b>' . __('%s deleted.', __('Remote Relay')) . '</b>', 'green'); return $response->withRedirect($request->getRouter()->fromHere('stations:remotes:index')); } }
31.266667
142
0.560501
26798b9a1958b2473bc3e8ec01dd45567e2321d0
575
swift
Swift
HellowViper/Sources/Modules/List/ListRouter.swift
Ericliu001/HelloViper
b7462e506aabd22c3890f0c8fb76bff789185541
[ "Apache-2.0" ]
null
null
null
HellowViper/Sources/Modules/List/ListRouter.swift
Ericliu001/HelloViper
b7462e506aabd22c3890f0c8fb76bff789185541
[ "Apache-2.0" ]
null
null
null
HellowViper/Sources/Modules/List/ListRouter.swift
Ericliu001/HelloViper
b7462e506aabd22c3890f0c8fb76bff789185541
[ "Apache-2.0" ]
null
null
null
// // Created by Eric Liu on 7/28/18. // Copyright (c) 2018 eric.liu. All rights reserved. // import Foundation import UIKit protocol ListRouter: AnyObject { var presenter: ListPresenter? { get set } var viewController: UIViewController? { get set } func route(for: Int) } class ListRouterImpl: ListRouter { weak var presenter: ListPresenter? weak var viewController: UIViewController? func route(for: Int) { let detailViewController = DetailBuilder().main() self.viewController?.show(detailViewController, sender: nil) } }
21.296296
68
0.697391
bdc581328a02741a08f64628a1b24e7ac101869b
1,065
rb
Ruby
lib/rails_admin/config/actions/job.rb
qinjunquan/rails_admin
a45e935ca7b8f285a2c4a1475d137a70fd800677
[ "MIT" ]
null
null
null
lib/rails_admin/config/actions/job.rb
qinjunquan/rails_admin
a45e935ca7b8f285a2c4a1475d137a70fd800677
[ "MIT" ]
null
null
null
lib/rails_admin/config/actions/job.rb
qinjunquan/rails_admin
a45e935ca7b8f285a2c4a1475d137a70fd800677
[ "MIT" ]
null
null
null
module RailsAdmin module Config module Actions class Job < RailsAdmin::Config::Actions::Base RailsAdmin::Config::Actions.register(self) register_instance_option :collection do true end register_instance_option :breadcrumb_parent do [:dashboard] end register_instance_option :controller do proc do @job_config = RailsAdmin::Config::Job.find(params[:kind].camelcase) if request.post? job = RaJob.create(:name => @job_config.class_name) job.set_params!(params["search"]) job.start! redirect_to "/admin/jobs/#{@job_config.class_name.underscore}/#{job.id}" elsif params[:id].present? @job = RaJob.find(params[:id]) render "rails_admin/main/jobs/show", layout: "rails_admin/application" else render "rails_admin/main/jobs/new", layout: "rails_admin/application" end end end end end end end
30.428571
86
0.58216
a8777e64b89ffe903285bc31dc2b68c8eadf93cb
91
sql
SQL
src/test/resources/speed1p.test_3.sql
jdkoren/sqlite-parser
9adf75ff5eca36f6e541594d2e062349f9ced654
[ "MIT" ]
131
2015-03-31T18:59:14.000Z
2022-03-09T09:51:06.000Z
src/test/resources/speed1p.test_3.sql
jdkoren/sqlite-parser
9adf75ff5eca36f6e541594d2e062349f9ced654
[ "MIT" ]
20
2015-03-31T21:35:38.000Z
2018-07-02T16:15:51.000Z
src/test/resources/speed1p.test_3.sql
jdkoren/sqlite-parser
9adf75ff5eca36f6e541594d2e062349f9ced654
[ "MIT" ]
43
2015-04-28T02:01:55.000Z
2021-06-06T09:33:38.000Z
-- speed1p.test -- -- db eval {INSERT INTO t1 VALUES(i,r,x)} INSERT INTO t1 VALUES(i,r,x)
18.2
41
0.648352
eb34b49c208ccf3348b27cae9b9538f8d41a631a
8,644
css
CSS
data/usercss/115043.user.css
33kk/uso-archive
2c4962d1d507ff0eaec6dcca555efc531b37a9b4
[ "MIT" ]
118
2020-08-28T19:59:28.000Z
2022-03-26T16:28:40.000Z
data/usercss/115043.user.css
33kk/uso-archive
2c4962d1d507ff0eaec6dcca555efc531b37a9b4
[ "MIT" ]
38
2020-09-02T01:08:45.000Z
2022-01-23T02:47:24.000Z
data/usercss/115043.user.css
33kk/uso-archive
2c4962d1d507ff0eaec6dcca555efc531b37a9b4
[ "MIT" ]
21
2020-08-19T01:12:43.000Z
2022-03-15T21:55:17.000Z
/* ==UserStyle== @name Black n' Orange @namespace USO Archive @author Jo2uke @description `A dark theme for Tinyboard/Vichan based imageboards. Based on https://userstyles.org/styles/106386/tinyboard-dark-patterns` @version 20150702.7.53 @license CC0-1.0 @preprocessor uso ==/UserStyle== */ @-moz-document domain(8ch.net), domain(55ch.org){ body { background: url("http://i.imgur.com/f3veYKD.png") repeat rgb(0, 0, 0); } body { color: rgb(205, 205, 205) !important; } #options_div textarea { height: 88%; width: 98% !important; } div.post.reply .full-image{ max-width: 100% !important;} input, textarea{ outline: none;} img.board_image { display: block; border: 0px solid #a9a9a9;} div.post.reply { background: none repeat scroll 0% 0% rgba(33, 33, 33, 0.5) !important; border-right: 20px !important; border-bottom: 5px !important; border-style: none solid solid none !important; border-color: rgba(0, 0, 0, 0) !important; display: inline-block; max-width: 94%!important; } div.boardlist a.popular { color: #FADC97 !important; font-weight: bold;} video { min-width: 350px; } a:visited:hover, a:hover, .dropzone .remove-btn:hover{ color: #FFCC54!important; } span.spoiler { background: rgba(255,255,255,0.2); color: transparent; padding: 0 1px; } span.spoiler:hover { background: rgba(255,181,5,1); color: black; padding: 0 1px; } .dropzone, .file-hint { color: white !important; background-color:rgba(34, 34, 34, 1); max-height: 400px; margin: 0px 5px 0px 0px !important; border: 0px dashed rgba(125, 125, 125, 0.4) !important; } audio { width: 300px; height: 30px; background: transparent; } #quick-reply .dropzone, #quick-reply .file-hint { color: white !important; background-color:rgba(34, 34, 34, 1); max-height: 400px; margin: 0px 0px 0px 0px !important; border: 0px dashed rgba(125, 125, 125, 0.4) !important; } time { color: white; font-weight: normal; } div.blotter { color: white; } span.heading { color: #FFCC54!important; font-style: bold; font-size: 13pt; } a { color: #DC9D06; } tr:nth-child(2n) { background-color: rgba(33, 33, 33, 0) !important; } div.post.reply.post-hover { background: rgba(33, 33, 33, 0.8) !important; } div.post.reply.highlighted { background: rgba(77, 77, 77, 0.5) !important; } .theme-catalog div.thread { border: 0px transparent !important; background: rgba(33, 33, 33, 0.5); color: white; } .theme-catalog div.thread:hover { border: 0px transparent !important; color: white; background: none repeat scroll 0% 0% rgba(33, 33, 33, 0.7)!important; } #options_div, #alert_div { background-color: #101010 !important; border: 0px; } #options_div { width: 900px; height: 650px; } #options_tablist { border: 0px; } a,a:visited, p.intro, .dropzone .remove-btn { text-decoration: none !important; color: rgba(255, 181, 5, 1) !important; font-weight: normal; } div.boardlist.bottom { background-color: transparent !important;} textarea { background: #222222; color: white; border: 0px !important; width: 97% } #options_handler { border: 0px !important; } div.delete { padding: 3px;} span.name { text-decoration: none !important; color: white !important; } div.boardlist { background-color: rgb(33, 33, 33) !important; } p.intro { color: #117743 !important; font-weight: bold !important; } #quick-reply th { text-align: center; padding: 2px 0; border: 0px solid #222 !important; } span.quote { color: #047A00 !important; } #quick-reply td, #quick-reply th { border-collapse: collapse; background: #161616 none repeat scroll 0% 0% !important; margin: 0px; padding: 3px; } p.intro span.subject { color: rgba(43, 201, 95, 1) !important; } td { background-color: #161616;} #quick-reply table { background: #161616 !important; border-style: none solid solid none; border-color: rgb(22, 22, 22); border-width: 7px 1px 5px 5px !important; margin: 0; width: 100%; } .post-table, .post-table-options { background:#161616; } .options_tab h2 { font-size: 24px; color: #033; background: #101010 none repeat scroll 0% 0%; margin: 0px; } #quick-reply td { padding: 3px !important; border: 0px !important; } #quick-reply textarea, input { background: #222222; border: 0px !important; color: white; } #quick-reply textarea{ min-width: 500px !important; min-height: 200px;} .options_tab, #options_tablist { background-color: #101010 !important; } header div.subtitle, h1 { color: #FFB505; } div.boardlist { color: #89A !important; font-size: 10pt !important; } header, .content_menu, .button { background-color: transparent !important; } table.modlog tr th { background: none repeat scroll 0% 0% #212121 !important; } .theme-catalog div.thread:hover { background: none repeat scroll 0% 0% #212121 !important; border-color: #B7C5D9 !important; } .intro a.email span.name { color: #DA1515!important; } div.pages { color: #CDC6BA !important; background: #212121 !important; display: inline !important; padding: 8px !important; border-right: 1px solid #212121 !important; border-bottom: 1px solid #212121 !important; } form table tr th { background: #161616 !important; } form table input { height: auto; margin: -1px 3px 0px 0px !important; } style div.boardlist:nth-child(1) { border-bottom: 0px solid !important; } div.post.op { margin-right: 20px !important; margin-bottom: 5px !important; } div.ban h2 { background: #212121 !important; color: white !important; font-size: 12pt !important; } .options_tab_icon.active, h2 { color: rgba(255, 181, 0, 1) !important; } div.banner { background-color: transparent; color: #FFB500 !important; } .options_tab_icon { color: #FADC97; } div.ban { background: white !important; border: 0px solid #98E !important; max-width: 700px !important; margin: 30px auto !important; } pre.prettyprint { padding: 10px; border: 0px solid #888 !important; background: rgba(0,0,0,0.45) !important; display: inline-block !important; } span.pln { color: white; } span.pun { color: yellow; } span.lit { color: #169281; } span.kwd { color: #3879D9; } div.ban p { font-size: 12px !important; margin-bottom: 12px !important; color: black !important; } body > div.ban { color: black !important; } .banlist-opts .checkboxes label { display: block; color: white !important; } tr.tblhead > th { color: white !important; } user agent stylesheetstrong, b { font-weight: bold !important; } #banlist td:hover { overflow: visible !important; height: auto !important; background-color: #212121 !important; z-index: 1 !important; position: relative !important; border: 1px solid black !important; padding: 1px !important; color: white !important; } #content > div.col.col-9.bodyCol > div > table > tbody > tr:nth-child(2) { background-color: #212121 !important; } table tbody tr:nth-of-type( even) { background-color: #101010 !important; } .desktop-style div.boardlist:not(.bottom) { border-bottom: 0px solid !important; } .post-menu ul { background-color: rgba(33, 33, 33, 0.5) !important; border: 0px solid #666 !important; } #options_div, #alert_div { background-color: #101010; } .cb-menuitem { display: table-row; } .cb-menuitem span { padding: 5px; display: table-cell; text-align: left; border-top: 1px solid rgba(0,0,0,0.5); } .inline { border: 0px solid rgba(124, 216, 187, 0) !important; white-space: normal; overflow: auto; background: rgba(255,255,255,0.05); padding: 10px; } }
20.778846
140
0.599375
146bb45bdb3bc0a635376906332da0d712a2778f
370
ts
TypeScript
lib/types/button/script.d.ts
oeway/vue-window
d7317810341256249b0c8a3ec9cfe4969442a0da
[ "MIT" ]
1
2021-02-09T21:42:11.000Z
2021-02-09T21:42:11.000Z
lib/types/button/script.d.ts
oeway/vue-window
d7317810341256249b0c8a3ec9cfe4969442a0da
[ "MIT" ]
null
null
null
lib/types/button/script.d.ts
oeway/vue-window
d7317810341256249b0c8a3ec9cfe4969442a0da
[ "MIT" ]
null
null
null
import { WindowStyle } from "../style"; import { Vue } from "vue-property-decorator"; export declare class Button extends Vue { windowStyle: WindowStyle; disabled: boolean; hover: boolean; active: boolean; readonly style: Partial<CSSStyleDeclaration>; mousedown(e: MouseEvent & TouchEvent): void; mouseup(e: MouseEvent & TouchEvent): void; }
30.833333
49
0.702703
dfa8a3c4e49142c77b92d3f2ff6c95f13c97a1f8
473
cs
C#
Exam-SharedTrip/SharedTrip/ViewModels/Trips/TripAddInputModel.cs
nvgeorgiev/Csharp-Web
05983b398717bbb388d845edcd7a65f0d4583be5
[ "MIT" ]
null
null
null
Exam-SharedTrip/SharedTrip/ViewModels/Trips/TripAddInputModel.cs
nvgeorgiev/Csharp-Web
05983b398717bbb388d845edcd7a65f0d4583be5
[ "MIT" ]
null
null
null
Exam-SharedTrip/SharedTrip/ViewModels/Trips/TripAddInputModel.cs
nvgeorgiev/Csharp-Web
05983b398717bbb388d845edcd7a65f0d4583be5
[ "MIT" ]
null
null
null
namespace SharedTrip.ViewModels.Trips { using System; public class TripAddInputModel { public string StartPoint { get; set; } public string EndPoint { get; set; } public DateTime DepartureTime { get; set; } // Server might not be able to map DateTime. If error occurs change it to string. public string ImagePath { get; set; } public int Seats { get; set; } public string Description { get; set; } } }
23.65
133
0.630021
cdadd154526bfdbd53a211a80c1ca1fa2c77df3a
254
cs
C#
src/Lib/CommonLibrary.NET/_Core/Lang/_Core/IFunction.cs
joelverhagen/Knapcode.CommonLibrary.NET
ad562c9111136dc273a7fe192f9a670ab8207201
[ "MIT" ]
1
2021-06-15T09:20:31.000Z
2021-06-15T09:20:31.000Z
src/Lib/CommonLibrary.NET/_Core/Lang/_Core/IFunction.cs
joelverhagen/Knapcode.CommonLibrary.NET
ad562c9111136dc273a7fe192f9a670ab8207201
[ "MIT" ]
null
null
null
src/Lib/CommonLibrary.NET/_Core/Lang/_Core/IFunction.cs
joelverhagen/Knapcode.CommonLibrary.NET
ad562c9111136dc273a7fe192f9a670ab8207201
[ "MIT" ]
null
null
null
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ComLib.Core.Core { /// <summary> /// Interface for a plugin that acts as a function. /// </summary> interface IPluginFunction { } }
16.933333
55
0.665354
ec18840231bd32d722372c3689876a6cc7535229
552
lua
Lua
example/counter/lua/simulation.lua
weberja/sydevs-yaml
ee80f25473513befa4f64d3f181604c5f33dd449
[ "Apache-2.0" ]
1
2021-02-18T17:06:34.000Z
2021-02-18T17:06:34.000Z
example/counter/lua/simulation.lua
weberja/sydevs-yaml
ee80f25473513befa4f64d3f181604c5f33dd449
[ "Apache-2.0" ]
null
null
null
example/counter/lua/simulation.lua
weberja/sydevs-yaml
ee80f25473513befa4f64d3f181604c5f33dd449
[ "Apache-2.0" ]
null
null
null
counter = 0 micro_counter = 0 function macro_initialization_event() -- ports:set_port("init",any.new(2.0)) return duration.new(1, scales["unit"]) end function micro_planned_event(agentID, elapsed_dt) micro_counter = micro_counter + elapsed_dt:to_int() print(agentID .. " was updated at" .. micro_counter) end function macro_planned_event(elapsed_dt) print("PING") counter = counter + elapsed_dt:to_number() print(counter) return duration.new(1) end function macro_finalization_event(elapsed_dt) print("DONE") end
24
56
0.731884
6df0ead2716c951beabc537457e46c619fd37ff4
2,946
h
C
modules/audio_processing/agc2/vad_wrapper.h
wyshen2020/webrtc
b93e2240f1653b82e24553e092bbab84337774af
[ "BSD-3-Clause" ]
27
2020-04-06T09:52:44.000Z
2022-03-17T19:07:12.000Z
modules/audio_processing/agc2/vad_wrapper.h
wyshen2020/webrtc
b93e2240f1653b82e24553e092bbab84337774af
[ "BSD-3-Clause" ]
1
2021-02-18T00:57:11.000Z
2021-02-18T00:57:11.000Z
modules/audio_processing/agc2/vad_wrapper.h
wyshen2020/webrtc
b93e2240f1653b82e24553e092bbab84337774af
[ "BSD-3-Clause" ]
13
2020-05-06T01:47:27.000Z
2022-02-02T21:47:28.000Z
/* * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef MODULES_AUDIO_PROCESSING_AGC2_VAD_WRAPPER_H_ #define MODULES_AUDIO_PROCESSING_AGC2_VAD_WRAPPER_H_ #include <memory> #include <vector> #include "api/array_view.h" #include "common_audio/resampler/include/push_resampler.h" #include "modules/audio_processing/agc2/cpu_features.h" #include "modules/audio_processing/include/audio_frame_view.h" namespace webrtc { // Wraps a single-channel Voice Activity Detector (VAD) which is used to analyze // the first channel of the input audio frames. Takes care of resampling the // input frames to match the sample rate of the wrapped VAD and periodically // resets the VAD. class VoiceActivityDetectorWrapper { public: // Single channel VAD interface. class MonoVad { public: virtual ~MonoVad() = default; // Returns the sample rate (Hz) required for the input frames analyzed by // `ComputeProbability`. virtual int SampleRateHz() const = 0; // Resets the internal state. virtual void Reset() = 0; // Analyzes an audio frame and returns the speech probability. virtual float Analyze(rtc::ArrayView<const float> frame) = 0; }; // Ctor. `vad_reset_period_ms` indicates the period in milliseconds to call // `MonoVad::Reset()`; it must be equal to or greater than the duration of two // frames. Uses `cpu_features` to instantiate the default VAD. VoiceActivityDetectorWrapper(int vad_reset_period_ms, const AvailableCpuFeatures& cpu_features, int sample_rate_hz); // Ctor. Uses a custom `vad`. VoiceActivityDetectorWrapper(int vad_reset_period_ms, std::unique_ptr<MonoVad> vad, int sample_rate_hz); VoiceActivityDetectorWrapper(const VoiceActivityDetectorWrapper&) = delete; VoiceActivityDetectorWrapper& operator=(const VoiceActivityDetectorWrapper&) = delete; ~VoiceActivityDetectorWrapper(); // Initializes the VAD wrapper. void Initialize(int sample_rate_hz); // Analyzes the first channel of `frame` and returns the speech probability. // `frame` must be a 10 ms frame with the sample rate specified in the last // `Initialize()` call. float Analyze(AudioFrameView<const float> frame); private: const int vad_reset_period_frames_; int frame_size_; int time_to_vad_reset_; PushResampler<float> resampler_; std::unique_ptr<MonoVad> vad_; std::vector<float> resampled_buffer_; }; } // namespace webrtc #endif // MODULES_AUDIO_PROCESSING_AGC2_VAD_WRAPPER_H_
37.291139
80
0.729124
7f92e3fd40a027526ac29f1bb0be28a9744b54f0
812
php
PHP
src/Persister/PersisterRegistry.php
dgstudio-cz/imagist
60cd98ee7dac08b459fddf5e79cda97d83072d89
[ "MIT" ]
null
null
null
src/Persister/PersisterRegistry.php
dgstudio-cz/imagist
60cd98ee7dac08b459fddf5e79cda97d83072d89
[ "MIT" ]
null
null
null
src/Persister/PersisterRegistry.php
dgstudio-cz/imagist
60cd98ee7dac08b459fddf5e79cda97d83072d89
[ "MIT" ]
null
null
null
<?php declare(strict_types = 1); namespace Contributte\Imagist\Persister; use Contributte\Imagist\Context\Context; use Contributte\Imagist\Entity\ImageInterface; use Contributte\Imagist\Exceptions\InvalidArgumentException; final class PersisterRegistry implements PersisterRegistryInterface { /** @var PersisterInterface[] */ private array $persisters = []; public function add(PersisterInterface $persister): void { $this->persisters[] = $persister; } public function persist(ImageInterface $image, Context $context): ImageInterface { foreach ($this->persisters as $persister) { if ($persister->supports($image, $context)) { return $persister->persist($image, $context); } } throw new InvalidArgumentException(sprintf('Persist not found for class %s', get_class($image))); } }
25.375
99
0.75
f0143bd3ed561d0dfb0348516e68bf8dbb769f62
5,723
lua
Lua
lib/shapes/pentagon.lua
cjmartin20/Learning-Modules
589588d3cbc8270f0412fccc3cc9a422a0eab8fa
[ "MIT" ]
1
2020-09-13T21:37:19.000Z
2020-09-13T21:37:19.000Z
lib/shapes/pentagon.lua
cjmartin20/Learning-Modules
589588d3cbc8270f0412fccc3cc9a422a0eab8fa
[ "MIT" ]
1
2020-07-09T11:06:24.000Z
2020-07-09T11:06:24.000Z
lib/shapes/pentagon.lua
cjmartin20/Learning-Modules
589588d3cbc8270f0412fccc3cc9a422a0eab8fa
[ "MIT" ]
null
null
null
<<<<<<< HEAD ---------------------------------------------------------------------------------------- --pentagon.lua Creates Pentagon Object ---------------------------------------------------------------------------------------- local pentagon = { object = nil, originalColor = { Red = 0, Green = 0, Blue = 0}, hasAttribute = nil, inPosition = nil, "pentagon", "5 sides", "5 vertices", "polygon" } local useAttributes = require "attributes" function pentagon.createPentagon( x, y, scaler, currentAttribute ) x = x or display.contentCenterX y = y or display.contentCenterY scaler = scaler * 11 or 11 local pentagonShape = { 0,-6*scaler, -7*scaler,-2*scaler, -4*scaler,5*scaler, 4*scaler,5*scaler, 7*scaler,-2*scaler } pentagon.object = display.newPolygon( x, y, pentagonShape ) Red = 0 Green = 5 Blue = 5 pentagon.originalColor.Red = Red pentagon.originalColor.Green = Green pentagon.originalColor.Blue = Blue pentagon.object:setFillColor( Red, Green, Blue ) -- fill the pentagon with color pentagon.object.strokeWidth = 0.016 * display.contentWidth -- Sets the width of the border of pentagon --Set Stroke color pentagon.object:setStrokeColor( 128, 0, 128 ) -- Sets the border color pentagon.object:addEventListener( "touch", pentagon.move ) pentagon.object.alpha = 0.7 --pentagon opacity --check if pentagon has attributes.currentAttribute (in attributes.lua table) print( "Checking pentagon Attributes" ) local test = false for index, attribute in ipairs(pentagon) do print("checking ", index, attribute) if attribute == currentAttribute then test = true print("pentagon Has Attribute") end end pentagon.hasAttribute = test --initialize attributes.hasAttribute if no value set it to true return pentagon end --createPentagon function --Move shapes function function pentagon.move( event ) --eventt.target comes from EventListener and is the object the "touch" is targeting local object = event.target local touchDistance = object.width --Move shape if math.abs( object.x - event.x ) < touchDistance and math.abs( object.y - event.y ) < touchDistance then object.x = event.x object.y = event.y end --Change color if pentagon is in position and has attribute if useAttributes.isShapeWithinRadius( object, .85 * display.contentCenterX, display.contentCenterX, display.contentCenterY) then if pentagon.hasAttribute then --change color to green object:setFillColor( 0, 128 , 0) else --change color to red object:setFillColor( 128, 0 , 0 ) end pentagon.inPosition = true else object:setFillColor( pentagon.originalColor.Red, pentagon.originalColor.Green, pentagon.originalColor.Blue ) pentagon.inPosition = false end end --end move function ======= ---------------------------------------------------------------------------------------- --pentagon.lua Creates Pentagon Object ---------------------------------------------------------------------------------------- local pentagon = { object = nil, originalColor = { Red = 0, Green = 0, Blue = 0}, hasAttribute = nil, inPosition = false, "pentagon", "5 sides", "5 vertices", "polygon" } local useAttributes = require "attributes" function pentagon.createPentagon( x, y, scaler, currentAttribute ) x = x or display.contentCenterX y = y or display.contentCenterY scaler = scaler * 11 or 11 local pentagonShape = { 0,-6*scaler, -7*scaler,-2*scaler, -4*scaler,5*scaler, 4*scaler,5*scaler, 7*scaler,-2*scaler } pentagon.object = display.newPolygon( x, y, pentagonShape ) Red = 0 Green = 5 Blue = 5 pentagon.originalColor.Red = Red pentagon.originalColor.Green = Green pentagon.originalColor.Blue = Blue pentagon.object:setFillColor( Red, Green, Blue ) -- fill the pentagon with color pentagon.object.strokeWidth = 0.016 * display.contentWidth -- Sets the width of the border of pentagon --Set Stroke color pentagon.object:setStrokeColor( 128, 0, 128 ) -- Sets the border color pentagon.object:addEventListener( "touch", pentagon.move ) pentagon.object.alpha = 0.7 --pentagon opacity --check if pentagon has attributes.currentAttribute (in attributes.lua table) print( "Checking pentagon Attributes" ) local test = false for index, attribute in ipairs(pentagon) do print("checking ", index, attribute) if attribute == currentAttribute then test = true print("pentagon Has Attribute") end end pentagon.hasAttribute = test --initialize attributes.hasAttribute if no value set it to true return pentagon end --createPentagon function --Move shapes function function pentagon.move( event ) --eventt.target comes from EventListener and is the object the "touch" is targeting local object = event.target local touchDistance = object.width --Move shape if math.abs( object.x - event.x ) < touchDistance and math.abs( object.y - event.y ) < touchDistance then object.x = event.x object.y = event.y end --Change color if pentagon is in position and has attribute if useAttributes.isShapeWithinRadius( object, .85 * display.contentCenterX, display.contentCenterX, display.contentCenterY) then if pentagon.hasAttribute then --change color to green object:setFillColor( 0, 128 , 0) else --change color to red object:setFillColor( 128, 0 , 0 ) end pentagon.inPosition = true else object:setFillColor( pentagon.originalColor.Red, pentagon.originalColor.Green, pentagon.originalColor.Blue ) pentagon.inPosition = false end end --end move function >>>>>>> windows_testing return pentagon
38.153333
130
0.664162
f165239f025cd841424860a1f67fe50a9309843c
7,049
swift
Swift
TradeItIosTicketSDK2/TradeItSDK.swift
VladimirLafazan/TradeItIosTicketSDK2
687c6337d454596414a489a1227129fa32dd7c28
[ "Apache-2.0" ]
38
2016-10-21T02:16:06.000Z
2022-01-03T02:46:24.000Z
TradeItIosTicketSDK2/TradeItSDK.swift
VladimirLafazan/TradeItIosTicketSDK2
687c6337d454596414a489a1227129fa32dd7c28
[ "Apache-2.0" ]
131
2016-10-12T16:02:57.000Z
2020-05-24T20:38:18.000Z
TradeItIosTicketSDK2/TradeItSDK.swift
VladimirLafazan/TradeItIosTicketSDK2
687c6337d454596414a489a1227129fa32dd7c28
[ "Apache-2.0" ]
29
2016-11-04T19:42:45.000Z
2021-09-21T20:27:47.000Z
import UIKit @objc public class TradeItSDK: NSObject { // MARK: Settable properties @objc public static var theme: TradeItTheme = TradeItTheme.light() @objc public static var isPortfolioEnabled = true @objc public static var isAdServiceEnabled = false @objc public static var userCountryCode: String? // CountryCode matching standard: ISO3166 alpha-2. Used for managing broker availability. @objc public static var adService: AdService = DefaultAdService() @objc public static var welcomeScreenHeadlineText: String = "Link your broker account to enable:" @objc public static var featuredBrokerLabelText: String = "SPONSORED BROKER" @objc public static var activityViewFactory: ActivityIndicatorFactory = DefaultActivityIndicatorFactory() @objc public static var debug: Bool = false // MARK: Non-settable properties internal static var brokerLogoService = TradeItBrokerLogoService() private static var configured = false @objc public static let launcher = TradeItLauncher() @objc public static let yahooLauncher = TradeItYahooLauncher() @available(*, deprecated, message: "Use TradeItNotification.Name.didLink (Swift) or TradeItNotificationConstants.nameDidLink (Obj-C) instead.") @objc public static var didLinkNotificationName: NSNotification.Name { get { return TradeItNotification.Name.didLink } } @available(*, deprecated, message: "Use TradeItNotification.Name.didUnlink (Swift) or TradeItNotificationConstants.nameDidUnlink (Obj-C) instead.") @objc public static var didUnlinkNotificationName: NSNotification.Name { get { return TradeItNotification.Name.didUnlink } } internal static let linkedBrokerCache = TradeItLinkedBrokerCache() private static var _apiKey: String? @objc public static var apiKey: String { get { precondition(self._apiKey != nil, "ERROR: TradeItSDK.apiKey accessed before calling TradeItSDK.configure()!") return self._apiKey! } } private static var _environment: TradeitEmsEnvironments? @objc public static var environment: TradeitEmsEnvironments { get { precondition(self._environment != nil, "ERROR: TradeItSDK.environment accessed before calling TradeItSDK.configure()!") return self._environment! } } internal static var _linkedBrokerManager: TradeItLinkedBrokerManager? @objc public static var linkedBrokerManager: TradeItLinkedBrokerManager { get { precondition(self._linkedBrokerManager != nil, "ERROR: TradeItSDK.linkedBrokerManager referenced before calling TradeItSDK.configure()!") return self._linkedBrokerManager! } } internal static var _symbolService: TradeItSymbolService? @objc public static var symbolService: TradeItSymbolService { get { precondition(self._symbolService != nil, "ERROR: TradeItSDK.symbolService referenced before calling TradeItSDK.configure()!") return self._symbolService! } } private static var _uiConfigService: TradeItUiConfigService? internal static var uiConfigService: TradeItUiConfigService { get { precondition(self._uiConfigService != nil, "ERROR: TradeItSDK.uiConfigService referenced before calling TradeItSDK.configure()!") return self._uiConfigService! } } private static var _brokerCenterService: TradeItBrokerCenterService? @objc public static var brokerCenterService: TradeItBrokerCenterService { get { precondition(self._brokerCenterService != nil, "ERROR: TradeItSDK.brokerCenterService referenced before calling TradeItSDK.configure()!") return self._brokerCenterService! } } @objc public static var streamingMarketDataService: StreamingMarketDataService? internal static var _marketDataService: MarketDataService? @objc public static var marketDataService: MarketDataService { get { precondition(self._marketDataService != nil, "ERROR: TradeItSDK.marketDataService referenced before initializing!") return self._marketDataService! } set(new) { self._marketDataService = new } } private static var _oAuthCallbackUrl: URL? @objc public static var oAuthCallbackUrl: URL { get { precondition(self._oAuthCallbackUrl != nil, "ERROR: TradeItSDK.oAuthCallbackUrl accessed without being set in TradeItSDK.configure()!") return self._oAuthCallbackUrl! } set(new) { self._oAuthCallbackUrl = new } } private static var _isDeviceJailbroken = TradeItDeviceManager.isDeviceJailBroken() @objc public static var isDeviceJailbroken: Bool { get { return _isDeviceJailbroken } } @objc public static func set(host: String, forEnvironment env: TradeitEmsEnvironments) { TradeItRequestFactory.setHost(host, forEnvironment: env) } // MARK: Initializers @objc public static func configure( apiKey: String, oAuthCallbackUrl: URL, environment: TradeitEmsEnvironments = TradeItEmsProductionEnv ) { // We need this version of the configure method because Obj-C does not generate methods that allow for omitting optional arguments with defaults, e.g. marketDataService self.configure( apiKey: apiKey, oAuthCallbackUrl: oAuthCallbackUrl, environment: environment, marketDataService: nil, requestFactory: nil ) } @objc public static func configure( apiKey: String, oAuthCallbackUrl: URL, environment: TradeitEmsEnvironments = TradeItEmsProductionEnv, userCountryCode: String? = nil, marketDataService: MarketDataService? = nil, requestFactory: RequestFactory? = nil ) { guard !self.configured else { print("WARNING: TradeItSDK.configure() called multiple times. Ignoring.") return } self.configured = true TradeItRequestFactory.setRequestFactory(requestFactory: requestFactory ?? DefaultRequestFactory()) self._apiKey = apiKey self._environment = environment self._oAuthCallbackUrl = oAuthCallbackUrl self.userCountryCode = userCountryCode let connector = TradeItConnector(apiKey: apiKey, environment: environment, version: TradeItEmsApiVersion_2) self._linkedBrokerManager = TradeItLinkedBrokerManager(connector: connector) self._marketDataService = marketDataService ?? TradeItMarketService(connector: connector) self._symbolService = TradeItSymbolService(connector: connector) self._brokerCenterService = TradeItBrokerCenterService(apiKey: apiKey, environment: environment) self._uiConfigService = TradeItUiConfigService(connector: connector) } }
41.222222
177
0.700383
d2c2d0fdf790d1d03c4c369c8edfbbe0de83d41f
1,033
lua
Lua
lua/go/codelens.lua
markhuge/go.nvim
9036f3bf889b504a9d16971360157673d73ae7a9
[ "MIT" ]
null
null
null
lua/go/codelens.lua
markhuge/go.nvim
9036f3bf889b504a9d16971360157673d73ae7a9
[ "MIT" ]
null
null
null
lua/go/codelens.lua
markhuge/go.nvim
9036f3bf889b504a9d16971360157673d73ae7a9
[ "MIT" ]
null
null
null
local utils = require("go.utils") local codelens = require("vim.lsp.codelens") local M = {} function M.setup() vim.cmd("highlight default link LspCodeLens WarningMsg") vim.cmd("highlight default link LspCodeLensText WarningMsg") vim.cmd("highlight default link LspCodeLensTextSign LspCodeLensText") vim.cmd("highlight default link LspCodeLensTextSeparator Boolean") vim.cmd("augroup go.codelenses") vim.cmd(" autocmd!") vim.cmd('autocmd BufEnter,CursorHold,InsertLeave <buffer> lua require("go.codelens").refresh()') vim.cmd("augroup end") end function M.run_action() local guihua = utils.load_plugin("guihua.lua", "guihua.gui") local original_select = vim.ui.select if guihua then vim.ui.select = require("guihua.gui").select end codelens.run() vim.defer_fn(function() vim.ui.select = original_select end, 1000) end function M.refresh() if _GO_NVIM_CFG.lsp_codelens == false or not require("go.lsp").codelens_enabled() then return end vim.lsp.codelens.refresh() end return M
25.825
98
0.733785
0d4469ff3e482586996850d9ea256386b3c61f23
4,596
c
C
src/gcp_jwt.c
oalpay/petit_gcp
3f74d3a717aef7aa51753fb327e8ccedd82fd8c1
[ "Unlicense" ]
23
2020-12-13T18:01:59.000Z
2022-02-22T03:10:35.000Z
src/gcp_jwt.c
oalpay/petit_gcp
3f74d3a717aef7aa51753fb327e8ccedd82fd8c1
[ "Unlicense" ]
null
null
null
src/gcp_jwt.c
oalpay/petit_gcp
3f74d3a717aef7aa51753fb327e8ccedd82fd8c1
[ "Unlicense" ]
5
2020-12-13T18:58:00.000Z
2021-04-06T10:38:33.000Z
#include "gcp_jwt.h" #include <mbedtls/pk.h> #include <mbedtls/error.h> #include <mbedtls/entropy.h> #include <mbedtls/ctr_drbg.h> #include "esp_log.h" #include "esp_system.h" #include "mbedtls/base64.h" #include <string.h> #include <time.h> static const char *TAG = "GCP_JWT"; /** * Return a string representation of an mbedtls error code */ static char *mbedtlsError(int errnum) { static char buffer[200]; mbedtls_strerror(errnum, buffer, sizeof(buffer)); return buffer; } // mbedtlsError /** * Create a JWT token for GCP. * For full details, perform a Google search on JWT. However, in summary, we build two strings. One that represents the * header and one that represents the payload. Both are JSON and are as described in the GCP and JWT documentation. Next * we base64url encode both strings. Note that is distinct from normal/simple base64 encoding. Once we have a string for * the base64url encoding of both header and payload, we concatenate both strings together separated by a ".". This resulting * string is then signed using RSASSA which basically produces an SHA256 message digest that is then signed. The resulting * binary is then itself converted into base64url and concatenated with the previously built base64url combined header and * payload and that is our resulting JWT token. * @param projectId The GCP project. * @param privateKey The PEM or DER of the private key. * @param privateKeySize The size in bytes of the private key. * @returns A JWT token for transmission to GCP. */ char *create_GCP_JWT(const char *projectId, const char *privateKey, size_t privateKeySize) { ESP_LOGD(TAG, "[create_GCP_JWT] start"); static const char *JWT_BASE_64_HEADER = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9"; // {"alg":"RS256","typ":"JWT"}" time_t now; time(&now); uint32_t iat = now; // Set the time now. uint32_t exp = iat + 60 * 60 * 24; // Set the expiry time. char *payload; asprintf(&payload, "{\"iat\":%d,\"exp\":%d,\"aud\":\"%s\"}", iat, exp, projectId); ESP_LOGD(TAG, "[create_GCP_JWT] payload: %s", payload); unsigned char *base64Payload; size_t base_64_payload_size; mbedtls_base64_encode(NULL, 0, &base_64_payload_size, (const unsigned char *)payload, strlen((char *)payload)); base64Payload = calloc(base_64_payload_size, sizeof(*base64Payload)); mbedtls_base64_encode(base64Payload, base_64_payload_size, &base_64_payload_size, (const unsigned char *)payload, strlen((char *)payload)); ESP_LOGD(TAG, "[create_GCP_JWT] base64 payload: %s", base64Payload); free(payload); char *headerAndPayload; asprintf(&headerAndPayload, "%s.%s", JWT_BASE_64_HEADER, base64Payload); ESP_LOGD(TAG, "[create_GCP_JWT] headerAndPayload: %s", headerAndPayload); free(base64Payload); // At this point we have created the header and payload parts, converted both to base64 and concatenated them // together as a single string. Now we need to sign them using RSASSA uint8_t digest[32]; int rc = mbedtls_md(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), (unsigned char *)headerAndPayload, strlen((char *)headerAndPayload), digest); if (rc != 0) { ESP_LOGE(TAG, "Failed to mbedtls_md: %d (-0x%x): %s\n", rc, -rc, mbedtlsError(rc)); return NULL; } mbedtls_pk_context pk_context; mbedtls_pk_init(&pk_context); rc = mbedtls_pk_parse_key(&pk_context, (const unsigned char *) privateKey, privateKeySize, NULL, 0); if (rc != 0) { ESP_LOGE(TAG, "Failed to mbedtls_pk_parse_key: %d (-0x%x): %s\n", rc, -rc, mbedtlsError(rc)); abort(); } size_t sig_len = mbedtls_pk_get_len(&pk_context); uint8_t oBuf[sig_len]; size_t retSize; rc = mbedtls_pk_sign(&pk_context, MBEDTLS_MD_SHA256, digest, sizeof(digest), oBuf, &retSize, NULL, NULL); mbedtls_pk_free(&pk_context); if (rc != 0) { ESP_LOGE(TAG, "Failed to mbedtls_pk_sign: %d (-0x%x): %s\n", rc, -rc, mbedtlsError(rc)); abort(); } unsigned char *base64Signature; size_t base_64_signature_size; mbedtls_base64_encode(NULL, 0, &base_64_signature_size, oBuf, retSize); base64Signature = calloc(base_64_signature_size, sizeof(*base64Signature)); mbedtls_base64_encode(base64Signature, base_64_signature_size, &base_64_signature_size, oBuf, retSize); char *retData; asprintf(&retData, "%s.%s", headerAndPayload, base64Signature); free(headerAndPayload); free(base64Signature); ESP_LOGD(TAG, "[create_GCP_JWT] jwt: %s", retData); return retData; }
42.555556
147
0.707137
45d6d357615816edafd09edbc52118b4708f30f4
6,496
py
Python
tests/unit/TestDuane.py
rakhimov/rtk
adc35e218ccfdcf3a6e3082f6a1a1d308ed4ff63
[ "BSD-3-Clause" ]
null
null
null
tests/unit/TestDuane.py
rakhimov/rtk
adc35e218ccfdcf3a6e3082f6a1a1d308ed4ff63
[ "BSD-3-Clause" ]
null
null
null
tests/unit/TestDuane.py
rakhimov/rtk
adc35e218ccfdcf3a6e3082f6a1a1d308ed4ff63
[ "BSD-3-Clause" ]
2
2020-04-03T04:14:42.000Z
2021-02-22T05:30:35.000Z
#!/usr/bin/env python -O """ This is the test class for testing Duane model algorithms. """ # -*- coding: utf-8 -*- # # tests.statistics.TestDuane.py is part of The RTK Project # # All rights reserved. # Copyright 2007 - 2017 Andrew Rowland andrew.rowland <AT> reliaqual <DOT> com # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # 3. Neither the name of the copyright holder nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER # OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import sys from os.path import dirname sys.path.insert(0, dirname(dirname(dirname(__file__))) + "/rtk", ) import unittest from nose.plugins.attrib import attr import numpy as np import dao.DAO as _dao from analyses.statistics.Duane import * __author__ = 'Andrew Rowland' __email__ = '[email protected]' __organization__ = 'ReliaQual Associates, LLC' __copyright__ = 'Copyright 2015 Andrew "Weibullguy" Rowland' class TestDuane(unittest.TestCase): """ Class for testing the Duane model functions. """ @attr(all=True, unit=True) def test_calculate_duane_parameters(self): """ (TestDuane) calculate_duane_parameters should return a tuple of floats """ # See http://reliawiki.org/index.php/Duane_Model for example data. n_failures = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] fail_times = [9.2, 25.0, 61.5, 260.0, 300.0, 710.0, 916.0, 1010.0, 1220.0, 2530.0, 3350.0, 4200.0, 4410.0, 4990.0, 5570.0, 8310.0, 8530.0, 9200.0, 10500.0, 12100.0, 13400.0, 14600.0, 22000.0] _alpha, _beta = calculate_duane_parameters(n_failures, fail_times) self.assertAlmostEqual(_alpha, 1.9456630) self.assertAlmostEqual(_beta, 0.6132337) @attr(all=True, unit=True) def test_calculate_duane_parameters_zero_division(self): """ (TestDuane) calculate_duane_parameters should return a tuple of floats with alpha=0.0 when encountering a zero division error """ # See http://reliawiki.org/index.php/Duane_Model for example data. n_failures = [] fail_times = [9.2, 25.0, 61.5, 260.0, 300.0, 710.0, 916.0, 1010.0, 1220.0, 2530.0, 3350.0, 4200.0, 4410.0, 4990.0, 5570.0, 8310.0, 8530.0, 9200.0, 10500.0, 12100.0, 13400.0, 14600.0, 22000.0] _alpha, _beta = calculate_duane_parameters(n_failures, fail_times) self.assertAlmostEqual(_alpha, 0.0) self.assertAlmostEqual(_beta, 1.0) @attr(all=True, unit=True) def test_calculate_duane_standard_error(self): """ (TestDuane) calculate_duane_standard_error should return tuple of floats with the estimated standard errors of alpha and beta """ # See http://reliawiki.org/index.php/Duane_Model for example data. n_failures = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] fail_times = [9.2, 25.0, 61.5, 260.0, 300.0, 710.0, 916.0, 1010.0, 1220.0, 2530.0, 3350.0, 4200.0, 4410.0, 4990.0, 5570.0, 8310.0, 8530.0, 9200.0, 10500.0, 12100.0, 13400.0, 14600.0, 22000.0] _alpha = 0.6132337 _beta = 1.9456630 _se_alpha, _se_lnbeta = calculate_duane_standard_error(n_failures, fail_times, _alpha, _beta) self.assertAlmostEqual(_se_alpha, 0.008451551) self.assertAlmostEqual(_se_lnbeta, 0.06595950) @attr(all=True, unit=True) def test_calculate_duane_standard_error_two_failures(self): """ (TestDuane) calculate_duane_standard_error should return a tuple of floats with the estimated standard errors of alpha and beta when there are less than three failures """ # See http://reliawiki.org/index.php/Duane_Model for example data. n_failures = [1, 1] fail_times = [9.2, 25.0] _alpha = 0.6132337 _beta = 1.9456630 _se_alpha, _se_lnbeta = calculate_duane_standard_error(n_failures, fail_times, _alpha, _beta) self.assertAlmostEqual(_se_alpha, 0.3166068) self.assertAlmostEqual(_se_lnbeta, 0.8752911) @attr(all=True, unit=True) def test_calculate_duane_mean(self): """ (TestDuane) calculate_duane_mean should return a tuple of floats with the estimated cumulative and instantaneous mean """ # See http://reliawiki.org/index.php/Duane_Model for example data. _est_time = 22000.0 _alpha = 0.6132337 _beta = 1.9456630 _cum_mean, _instantaneous_mean = calculate_duane_mean(_est_time, _alpha, _beta) self.assertAlmostEqual(_cum_mean, 895.3390935) self.assertAlmostEqual(_instantaneous_mean, 2314.9356434)
42.736842
175
0.636084
2350375084ffd852dd9589aaf089e95c8774a338
44,137
lua
Lua
Interface/AddOns/GDKP/core.lua
liruqi/bigfoot
813a437268b6c55d9b0dc71ed4578753af6166f2
[ "MIT" ]
null
null
null
Interface/AddOns/GDKP/core.lua
liruqi/bigfoot
813a437268b6c55d9b0dc71ed4578753af6166f2
[ "MIT" ]
null
null
null
Interface/AddOns/GDKP/core.lua
liruqi/bigfoot
813a437268b6c55d9b0dc71ed4578753af6166f2
[ "MIT" ]
1
2021-06-22T17:25:11.000Z
2021-06-22T17:25:11.000Z
local T = LibStub("AceAddon-3.0"):NewAddon("GDKP","AceEvent-3.0","AceHook-3.0") if not T then return end _G.GDKP = T local defaults = { profile = { account = {}, records = {}, } } local _debug = 0 local _debugColor = { "ee2211", "ee2288", "00ee55", } T.debug = function(...) local lvl = ... if type(lvl)=='number' and lvl <= #_debugColor then if _debug >= lvl then print("** |cff".._debugColor[lvl].."<GDKP>|r: Level "..lvl.." **") print(select(2,...)) end else if _debug > 0 then print("** <GDKP> **") print(...) end end end local debug = T.debug local AceOO = AceLibrary("AceOO-2.0") local YOU local GDKP_LOOT_ITEM_MULTIPLE local GDKP_LOOT_ITEM local GDKP_LOOT_ITEM_SELF_MULTIPLE local GDKP_LOOT_ITEM_SELF local GDKP_LOOT_ITEM_PUSHED_SELF local GDKP_LOOT_ITEM_PUSHED_SELF_MULTIPLE local GDKP_RAID_MEMBER_ADDED local GDKP_RAID_MEMBER_REMOVED local GDKP_RAID_YOU_JOINED local GDKP_RAID_YOU_LEFT local GDKP_REPORT_TOTAL_INCOME local GDKP_REPORT_TOTAL_EXPENSE local GDKP_REPORT_TOTAL_PROFIT local GDKP_REPORT_TANK_SUBSIDE local GDKP_REPORT_HEALER_SUBSIDE local GDKP_REPORT_AVE_PROFIT local GDKP_0b07d59d0644e66cb588eb8a9e79ad79 = { ["29434"]=true, ["32229"]=true, ["32230"]=true, ["32228"]=true, ["32227"]=true, ["32249"]=true, ["32231"]=true, ["32428"]=true, ["34664"]=true, ["20725"]=true, ["22449"]=true, ["22448"]=true, ["22450"]=true, ["30313"]=true, ["30318"]=true, ["30312"]=true, ["30314"]=true, ["30319"]=true, ["30317"]=true, ["30311"]=true, ["30316"]=true, ["34057"]=true, ["49426"]=true, ["47241"]=true, ["36928"]=true, ["36934"]=true, ["36931"]=true, ["36919"]=true, ["36922"]=true, ["36925"]=true, ["34052"]=true, ["34053"]=true, ["45624"]=true, } if GetLocale()=='zhCN' then GDKP_TEXT_TITLE = "大脚金团助手" GDKP_TEXT_NEW_INCOME = "添加\n收入" GDKP_TEXT_NEW_EXPENSE = "添加\n支出" GDKP_TEXT_NUM_MEMBER = "人数:" GDKP_TEXT_MANAGE = "管理\n记录" GDKP_TEXT_TOTAL_INCOME = "总收入:" GDKP_TEXT_AVE_PROFIT = "人均收入:" GDKP_TEXT_TOTAL_PROFIT = "净收入:" GDKP_TEXT_TOTAL_EXPENSE = "总支出:" GDKP_TEXT_TANK_SUBSIDE = "坦克补助:" GDKP_TEXT_HEALER_SUBSIDE = "治疗补助:" GDKP_TEXT_INCOME_DESC = "收入描述 (shift+物品自动填写)" GDKP_TEXT_GOLD_DESC = "金" GDKP_TEXT_GOLD_EXPENSE = "支出金币" GDKP_TEXT_EXPENSE_DESC = "支出描述" GDKP_TEXT_NEWINCOME_DESC = " 以下为该次活动自动记录的物品列表,请根据需要修改物品价值。修改后的物品将自动转移到管理记录列表中。" GDKP_TEXT_NEWINCOM_NEWITEM_DESC = "手动添加物品或额外收入请点击“添加收入”进行操作" GDKP_TEXT_NEWIEXPENSE_NEWITEM_DESC = "手动添加支出项目请点击“添加支出”进行操作" GDKP_LABEL_EDIT = "修改" GDKP_LABEL_DEL = "刪除" GDKP_ALERT_DEAD = "你已经死亡" YOU = "你" GDKP_TAB_INCOME = " 收入列表 " GDKP_TAB_EXPENSE = " 支出列表 " GDKP_TAB_LOG = " 查看日誌 " GDKP_RESET = "重置记录" GDKP_REPORT = "通告" GDKP_REPORT_TOTAL_INCOME = "总收入为:%s。\n" GDKP_REPORT_TOTAL_EXPENSE = "总支出为:%s。\n" GDKP_REPORT_TOTAL_PROFIT = "总盈余为:%s。\n" GDKP_REPORT_TANK_SUBSIDE = "坦克补助为:%s。\n" GDKP_REPORT_HEALER_SUBSIDE = "治疗补助为:%s。\n" GDKP_REPORT_AVE_PROFIT = "平均收入为:%d。\n" GDKP_RESET_DATA = "该操作将重置所有记录,你确定吗?" GDKP_DELETE_RECORD = "此操作将删除 记录%s,你确定吗?" GDKP_SAVE = "保存" elseif GetLocale()=='zhTW' then GDKP_TEXT_TITLE = "大腳金團助手" GDKP_TEXT_NEW_INCOME = "添加\n收入" GDKP_TEXT_NEW_EXPENSE = "添加\n支出" GDKP_TEXT_NUM_MEMBER = "人數:" GDKP_TEXT_MANAGE = "管理\n記錄" GDKP_TEXT_TOTAL_INCOME = "總收入:" GDKP_TEXT_AVE_PROFIT = "人均收益:" GDKP_TEXT_TOTAL_PROFIT = "凈收入:" GDKP_TEXT_TOTAL_EXPENSE = "總支出:" GDKP_TEXT_TANK_SUBSIDE = "坦克補助:" GDKP_TEXT_HEALER_SUBSIDE = "治療補助:" GDKP_TEXT_INCOME_DESC = "收入描述 (shift+物品自動填寫)" GDKP_TEXT_GOLD_DESC = "金" GDKP_TEXT_GOLD_EXPENSE = "支出金幣" GDKP_TEXT_EXPENSE_DESC = "支出描述" GDKP_TEXT_NEWINCOME_DESC = " 以下為該次活動自動記錄的物品列表,請根據需要修改物品價值。修改後的物品將自動轉移到管理記錄列表中。" GDKP_TEXT_NEWINCOM_NEWITEM_DESC = "手動添加物品或額外收入請點擊“添加收入”進行操作" GDKP_TEXT_NEWIEXPENSE_NEWITEM_DESC = "手動添加支出項目請點擊“添加支出”進行操作" GDKP_LABEL_EDIT = "修改" GDKP_LABEL_DEL = "刪除" GDKP_ALERT_DEAD = "你已經死亡" YOU = "你" GDKP_TAB_INCOME = " 收入列表 " GDKP_TAB_EXPENSE = " 支出列表 " GDKP_TAB_LOG = " 查看日誌 " GDKP_RESET = "重置記錄" GDKP_REPORT = "通告" GDKP_REPORT_TOTAL_INCOME = "總收入為:%s。\n" GDKP_REPORT_TOTAL_EXPENSE = "總支出為:%s。\n" GDKP_REPORT_TOTAL_PROFIT = "總盈餘為:%s。\n" GDKP_REPORT_TANK_SUBSIDE = "坦克補助為:%s。\n" GDKP_REPORT_HEALER_SUBSIDE = "治療補助為:%s。\n" GDKP_REPORT_AVE_PROFIT = "平均收入為:%d。\n" GDKP_RESET_DATA = "該操作將重置所有記錄,你確定嗎?" GDKP_DELETE_RECORD = "此操作將刪除記錄 %s,你確定嗎?" GDKP_SAVE = "保存" else GDKP_TEXT_TITLE = "GDKP Helper@BF" GDKP_TEXT_NEW_INCOME = "New \nIncome" GDKP_TEXT_NEW_EXPENSE = "New \nExpense" GDKP_TEXT_NUM_MEMBER = "Members:" GDKP_TEXT_MANAGE = "Manage \nRecords" GDKP_TEXT_TOTAL_INCOME = "Total Income:" GDKP_TEXT_AVE_PROFIT = "Average Profit:" GDKP_TEXT_TOTAL_PROFIT = "Total Profit:" GDKP_TEXT_TOTAL_EXPENSE = "Total Expense:" GDKP_TEXT_TANK_SUBSIDE = "Tank Subside:" GDKP_TEXT_HEALER_SUBSIDE = "Healer Subside:" GDKP_TEXT_INCOME_DESC = "Income description (shift+Click on item link to autofill)" GDKP_TEXT_GOLD_DESC = "Gold" GDKP_TEXT_GOLD_EXPENSE = "Expense" GDKP_TEXT_EXPENSE_DESC = "Expense Description" GDKP_TEXT_NEWINCOME_DESC = " Below are items that has been automatically recorded, please modify their value. Items that have been modified will be moved to Income list." GDKP_TEXT_NEWINCOM_NEWITEM_DESC = "To extra Items or income, please click on \"New Income\" button" GDKP_LABEL_EDIT = "Edit" GDKP_LABEL_DEL = "Delete" GDKP_ALERT_DEAD = "You are dead" YOU = "You" GDKP_TAB_INCOME = " Income List " GDKP_TAB_EXPENSE = " Expense List " GDKP_TAB_LOG = " View Log " GDKP_RESET = "Reset All" GDKP_REPORT = "Report" GDKP_REPORT_TOTAL_INCOME = "Total Income is:%s.\n" GDKP_REPORT_TOTAL_EXPENSE = "Total Expense is:%s.\n" GDKP_REPORT_TOTAL_PROFIT = "Total Profit is:%s.\n" GDKP_REPORT_TANK_SUBSIDE = "Tank Subside is:%s.\n" GDKP_REPORT_HEALER_SUBSIDE = "Healer Subside is:%s.\n" GDKP_REPORT_AVE_PROFIT = "Average Profit is:%d.\n" GDKP_RESET_DATA = "This operation will reset all the records, continue?" GDKP_DELETE_RECORD = "This operation will delete record %s, continue?" GDKP_SAVE = "Save" end local RM = T:NewModule("RecordManager") if not RM then return end local EM = T:NewModule("EventManager") if not EM then return end StaticPopupDialogs["GDKP_RESET_DATA"] = { text = GDKP_RESET_DATA, button1 = YES, button2 = NO, OnAccept = function() T:Reset() end, OnCancel = function() end, OnShow = function() end, timeout = 0, hideOnEscape = 1, } StaticPopupDialogs["GDKP_DELETE_RECORD"] = { text = GDKP_DELETE_RECORD, button1 = YES, button2 = NO, OnAccept = function(self,...) local cell = self.cell local panel = self.panel RM:DeleteRecord(cell:GetRecord()) panel:DeleteRecord(cell:GetRecord()) end, OnCancel = function() end, OnShow = function() end, timeout = 0, hideOnEscape = 1, enterClicksFirstButton = 1 } local function GDKP_9336171702a6bc3810b21190594210d9(GDKP_acd18e5e4cc047ed8d218397986e9dc2, GDKP_a8858383576d7634cceceaf04a2ddb29) local GDKP_8e0e84596da5717799a875d1aeeb63bc=function(s, e, ...) if (s and e) then return ... end end return GDKP_8e0e84596da5717799a875d1aeeb63bc(string.find(GDKP_acd18e5e4cc047ed8d218397986e9dc2, GDKP_a8858383576d7634cceceaf04a2ddb29)) end local function GDKP_93dd10c14ba6d9968dde1fcd8b5345c8(arg1) local GDKP_9c987de176f2b454baede402cee36bfa,GDKP_e498578b78aa0db9c45f30f87d63debc,GDKP_3f50417fb16be9b1078eb68d24fa9c26 if (not GDKP_e498578b78aa0db9c45f30f87d63debc) then GDKP_9c987de176f2b454baede402cee36bfa, GDKP_e498578b78aa0db9c45f30f87d63debc, GDKP_3f50417fb16be9b1078eb68d24fa9c26 = GDKP_9336171702a6bc3810b21190594210d9(arg1, GDKP_LOOT_ITEM_MULTIPLE) end if (not GDKP_e498578b78aa0db9c45f30f87d63debc) then GDKP_9c987de176f2b454baede402cee36bfa, GDKP_e498578b78aa0db9c45f30f87d63debc = GDKP_9336171702a6bc3810b21190594210d9(arg1, GDKP_LOOT_ITEM) end if (not GDKP_e498578b78aa0db9c45f30f87d63debc) then GDKP_e498578b78aa0db9c45f30f87d63debc, GDKP_3f50417fb16be9b1078eb68d24fa9c26 = GDKP_9336171702a6bc3810b21190594210d9(arg1, GDKP_LOOT_ITEM_SELF_MULTIPLE) end if (not GDKP_e498578b78aa0db9c45f30f87d63debc) then GDKP_e498578b78aa0db9c45f30f87d63debc = GDKP_9336171702a6bc3810b21190594210d9(arg1, GDKP_LOOT_ITEM_SELF) end if (not GDKP_e498578b78aa0db9c45f30f87d63debc) then GDKP_e498578b78aa0db9c45f30f87d63debc = GDKP_9336171702a6bc3810b21190594210d9(arg1, GDKP_LOOT_ITEM_PUSHED_SELF) end if (not GDKP_e498578b78aa0db9c45f30f87d63debc) then GDKP_e498578b78aa0db9c45f30f87d63debc,GDKP_3f50417fb16be9b1078eb68d24fa9c26 = GDKP_9336171702a6bc3810b21190594210d9(arg1, GDKP_LOOT_ITEM_PUSHED_SELF_MULTIPLE) end if (not GDKP_9c987de176f2b454baede402cee36bfa or GDKP_9c987de176f2b454baede402cee36bfa == YOU) then GDKP_9c987de176f2b454baede402cee36bfa = UnitName("player") end if (not GDKP_e498578b78aa0db9c45f30f87d63debc) then return end GDKP_3f50417fb16be9b1078eb68d24fa9c26 = GDKP_3f50417fb16be9b1078eb68d24fa9c26 or 1 return GDKP_9c987de176f2b454baede402cee36bfa,GDKP_e498578b78aa0db9c45f30f87d63debc,(GDKP_3f50417fb16be9b1078eb68d24fa9c26 == 1 and GDKP_e498578b78aa0db9c45f30f87d63debc) or GDKP_e498578b78aa0db9c45f30f87d63debc.."x"..GDKP_3f50417fb16be9b1078eb68d24fa9c26 end local function GDKP_17f19a911781c205920d1760e7dfc736(GDKP_acd18e5e4cc047ed8d218397986e9dc2) GDKP_acd18e5e4cc047ed8d218397986e9dc2 = string.gsub(GDKP_acd18e5e4cc047ed8d218397986e9dc2, "%(", "%%(") GDKP_acd18e5e4cc047ed8d218397986e9dc2 = string.gsub(GDKP_acd18e5e4cc047ed8d218397986e9dc2, "%)", "%%)") GDKP_acd18e5e4cc047ed8d218397986e9dc2 = string.gsub(GDKP_acd18e5e4cc047ed8d218397986e9dc2, "%%s", "(.-)") GDKP_acd18e5e4cc047ed8d218397986e9dc2 = string.gsub(GDKP_acd18e5e4cc047ed8d218397986e9dc2, "%%d", "(%%d+)") return GDKP_acd18e5e4cc047ed8d218397986e9dc2 end local function GDKP_9f069b4b2abd8b59dd593eb05c0eb053() GDKP_LOOT_ITEM = GDKP_17f19a911781c205920d1760e7dfc736(LOOT_ITEM) GDKP_LOOT_ITEM_MULTIPLE = GDKP_17f19a911781c205920d1760e7dfc736(LOOT_ITEM_MULTIPLE) GDKP_LOOT_ITEM_SELF = GDKP_17f19a911781c205920d1760e7dfc736(LOOT_ITEM_SELF) GDKP_LOOT_ITEM_SELF_MULTIPLE = GDKP_17f19a911781c205920d1760e7dfc736(LOOT_ITEM_SELF_MULTIPLE) GDKP_LOOT_ITEM_PUSHED_SELF = GDKP_17f19a911781c205920d1760e7dfc736(LOOT_ITEM_PUSHED_SELF) GDKP_LOOT_ITEM_PUSHED_SELF_MULTIPLE = GDKP_17f19a911781c205920d1760e7dfc736(LOOT_ITEM_PUSHED_SELF_MULTIPLE) GDKP_RAID_MEMBER_ADDED = GDKP_17f19a911781c205920d1760e7dfc736(ERR_RAID_MEMBER_ADDED_S) GDKP_RAID_MEMBER_REMOVED = GDKP_17f19a911781c205920d1760e7dfc736(ERR_RAID_MEMBER_REMOVED_S) GDKP_RAID_YOU_JOINED = GDKP_17f19a911781c205920d1760e7dfc736(ERR_RAID_YOU_JOINED) GDKP_RAID_YOU_LEFT = GDKP_17f19a911781c205920d1760e7dfc736(ERR_RAID_YOU_LEFT) end local function GDKP_d46ced55976240072f56c23890a2fc3b(itemLink) local pattern = "|c%x+|Hitem:(%d+):%-?%d+:%-?%d+:%-?%d+:%-?%d+:%-?%d+:%-?%d+:%-?%d+:%-?%d+|h%[(.+)%]|h|r" return itemLink:match(pattern) end function GDKP_332126e2e82fafa6f5d15f912aba69c6(item) local id = GDKP_d46ced55976240072f56c23890a2fc3b(item) if not id then return end return GDKP_0b07d59d0644e66cb588eb8a9e79ad79[id] end local function SafePopup_Show(GDKP_8983c60d66c8593ec7165ea9dbedb584,...) if not UnitIsDeadOrGhost(UnitName("player")) then return StaticPopup_Show(GDKP_8983c60d66c8593ec7165ea9dbedb584,...) else print("\124cff03de23<GDKP>: \124r "..GDKP_ALERT_DEAD) end end function EM:FireEvent(event) if not self.eventTable[event] then return end for i,funcTable in ipairs(self.eventTable[event]) do local func = funcTable[1] local args = funcTable[2] pcall(func,unpack(args)) end end function EM:RegisterEvent(event,func,...) assert(type(event)=='string',"Event must be String") self.eventTable[event] = self.eventTable[event] or {} local funcTable = {func,{...}} tinsert(self.eventTable[event],funcTable) end function EM:UnRegisterEvent(event,func) if not self.eventTable[event] then return end for i = 1, # self.eventTable[event] do if self.eventTable[event][i][1] == func then tremove(self.eventTable[event],i) end end end function EM:OnInitialize() self.eventTable = {} end RM.recordTypes={ "NormalItem", "SpecialIncome", "Expense", "Trivial" } local function GDKP_625814a4f8ec0bfbf26894c87ca2cd9a(rType) local prefix if type(rType) == "number" then assert(rType > 0 and rType <= #RM.recordTypes,"<Local function> - GDKP_625814a4f8ec0bfbf26894c87ca2cd9a(): Invalid record id") prefix = RM.recordTypes[rType] elseif type(rType) =="string" then for i = 1 , #RM.recordTypes do if rType:lower() ==RM.recordTypes[i]:lower() then prefix = RM.recordTypes[i] break end end end return prefix end --[[ input: rtype: string,Record type rTable: table, save table or new table ]] function RM:NewRecord(rType,rTable,...) local preFix,obj preFix = GDKP_625814a4f8ec0bfbf26894c87ca2cd9a(rType) assert(preFix,"<RM>: Invalid record prefix") obj = T.Templates[preFix .. "Record"] obj = obj:new(rTable,...) return obj end function RM:GetRecordList(rType) local records ={} if not rType then records = self.records elseif rType =="Income" then local template1,template2 = T.Templates.NormalItemRecord,T.Templates.SpecialIncomeRecord for i = 1 , #self.records do if AceOO.inherits(self.records[i],template1) or AceOO.inherits(self.records[i],template2) then tinsert(records,self.records[i]) end end elseif rType == "NewIncome" then local template1,template2 = T.Templates.NormalItemRecord,T.Templates.SpecialIncomeRecord for i = 1 , #self.records do if AceOO.inherits(self.records[i],template1) or AceOO.inherits(self.records[i],template2) then if not self.records[i]:GetIncome() then tinsert(records,self.records[i]) end end end else local preFix = GDKP_625814a4f8ec0bfbf26894c87ca2cd9a(rType) if preFix then local template = T.Templates[preFix.."Record"] if template then for i = 1 , #self.records do if AceOO.inherits(self.records[i],template) then tinsert(records,self.records[i]) end end end end end return records end function RM:LoadRecords() local rawRecords,rawRecord = T.db.profile.records local recordType,record self.records = {} for i = 1, #rawRecords do rawRecord = rawRecords[i] recordType = self:GetRawRecordType(rawRecord) if recordType then record = self:NewRecord(recordType,rawRecord) tinsert(self.records,record) end end end function RM:AddRecord(record) tinsert(self.records,record) tinsert(T.db.profile.records,record:GetSaveTable()) EM:FireEvent("UPDATE_GOLD") end function RM:GetRawRecordType(rawTable) assert(rawTable.type,"<RM>: RecordRawTable need to specify a type") local rType = rawTable.type for i = 1 , #self.recordTypes do if rType:lower() ==self.recordTypes[i]:lower() then return self.recordTypes[i] end end EM:FireEvent("UPDATE_GOLD") end function RM:DeleteRecord(record) local index if type(record)=="number" then index = record elseif type(record)=='table' then index = self:FindRecord(record) end assert(index > 0 and index <= #self.records,"<RM>: Invalid index for delete") tremove(self.records,index) tremove( T.db.profile.records,index) EM:FireEvent("UPDATE_GOLD") end function RM:FindRecord(record) for i = 1 , #self.records do if self.records[i] == record then return i end end error("<RM>: Can not find record: "..record) end function RM:GetReport(filterFunc) local str ="" for i= 1, #self.records do if filterFunc and filterFunc(self.records[i])then str=str..self.records[i]:Report() elseif not filterFunc then str=str..self.records[i]:Report() end end return str end function RM:Reset() wipe(self.records) wipe(T.db.profile.records) end function RM:OnInitialize() T.debug(3,"<RM>: Initializing...") end function RM:OnEnable() T.debug(3,"<RM>: Enabling...") RM:LoadRecords() end function RM:OnDisable() end GM = T:NewModule("GoldManager") if not GM then return end UM = T:NewModule("UIManager") if not UM then return end function GM:SetUserSetted(flag) self.account:SetUserSetted(flag) end function GM:IsUserSetted() return self.account:IsUserSetted() end function GM:SetNumMembers(number) if number and number >0 then self.account:SetNumMembers(number) end end function GM:GetNumMembers() return self.account:GetNumMembers() or 1 end function GM:GetAverage() return self.account:GetAverage() end function GM:GetIncome() return self.account:GetIncome() end function GM:GetExpense() return self.account:GetExpense() end function GM:GetTankSubsidy() return self.account:GetExpense("TANK_SUBSIDY") end function GM:GetHealerSubsidy() return self.account:GetExpense("HEALER_SUBSIDY") end function GM:GetGeneralExpense() return self.account:GetExpense("GENERAL_EXPENSE") end function GM:GetProfit() return self.account:GetProfit() end function GM:UpdateRecords() local incomeList = RM:GetRecordList("Income") local expenseList = RM:GetRecordList("Expense") self.account:SetIncomeList(incomeList) self.account:SetExpenseList(expenseList) end function GM:OnInitialize() T.debug(3,"<GM>: Initializing...") end function GM:Reset() self:UpdateRecords() self:SetNumMembers(GetNumGroupMembers() >0 and GetNumGroupMembers() or 1) self:SetUserSetted(false) UM:SetNumMember(self:GetNumMembers()) end function GM:OnEnable() T.debug(3,"<GM>: Enabling...") self.account = T.Templates.Account:new(T.db.profile.account) UM:SetNumMember(self:GetNumMembers()) end function GM:OnDisable() end function GM:GetReport() local str = "\n" str = str ..GDKP_REPORT_TOTAL_INCOME:format(self:GetIncome()) str = str ..GDKP_REPORT_TOTAL_EXPENSE:format(self:GetExpense()) str = str ..GDKP_REPORT_TOTAL_PROFIT:format(self:GetProfit()) str = str ..GDKP_REPORT_TANK_SUBSIDE:format(self:GetTankSubsidy()) str = str ..GDKP_REPORT_HEALER_SUBSIDE:format(self:GetHealerSubsidy()) if GM:GetNumMembers() and GM:GetNumMembers() > 0 then str = str ..GDKP_REPORT_AVE_PROFIT:format(self:GetAverage() or "N/A") end return str end local mainPanel,eventPanel,itemPanel,managePanel local incomTab,expendTab,logTab local function GDKP_993d50d2de8d657e2fac9639ff63a42b(frame) frame:SetAttribute("UIPanelLayout-defined", true); frame:SetAttribute("UIPanelLayout-area", "center"); frame:SetAttribute("UIPanelLayout-enabled", true); frame:SetAttribute("UIPanelLayout-whiledead", true); end local function GDKP_e02c71e1241bcc3c74ba4f8152ea6a49(frame) frame.closeButton = BLibrary("BFButton", frame, 27, 27); frame.closeButton:SetPoint("TOPRIGHT",frame,"TOPRIGHT", -8, -8); frame.closeButton:SetText("X"); frame.closeButton.OnClick = function(bn) HideParentPanel(bn) end end local function GDKP_9693cf7251ebd2f6eb6bc572b2e5a188() T.debug(3,"<UM>: GDKP_9693cf7251ebd2f6eb6bc572b2e5a188()") local frame = _G["GDKPMainFrame"] RegisterForSaveFrame(frame) frame.newIncomeButton = BLibrary("BFButton", frame, 44, 44); frame.newIncomeButton:SetPoint("TOPLEFT",frame, "TOPLEFT", 12, -37); frame.newIncomeButton:SetText(GDKP_TEXT_NEW_INCOME); frame.newIncomeButton.OnClick = function() UM.newIncomePanel:Show() UM.newIncomePanel:UpdatePanel() if not UM.newIncomeFrame:IsShown() then ShowUIPanel(UM.newIncomeFrame) else HideUIPanel(UM.newIncomeFrame) end end frame.newExpenseButton = BLibrary("BFButton", frame, 44, 44); frame.newExpenseButton:SetPoint("TOPLEFT",frame, "TOPLEFT", 60, -37); frame.newExpenseButton:SetText(GDKP_TEXT_NEW_EXPENSE); frame.newExpenseButton.OnClick = function(button) local record = RM:NewRecord("Expense",{}) frame.editable:SetRecord(record) frame.editable:ClearAllPoints() frame.editable:SetPoint("BOTTOMLEFT",frame,"TOPLEFT",0,0) frame.editable:SetCommitCallback(function() RM:AddRecord(record) end) frame.editable:Update() frame.editable:Show() end frame.manageButton = BLibrary("BFButton", frame, 44, 44); frame.manageButton:SetPoint("TOPRIGHT",frame, "TOPRIGHT", -37, -37); frame.manageButton:SetText(GDKP_TEXT_MANAGE); frame.manageButton.OnClick = function() if not UM.manageFrame:IsShown() then ShowUIPanel(UM.manageFrame) else HideUIPanel(UM.manageFrame) end end frame.resetButton = BLibrary("BFButton", frame, 100, 28); frame.resetButton:SetPoint("BOTTOMLEFT",frame,"BOTTOMLEFT", 12, 12); frame.resetButton:SetText(GDKP_RESET); frame.resetButton.OnClick = function() SafePopup_Show("GDKP_RESET_DATA") end frame.resetButton:Hide() frame.saveButton = BLibrary("BFButton", frame, 70, 28); frame.saveButton:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT", -104, 12); frame.saveButton:SetText(GDKP_SAVE); frame.saveButton.OnClick = function() BigFoot_RequestReloadUI() end frame.saveButton:Hide() frame.reportButton = BLibrary("BFButton", frame, 70, 28); frame.reportButton:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT", -29, 12); frame.reportButton:SetText(GDKP_REPORT); frame.reportButton.OnClick = function() T:Report() end frame.reportButton:Hide() GDKP_e02c71e1241bcc3c74ba4f8152ea6a49(frame) frame.memberEditBox = _G[frame:GetName().."MemberEditBox"] frame.incomeText = _G[frame:GetName().."IncomeText"] frame.aveProfitText = _G[frame:GetName().."AveProfitText"] frame.profitText = _G[frame:GetName().."ProfitText"] frame.expenseText = _G[frame:GetName().."ExpenseText"] frame.tankSubsideText = _G[frame:GetName().."TankSubsideText"] frame.healerSubsideText = _G[frame:GetName().."HealerSubsideText"] frame.profitLabel = _G[frame:GetName().."ProfitLabel"] frame.expenseLabel = _G[frame:GetName().."ExpenseLabel"] frame.tankSubsideLabel = _G[frame:GetName().."TankSubsideLabel"] frame.healerSubsideLabel = _G[frame:GetName().."HealerSubsideLabel"] frame.memberPlusButton = _G[frame:GetName().."PlusButton"] frame.memberMinusButton = _G[frame:GetName().."MinusButton"] frame:SetScript("OnShow",function() EM:FireEvent("UPDATE_GOLD") end) frame.editable = T.Templates.RecordExpenseEditable:new("RecordExpenseEditableUI") frame.memberPlusButton:SetScript("OnClick",function() GM:SetUserSetted(true) UM:SetNumMember(GM:GetNumMembers()+1) end) frame.memberMinusButton:SetScript("OnClick",function() GM:SetUserSetted(true) if GM:GetNumMembers() > 1 then UM:SetNumMember(GM:GetNumMembers()-1) end end) frame.memberEditBox:SetScript("OnTextChanged",function(box,userInput) if isUserInput then GM:SetUserSetted(true) end GM:SetNumMembers(tonumber(box:GetText())) UM:UpdateGoldDisplay() end) return frame end local function GDKP_b46a9a8d0d453ba05fdc42241de4dbf1() T.debug(3,"<UM>: GDKP_b46a9a8d0d453ba05fdc42241de4dbf1()") local parent = _G["GDKPNewIncomePanel"] RegisterForSaveFrame(parent) UM.newIncomePanel = T.Templates.NewIncomePanel:new() UM.newIncomePanel:SetParent(parent) UM.newIncomePanel:SetPoint("TOPLEFT",parent,"TOPLEFT",13,-88) GDKP_993d50d2de8d657e2fac9639ff63a42b(parent) GDKP_e02c71e1241bcc3c74ba4f8152ea6a49(parent) UM.newIncomePanel:SetShowCallback(function(panel) panel:SetRecordList(RM:GetRecordList("NewIncome")) panel:UpdatePanel() end) UM.newIncomePanel:SetDeleteCallback(function(cell) local dialog = SafePopup_Show("GDKP_DELETE_RECORD",cell:GetRecord():GetDesc()) dialog.cell = cell dialog.panel = UM.newIncomePanel end) UM.newIncomePanel:SetNewCallback(function(cell) RM:AddRecord(cell:GetRecord()) UM.newIncomePanel:AddRecord(cell:GetRecord()) end) UM.newIncomePanel:SetEditCallback(function(cell) EM:FireEvent("UPDATE_GOLD") end) return parent end local function GDKP_ecdc44ef55e944effa19684f3c4c942a() T.debug(3,"<UM>: GDKP_ecdc44ef55e944effa19684f3c4c942a()") local parent =_G["GDKPManageFrame"] UM.incomePanel = T.Templates.IncomePanel:new() UM.incomePanel:SetParent(parent) UM.incomePanel:SetPoint("TOPLEFT",parent,"TOPLEFT",10,-71) UM.incomePanel:SetShowCallback(function(panel) T.debug(3,"<UM>:Showing Incoming Tab") panel:SetRecordList(RM:GetRecordList("Income")) panel:UpdatePanel() end) UM.incomePanel:SetDeleteCallback(function(cell) local dialog = SafePopup_Show("GDKP_DELETE_RECORD",cell:GetRecord():GetDesc()) dialog.cell = cell dialog.panel = UM.incomePanel end) UM.incomePanel:SetNewCallback(function(cell) RM:AddRecord(cell:GetRecord()) UM.incomePanel:AddRecord(cell:GetRecord()) end) UM.incomePanel:SetEditCallback(function(cell) EM:FireEvent("UPDATE_GOLD") end) return parent end local function GDKP_a46102b8fc80c5b62666117722e42454() T.debug(3,"<UM>: GDKP_a46102b8fc80c5b62666117722e42454()") local parent =_G["GDKPManageFrame"] UM.expensePanel = T.Templates.ExpensePanel:new() UM.expensePanel:SetParent(parent) UM.expensePanel:SetPoint("TOPLEFT",parent,"TOPLEFT",10,-71) UM.expensePanel:SetShowCallback(function(panel) T.debug(3,"<UM>:Showing Expense Tab") panel:SetRecordList(RM:GetRecordList("Expense")) panel:UpdatePanel() end) UM.expensePanel:SetDeleteCallback(function(cell) local dialog = SafePopup_Show("GDKP_DELETE_RECORD",cell:GetRecord():GetDesc()) dialog.cell = cell dialog.panel = UM.expensePanel end) UM.expensePanel:SetNewCallback(function(cell) RM:AddRecord(cell:GetRecord()) UM.expensePanel:AddRecord(cell:GetRecord()) end) UM.expensePanel:SetEditCallback(function(cell) EM:FireEvent("UPDATE_GOLD") end) end local function GDKP_1d708ad1bb49e15326da5aca9c924459() T.debug(3,"<UM>: GDKP_1d708ad1bb49e15326da5aca9c924459()") local parent =_G["GDKPManageFrame"] UM.logPanel = T.Templates.LogPanel:new() UM.logPanel:SetParent(parent) UM.logPanel:SetPoint("TOPLEFT",parent,"TOPLEFT",10,-71) UM.logPanel:SetShowCallback(function(panel) T.debug(3,"<UM>:Showing Log Tab") panel:SetRecordList(RM:GetRecordList()) panel:UpdatePanel() end) UM.logPanel:SetDeleteCallback(function(cell) local dialog = SafePopup_Show("GDKP_DELETE_RECORD",cell:GetRecord():GetDesc()) dialog.cell = cell dialog.panel = UM.logPanel end) UM.logPanel:SetNewCallback(function(cell) RM:AddRecord(cell:GetRecord()) UM.logPanel:AddRecord(cell:GetRecord()) end) end local function GDKP_e838e7b159f6b9b809176a283d1d7502() T.debug(3,"<UM>: GDKP_e838e7b159f6b9b809176a283d1d7502()") local frame = _G["GDKPManageFrame"] RegisterForSaveFrame(frame) GDKP_993d50d2de8d657e2fac9639ff63a42b(frame) GDKP_e02c71e1241bcc3c74ba4f8152ea6a49(frame) PanelTemplates_SetNumTabs(frame, 3) GDKPManageFrameTab_OnClick(frame,1) return frame end local x1 = 0.3 local y1 = 0.3 local x2 = 0.7 local y2 = 0.7 local texturePieces = { { name = "TopLeft", point1={"TOPLEFT","Parent","TOPLEFT"}, texCoord={startX = 0,endX = x1,startY = 0,endY = y1}}, { name = "TopRight", point1={"TOPRIGHT","Parent","TOPRIGHT"}, texCoord={startX = x2,endX = 1,startY = 0,endY = y1}}, { name = "BottomLeft", point1={"BOTTOMLEFT","Parent","BOTTOMLEFT"}, texCoord={startX = 0,endX = x1,startY = y2,endY = 1}}, { name = "BottomRight", point1={"BOTTOMRIGHT","Parent","BOTTOMRIGHT"}, texCoord={startX = x2,endX = 1,startY = y2,endY = 1}}, { name = "Left", point1={"TOPLEFT","TopLeft","BOTTOMLEFT"}, point2={"BOTTOMLEFT","BottomLeft","TOPLEFT"}, texCoord={startX = 0,endX = x1,startY = y1,endY = y2}}, { name = "Right", point1={"TOPRIGHT","TopRight","BOTTOMRIGHT"}, point2={"BOTTOMRIGHT","BottomRight","TOPRIGHT"}, texCoord={startX = x2,endX = 1,startY = y1,endY = y2}}, { name = "Top", point1={"TOPLEFT","TopLeft","TOPRIGHT"}, point2={"TOPRIGHT","TopRight","TOPLEFT"}, texCoord={startX = x1,endX = x2,startY = 0,endY = y1}}, { name = "Bottom", point1={"BOTTOMLEFT","BottomLeft","BOTTOMRIGHT"}, point2={"BOTTOMRIGHT","BottomRight","BOTTOMLEFT"}, texCoord={startX = x1,endX = x2,startY = y2,endY = 1}}, { name = "Center", point1={"BOTTOMLEFT","BottomLeft","TOPRIGHT"}, point2={"TOPRIGHT","TopRight","BOTTOMLEFT"}, texCoord={startX = x1,endX = x2,startY = y2,endY = y2}} } local function GDKP_41b8bcac30854521200367706b48d656(self,file) local textureTable = {} for i = 1, #texturePieces do local piece = texturePieces[i] local coord = piece.texCoord local point1 = piece.point1 local point2 = piece.point2 local texture = self:CreateTexture(self:GetName()..piece.name,"BACKGROUND") texture:SetTexture(file) texture:SetWidth(15) texture:SetHeight(15) texture:SetTexCoord(coord.startX,coord.endX,coord.startY,coord.endY) if point1 then if point1[2] =="Parent" then texture:SetPoint(point1[1],self,point1[3]) else texture:SetPoint(point1[1],_G[self:GetName()..point1[2] ],point1[3]) end end if point2 then if point2[2] =="Parent" then texture:SetPoint(point2[1],self,point2[3]) else texture:SetPoint(point2[1],_G[self:GetName()..point2[2] ],point2[3]) end end tinsert(textureTable,texture) end end function GDKP_Frame_OnLoad(self) GDKP_41b8bcac30854521200367706b48d656(self,[[Interface\AddOns\GDKP\img\frameborder]]) end function GDKP_InnerFrame_OnLoad(self) GDKP_41b8bcac30854521200367706b48d656(self,[[Interface\AddOns\GDKP\img\innerframeborder]]) end function GDKP_MainFrameShowButtons() UM.mainFrame.resetButton:Show() UM.mainFrame.reportButton:Show() UM.mainFrame.saveButton:Show() UM.mainFrame.profitText:Show() UM.mainFrame.expenseText:Show() UM.mainFrame.tankSubsideText:Show() UM.mainFrame.healerSubsideText:Show() UM.mainFrame.profitLabel:Show() UM.mainFrame.expenseLabel:Show() UM.mainFrame.tankSubsideLabel:Show() UM.mainFrame.healerSubsideLabel:Show() end function GDKP_MainFrameHideButtons() UM.mainFrame.resetButton:Hide() UM.mainFrame.reportButton:Hide() UM.mainFrame.saveButton:Hide() UM.mainFrame.profitText:Hide() UM.mainFrame.expenseText:Hide() UM.mainFrame.tankSubsideText:Hide() UM.mainFrame.healerSubsideText:Hide() UM.mainFrame.profitLabel:Hide() UM.mainFrame.expenseLabel:Hide() UM.mainFrame.tankSubsideLabel:Hide() UM.mainFrame.healerSubsideLabel:Hide() end function GDKPManageFrameTab_OnClick(self,id) if ( not id ) then id = self:GetID(); end PanelTemplates_SetTab(GDKPManageFrame, id); if id == 1 then UM.incomePanel:UpdatePanel() UM.incomePanel:Show() UM.expensePanel:Hide() UM.logPanel:Hide() elseif id == 2 then UM.incomePanel:Hide() UM.expensePanel:UpdatePanel() UM.expensePanel:Show() UM.logPanel:Hide() elseif id ==3 then UM.incomePanel:Hide() UM.expensePanel:Hide() UM.logPanel:UpdatePanel() UM.logPanel:Show() end self:SetFrameLevel(self:GetParent():GetFrameLevel()+4) end function ShowGDKPPanel() ShowUIPanel(UM.mainFrame) end function HideGDKPPanel() UM.mainFrame.editable:Hide() HideUIPanel(UM.mainFrame) HideUIPanel(UM.newIncomeFrame) HideUIPanel(UM.manageFrame) end function UM:SetNumMember(num) self.mainFrame.memberEditBox:SetText(num) end function UM:OnRaidMemberChange() BigFoot_DelayCall(function() local numRaidMemebers = GetNumGroupMembers() if numRaidMemebers> 1 and not GM:IsUserSetted() then self:SetNumMember(numRaidMemebers) end end , 1) end function UM:UpdateGoldDisplay() self.mainFrame.incomeText:SetText(("%d金"):format(GM:GetIncome())) self.mainFrame.expenseText:SetText(("%d金"):format(GM:GetExpense())) if GM:GetNumMembers() and GM:GetNumMembers() >0 then self.mainFrame.aveProfitText:SetText(("%d金"):format(max(GM:GetProfit()/GM:GetNumMembers(),0))) else self.mainFrame.aveProfitText:SetText("N/A") end self.mainFrame.profitText:SetText(("%d金"):format(GM:GetProfit())) self.mainFrame.tankSubsideText:SetText(("%d金"):format(GM:GetTankSubsidy())) self.mainFrame.healerSubsideText:SetText(("%d金"):format(GM:GetHealerSubsidy())) end function UM:OnInitialize() T.debug(3,"<UM>: Initializing...") self.newIncomeFrame = GDKP_b46a9a8d0d453ba05fdc42241de4dbf1() GDKP_ecdc44ef55e944effa19684f3c4c942a() GDKP_a46102b8fc80c5b62666117722e42454() GDKP_1d708ad1bb49e15326da5aca9c924459() self.manageFrame = GDKP_e838e7b159f6b9b809176a283d1d7502() self.mainFrame = GDKP_9693cf7251ebd2f6eb6bc572b2e5a188() end function UM:OnEnable() T.debug(3,"<UM>: Enabling...") T.debug(3,"<UM>: Enabled") end function UM:OnDisable() end function UM:Reset() UM:UpdateGoldDisplay() self.mainFrame.editable:Hide() self.newIncomePanel:Hide() self.manageFrame:Hide() end function T:Reset() RM:Reset() GM:Reset() UM:Reset() end function T:Report() if GetNumGroupMembers() < 1 then return end local str = "*** [GDKP] 团队通报 ***\n" str = str ..RM:GetReport(function(report) if AceOO.inherits(report,T.Templates.TrivialRecord) then return false end return true end) str = str ..GM:GetReport() str = str .."-感谢使用大脚金团辅助工具-\n" for line in str:gmatch("[^\n]+") do SendChatMessage(line, "RAID") end end function T:OnInitialize() T.debug(3,"<GDKP>: Initializing...") self.db = LibStub("AceDB-3.0"):New("GDKP_DB", defaults, true) end function T:CHAT_MSG_LOOT(...) local _,message = ... local player, itemLink,itemString = GDKP_93dd10c14ba6d9968dde1fcd8b5345c8(message) if not player then return end T.debug(2,"<GDKP>:Player is "..player) T.debug(2,"<GDKP>:ItemLink is "..itemLink) T.debug(2,"<GDKP>:ItemString is "..itemString) local name, link, quality = GetItemInfo(itemLink) if (name and quality) then if GDKP_332126e2e82fafa6f5d15f912aba69c6(link) then return end if quality >= 4 or _debug >= 1 then RM:AddRecord(RM:NewRecord("NormalItem",{},itemString,player)) end end end function T:CHAT_MSG_SYSTEM(...) local _,message = ... local member1 = message and message:match(GDKP_RAID_MEMBER_ADDED) local member2 = message and message:match(GDKP_RAID_MEMBER_REMOVED) local member3 = message and message:match(GDKP_RAID_YOU_JOINED) local member4 = message and message:match(GDKP_RAID_YOU_LEFT) T.debug(2,"<GDKP>:System message is "..message) if member1 then T.debug(2,"<GDKP>: "..member1.." joined party" ) RM:AddRecord(RM:NewRecord("Trivial",{},1,member1)) EM:FireEvent("NUM_MEMBER_CHANGED") elseif member2 then T.debug(2,"<GDKP>: "..member2.." left party" ) RM:AddRecord(RM:NewRecord("Trivial",{},2,member2)) EM:FireEvent("NUM_MEMBER_CHANGED") elseif member3 then T.debug(2,"<GDKP>: "..UnitName("player").." joined party" ) RM:AddRecord(RM:NewRecord("Trivial",{},1,UnitName("player"))) EM:FireEvent("NUM_MEMBER_CHANGED") elseif member4 then T.debug(2,"<GDKP>: "..UnitName("player").." left party" ) RM:AddRecord(RM:NewRecord("Trivial",{},2,UnitName("player"))) EM:FireEvent("NUM_MEMBER_CHANGED") end end function T:SetItemRef(link,text,button,...) local panel = _G["RecordItemEditableUI"] local panelText = _G["RecordItemEditableUIDescText"] if (panel and panel:IsVisible() and panelText:HasFocus()) then local _, GDKP_15ad1e501e228eb80be1cc7800ab967d= GetItemInfo(link) if GDKP_15ad1e501e228eb80be1cc7800ab967d then if GDKP_d46ced55976240072f56c23890a2fc3b(panelText:GetText()) then return end panelText:SetText(panelText:GetText()..GDKP_15ad1e501e228eb80be1cc7800ab967d) else self.hooks.SetItemRef(link,text,button,...) end else self.hooks.SetItemRef(link,text,button,...) end end function T:ChatEdit_InsertLink(text) if not text then return end T.debug(2,"ChatEdit_InsertLink() - Itemlink: "..text) local panel = _G["RecordItemEditableUI"] local panelText = _G["RecordItemEditableUIDescText"] if (panel and panel:IsVisible() and panelText:HasFocus()) then if GDKP_d46ced55976240072f56c23890a2fc3b(panelText:GetText()) then return false end T.debug(2,"ChatEdit_InsertLink(): Editbox adding link") panelText:SetText(panelText:GetText()..text) return true else self.hooks.ChatEdit_InsertLink(text) end end local GDKP_TOGGLE_TEXT if (GetLocale() == "zhTW") then GDKP_TOGGLE_TEXT="點擊打開關閉大腳金團助手" elseif(GetLocale() == "zhCN") then GDKP_TOGGLE_TEXT="点击打开关闭大脚金团助手" else GDKP_TOGGLE_TEXT="Click to toggle GDKP" end local LDB = LibStub("LibDataBroker-1.1", true) if not LDB then return end local GDKPLauncher = LDB:NewDataObject("GDKP", { type = "launcher", icon = "Interface\\Icons\\inv_misc_coin_17", label = GDKP_TOGGLE_TEXT, OnClick = function() if GDKPMainFrame:IsShown() then HideGDKPPanel() else GDKPMainFrame:SetClampedToScreen(true); ShowGDKPPanel() end end, OnTooltipShow = function(tt) tt:AddLine(GDKP_TEXT_TITLE) tt:AddLine(GDKP_TOGGLE_TEXT) end, }) local GDKPLDBIcon = LibStub("LibDBIcon-1.0", true) if not GDKPLDBIcon then return end hooksecurefunc(GDKP,"OnInitialize",function(self) self.db.profile.minimap = self.db.profile.minimap or { hide = false, minimapPos = 240, radius = 80, } GDKPLDBIcon:Register("GDKP", GDKPLauncher, self.db.profile.minimap) end) function T:OnEnable() T.debug(3,"<GDKP>: Enabling...") GDKP_9f069b4b2abd8b59dd593eb05c0eb053() self:RegisterEvent("CHAT_MSG_SYSTEM") self:RegisterEvent("CHAT_MSG_LOOT") self:RawHook("SetItemRef",true) self:RawHook("ChatEdit_InsertLink",true) EM:RegisterEvent("UPDATE_GOLD",GM.UpdateRecords,GM) EM:RegisterEvent("UPDATE_GOLD",UM.UpdateGoldDisplay,UM) EM:RegisterEvent("NUM_MEMBER_CHANGED",UM.OnRaidMemberChange,UM) GDKPLDBIcon:Show("GDKP") end function T:OnDisable() GDKPLDBIcon:Hide("GDKP") end local TM = T:NewModule("TestManager") if not TM then return end --[[ function TM:TestNormalItemRecord() local testDB1 = {} local record1 = T.Templates.NormalItemRecord:new(testDB1,"ItemName") print(record1) record1:SetUnit("Unit1") record1:SetIncome(500) print(record1) end function TM:TestSpecialIncomeRecord() local testDB2 = {} local record2 = T.Templates.SpecialIncomeRecord:new(testDB2,"ItemDesc") print(record2) record2:SetUnit("Unit1") record2:SetIncome(500) print(record2) end function TM:TestExpenseRecord() local testDB3 = {} local record3 = T.Templates.ExpenseRecord:new(testDB3,2) print(record3) record3:SetExpense(500) print(record3) end function TM:TestTrivialRecord() local testDB4 = {} local record4 = T.Templates.TrivialRecord:new(testDB4,2,"UnitName") print(record4) end function TM:TestRecordGoldEditable() local testDB2 = {} local record2 = T.Templates.SpecialIncomeRecord:new(testDB2,"ItemDesc") record2:SetUnit("Unit1") record2:SetIncome(500) local editable = T.Templates.RecordGoldEditable:new("GDKPTestGoldEditable") editable:SetPoint("CENTER",UIParent,"CENTER",0,-100) editable:SetRecord(record2) editable:Update() end function TM:TestRecordItemEditable() local editable = T.Templates.RecordItemEditable:new("GDKPTestItemEditable") editable:SetPoint("CENTER",UIParent,"CENTER",0,-200) editable:Show() end function TM:TestRecordExpenseEditable() local editable = T.Templates.RecordExpenseEditable:new("GDKPTestExpenseEditable") editable:SetPoint("CENTER",UIParent,"CENTER",0,-400) editable:Show() end function TM:TestLogCell() local testDB1 = {} local record1 = T.Templates.NormalItemRecord:new(testDB1,"ItemName") record1:SetUnit("Unit1") record1:SetIncome(500) local cell = T.Templates.LogCell:new("GDKPTestLogCell") cell:SetPoint("CENTER",UIParent,"CENTER",0,400) cell:Update() cell:SetRecord(record1) cell:Update() end function TM:TestIncomeCell() local testDB1 = {} local record1 = T.Templates.NormalItemRecord:new(testDB1,"ItemName") record1:SetUnit("Unit1") record1:SetIncome(500) local cell = T.Templates.IncomeCell:new("GDKPTestIncomeCell") cell:SetPoint("CENTER",UIParent,"CENTER",0,300) cell:SetEditableCallback(function(editable) cell:Update() end) cell:SetDeleteCallback( function(cell) print(cell:GetRecord()) end ) cell:SetRecord(record1) cell:Update() end function TM:TestExpenseCell() local testDB3 = {} local record3 = T.Templates.ExpenseRecord:new(testDB3,2) record3:SetExpense(500) local cell = T.Templates.ExpenseCell:new("GDKPTestExpenseCell") cell:SetPoint("CENTER",UIParent,"CENTER",0,200) cell:Update() cell:SetRecord(record3) cell:Update() end function TM:TestNewIncomeCell() local testDB1 = {} local record1 = T.Templates.NormalItemRecord:new(testDB1,"ItemName") record1:SetUnit("Unit1") record1:SetIncome(500) local cell = T.Templates.NewIncomeCell:new("GDKPTestNewIncomeCell") cell:SetPoint("CENTER",UIParent,"CENTER",0,100) cell:Update() cell:SetRecord(record1) cell:Update() end function TM:TestPanels() end function TM:TestLogPanel() local testDB1,testDB2,testDB3,testDB4,testDB5,testDB6,testDB7,testDB8,testDB9 = {},{},{},{},{},{},{},{},{} local record1 = T.Templates.NormalItemRecord:new(testDB1,"ItemName1") record1:SetUnit("Unit1") record1:SetIncome(200) local record2 = T.Templates.NormalItemRecord:new(testDB2,"ItemName2") record2:SetUnit("Unit2") record2:SetIncome(400) local record3 = T.Templates.NormalItemRecord:new(testDB3,"ItemName3") record3:SetUnit("Unit3") record3:SetIncome(600) local record4 = T.Templates.NormalItemRecord:new(testDB4,"ItemName4") record4:SetUnit("Unit4") record4:SetIncome(800) local panel1 = T.Templates.LogPanel:new() panel1:Show() panel1:AddRecord(record1) panel1:AddRecord(record2) panel1:AddRecord(record3) panel1:AddRecord(record4) panel1:SetPoint("CENTER",UIParent,"CENTER",400,200) end ]] function TM:TestIncomePanel() local testDB1,testDB2,testDB3,testDB4,testDB5,testDB6,testDB7,testDB8,testDB9 = {},{},{},{},{},{},{},{},{} local record1 = T.Templates.NormalItemRecord:new(testDB1,"ItemName1") record1:SetUnit("Unit1") record1:SetIncome(200) local record2 = T.Templates.NormalItemRecord:new(testDB2,"ItemName2") record2:SetUnit("Unit2") record2:SetIncome(400) local record3 = T.Templates.NormalItemRecord:new(testDB3,"ItemName3") record3:SetUnit("Unit3") record3:SetIncome(600) local record4 = T.Templates.NormalItemRecord:new(testDB4,"ItemName4") record4:SetUnit("Unit4") record4:SetIncome(800) local record5 = T.Templates.NormalItemRecord:new(testDB5,"ItemName5") record5:SetUnit("Unit5") record5:SetIncome(800) local record6 = T.Templates.NormalItemRecord:new(testDB6,"ItemName6") record6:SetUnit("Unit6") record6:SetIncome(800) local record7 = T.Templates.NormalItemRecord:new(testDB7,"ItemName7") record7:SetUnit("Unit7") record7:SetIncome(800) local record8 = T.Templates.NormalItemRecord:new(testDB8,"ItemName8") record8:SetUnit("Unit8") record8:SetIncome(800) local record9 = T.Templates.NormalItemRecord:new(testDB9,"ItemName9") record9:SetUnit("Unit9") record9:SetIncome(800) local panel1 = T.Templates.IncomePanel:new() panel1:Show() panel1:AddRecord(record1) panel1:AddRecord(record2) panel1:AddRecord(record3) panel1:AddRecord(record4) panel1:AddRecord(record5) panel1:AddRecord(record6) panel1:AddRecord(record7) panel1:AddRecord(record8) panel1:AddRecord(record9) panel1:SetPoint("CENTER",UIParent,"CENTER",100,300) end function TM:TestNewIncomePanel() local testDB1,testDB2,testDB3,testDB4,testDB5,testDB6,testDB7,testDB8,testDB9 = {},{},{},{},{},{},{},{},{} local record1 = T.Templates.NormalItemRecord:new(testDB1,"ItemName1") record1:SetUnit("Unit1") record1:SetIncome(200) local record2 = T.Templates.NormalItemRecord:new(testDB2,"ItemName2") record2:SetUnit("Unit2") record2:SetIncome(400) local record3 = T.Templates.NormalItemRecord:new(testDB3,"ItemName3") record3:SetUnit("Unit3") record3:SetIncome(600) local record4 = T.Templates.NormalItemRecord:new(testDB4,"ItemName4") record4:SetUnit("Unit4") record4:SetIncome(800) local record5 = T.Templates.NormalItemRecord:new(testDB5,"ItemName5") record5:SetUnit("Unit5") record5:SetIncome(800) local panel1 = T.Templates.NewIncomePanel:new() panel1:Show() panel1:AddRecord(record1) panel1:AddRecord(record2) panel1:AddRecord(record3) panel1:AddRecord(record4) panel1:AddRecord(record5) panel1:AddRecord(record6) panel1:AddRecord(record7) panel1:AddRecord(record8) panel1:AddRecord(record9) panel1:SetPoint("CENTER",UIParent,"CENTER",100,-300) end function TM:TestExpensePanel() local testDB4,testDB5,testDB6,testDB7,testDB8= {},{},{},{},{} local record4 = T.Templates.ExpenseRecord:new(testDB4,2) record4:SetExpense(300) local record5 = T.Templates.ExpenseRecord:new(testDB5,3) record5:SetExpense(500) local record6 = T.Templates.ExpenseRecord:new(testDB6,1) record6:SetExpense(200) local record7 = T.Templates.ExpenseRecord:new(testDB7,2) record7:SetExpense(700) local record8 = T.Templates.ExpenseRecord:new(testDB8,3) record8:SetExpense(900) local panel1 = T.Templates.ExpensePanel:new() panel1:Show() panel1:AddRecord(record4) panel1:AddRecord(record5) panel1:AddRecord(record6) panel1:AddRecord(record7) panel1:AddRecord(record8) panel1:SetPoint("CENTER",UIParent,"CENTER",700,300) end function TM:Run() DEFAULT_CHAT_FRAME:SetMaxResize(600,1000) DEFAULT_CHAT_FRAME:SetMaxLines(2000) print("|cff3344AA***************** <TM> *****************|r ") print("|cff3344AA************* Tests Start **************|r") print("|cff3344AA********************************************|r ") print("") local success,failed,res,messages = 0,0,true,{} for inx,val in pairs(self) do if inx:find("^Test") and type(val)=='function' then local message print(" ") print("|cff3344AA******************|r") print("|cff3344AA<TM>:|r Running "..inx.."()") res,message = pcall(val,self) if res then success = success + 1 print("|cff00DD22<TM>:|r "..inx.."() Succeed.") else failed = failed + 1 messages[inx] = message print("|cffEE0022<TM>: |r "..inx.."() Failed.") end print("|cff3344AA******************|r") end end print(" ") print("|cff3344AA***************** <TM> *****************|r ") print("|cff3344AA************* Tests Ended ************|r") print("|cff3344AA********************************************|r ") if failed > 0 then print ("|cff3344AA<TM>:|r Total |cffEE0022"..success+failed .."|r test cases ran, |cffEE0022"..success.."/"..(success+failed).."|r Succeed.") else print ("|cff3344AA<TM>:|r Total |cff00DD22"..success+failed .."|r test cases ran, |cff00DD22"..success.."/"..(success+failed).."|r Succeed.") end for inx,val in pairs(messages) do print("|cffEE0022<TM>: |r"..inx.." Failed at: |cffCC0022"..val.."|r") end end function TM:OnEnable() end function TM:OnDisable() end
22,068.5
44,136
0.782654
d4c649eb8b2d3785a7dd53d4d5eea4a5d47a939e
2,285
dart
Dart
lib/modules/system/page_system_index.dart
JasonXuJie/FlutterWanAndroid
1978c8477e32d755b236de7300d7db62d283c01b
[ "Apache-2.0" ]
1
2021-06-29T02:39:21.000Z
2021-06-29T02:39:21.000Z
lib/modules/system/page_system_index.dart
JasonXuJie/FlutterWanAndroid
1978c8477e32d755b236de7300d7db62d283c01b
[ "Apache-2.0" ]
null
null
null
lib/modules/system/page_system_index.dart
JasonXuJie/FlutterWanAndroid
1978c8477e32d755b236de7300d7db62d283c01b
[ "Apache-2.0" ]
null
null
null
import 'package:flutter/material.dart'; import 'package:Inke/widgets/gaps.dart'; import 'package:Inke/widgets/text.dart'; import 'package:Inke/modules/system/system/page_system.dart'; import 'package:Inke/modules/system/navigation/page_nav.dart'; import 'package:get/get.dart'; import 'package:Inke/router/navigator_util.dart'; import 'package:Inke/router/routes.dart'; class SystemIndexPage extends StatefulWidget { const SystemIndexPage({Key key}) : super(key: key); @override _State createState() => _State(); } class _State extends State<SystemIndexPage> with AutomaticKeepAliveClientMixin{ var _index = 0.obs; final _pageController = PageController(); @override Widget build(BuildContext context) { super.build(context); return Scaffold( appBar: AppBar( title: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Obx(()=>GestureDetector( onTap: (){ _index.value = 0; _pageController.jumpToPage(0); }, child: Text('体系',style:_index.value == 0 ?TextStyles.whiteNormal14:TextStyles.greyNormal14), )), Gaps.hGap15, Obx(()=>GestureDetector( onTap: (){ _index.value = 1; _pageController.jumpToPage(1); }, child: Text('导航',style:_index.value == 1 ?TextStyles.whiteNormal14:TextStyles.greyNormal14), )) ], ), centerTitle: true, actions: [ Obx(()=>Visibility( visible: _index.value ==0, child: IconButton( icon: Icon(Icons.search,color: Colors.white,size: 20,), onPressed: (){ NavigatorUtil.push(Routes.search,arguments: {'hint':'请输入作者昵称,支持模糊匹配','isSearchAuthor':true}); } ) )) ], ), body: PageView( controller: _pageController, onPageChanged: (int index){ _index.value = index; _pageController.jumpToPage(index); }, children: [ const SystemPage(), const NavPage() ], ), ); } @override bool get wantKeepAlive => true; }
29.294872
115
0.569365
af0b79d44a1325389de6e3a681b3cb432b2b8a95
1,752
py
Python
src/models/categories_products/categories_products.py
nnecklace/webi-shoppi
140d1e6ea8d019aa10ee2104e1bbd2baf0b9aa0f
[ "MIT" ]
null
null
null
src/models/categories_products/categories_products.py
nnecklace/webi-shoppi
140d1e6ea8d019aa10ee2104e1bbd2baf0b9aa0f
[ "MIT" ]
2
2020-06-02T13:55:02.000Z
2020-06-16T17:58:55.000Z
src/models/categories_products/categories_products.py
nnecklace/webi-shoppi
140d1e6ea8d019aa10ee2104e1bbd2baf0b9aa0f
[ "MIT" ]
null
null
null
from src.db import db from sqlalchemy import exc from src.models import Product, Category import sys class CategoryProduct(db.Model): __tablename__ = "categories_products" __table_args__ = ( db.PrimaryKeyConstraint("category_id", "product_id"), ) category_id = db.Column(db.Integer, db.ForeignKey("categories.id"), nullable=False) product_id = db.Column(db.Integer, db.ForeignKey("products.id", ondelete="CASCADE"), nullable=False) def add_product_categories(self, product_id, categories): curr_product = Product.query.get(product_id) if not curr_product: return False categories = list(map(lambda cat: int(cat), categories)) # delete the categories not selected in update CategoryProduct.query \ .filter(CategoryProduct.product_id == product_id) \ .filter(CategoryProduct.category_id.notin_(categories)) \ .delete(synchronize_session="fetch") # everytime we access the property categories a query is made # this is why we save it in a variable curr_categories = list(map(lambda cat: cat.id, curr_product.categories)) if len(categories) > 0: db.session().bulk_insert_mappings( CategoryProduct, [ {"category_id": category, "product_id": product_id} for category in [cat for cat in categories if cat not in curr_categories] ] ) try: db.session().commit() except exc.SQLAlchemyError as err: print("[ERROR] Batch insert product categories " + str(err), sys.stderr) return False return True
36.5
104
0.621575
98bd1da696805162a8d8eb6e4e3f90f73d644b0d
4,662
swift
Swift
TidepoolOnboarding/Views/OnboardingSectionNavigationButton.swift
tidepool-org/TidepoolOnboarding
521bcf7cdb492bede32823a4c2a1da33c939cce6
[ "BSD-2-Clause" ]
null
null
null
TidepoolOnboarding/Views/OnboardingSectionNavigationButton.swift
tidepool-org/TidepoolOnboarding
521bcf7cdb492bede32823a4c2a1da33c939cce6
[ "BSD-2-Clause" ]
23
2021-02-09T03:57:02.000Z
2022-03-11T03:58:35.000Z
TidepoolOnboarding/Views/OnboardingSectionNavigationButton.swift
tidepool-org/TidepoolOnboarding
521bcf7cdb492bede32823a4c2a1da33c939cce6
[ "BSD-2-Clause" ]
null
null
null
// // OnboardingSectionNavigationButton.swift // TidepoolOnboarding // // Created by Darin Krauss on 3/4/21. // Copyright © 2021 Tidepool Project. All rights reserved. // import SwiftUI import LoopKitUI struct OnboardingSectionNavigationButton<Destination: View>: View { @EnvironmentObject var onboardingViewModel: OnboardingViewModel private let section: OnboardingSection private let destination: Destination private let action: () -> Bool init(section: OnboardingSection, destination: Destination, action: @escaping () -> Bool = { true }) { self.section = section self.destination = destination self.action = action } var body: some View { button .accessibilityElement(children: .ignore) .accessibilityLabel(accessibilityLabel) .accessibilityAddTraits(.isButton) } @ViewBuilder private var button: some View { switch onboardingViewModel.sectionProgression.stateForSection(section) { case .completed: content case .available: OnboardingSectionSheetButton(section: section, destination: destination, action: action) { content } case .unavailable: content .opacity(0.5) } } private var content: some View { VStack(alignment: .leading) { HStack { titleText Spacer() selectionIndicator .frame(width: 22, height: 22) .foregroundColor(.accentColor) .alertOnLongPressGesture(enabled: onboardingViewModel.allowDebugFeatures && !onboardingViewModel.sectionProgression.hasCompletedSection(section), title: "Are you sure you want to skip through this section?") { // Not localized onboardingViewModel.skipThroughSection(section) // NOTE: DEBUG FEATURES - DEBUG AND TEST ONLY } } Spacer() durationText } .padding() .background(Color(.secondarySystemGroupedBackground)) .cornerRadius(10) } private var titleText: some View { Text(onboardingViewModel.titleForSection(section)) .font(.headline) .accentColor(.primary) } private var durationText: some View { Text(onboardingViewModel.durationStringForSection(section)) .font(.subheadline) .bold() .accentColor(.secondary) } @ViewBuilder private var selectionIndicator: some View { if onboardingViewModel.sectionProgression.hasCompletedSection(section) { Image(systemName: "checkmark.circle.fill") .resizable() } else { Circle() .stroke(lineWidth: 2) } } private var accessibilityLabel: String { return String(format: LocalizedString("%1@, %2@, %3@", comment: "Section navigation button accessibility label (1: title, 2: estimated duration, 3: state)"), onboardingViewModel.titleForSection(section), onboardingViewModel.durationStringForSection(section), onboardingViewModel.stateStringForSection(section)) } } struct OnboardingSectionNavigationButton_Previews: PreviewProvider { static var onboardingViewModel: OnboardingViewModel = { let onboardingViewModel = OnboardingViewModel.preview onboardingViewModel.skipUntilSection(.howTheAppWorks) return onboardingViewModel }() static var displayGlucoseUnitObservable: DisplayGlucoseUnitObservable = { return DisplayGlucoseUnitObservable.preview }() static var previews: some View { ContentPreviewWithBackground { VStack(alignment: .leading) { OnboardingSectionNavigationButton(section: .introduction, destination: CompleteDismissView()) .environmentObject(onboardingViewModel) .environmentObject(displayGlucoseUnitObservable) OnboardingSectionNavigationButton(section: .howTheAppWorks, destination: CompleteDismissView()) .environmentObject(onboardingViewModel) .environmentObject(displayGlucoseUnitObservable) OnboardingSectionNavigationButton(section: .aDayInTheLife, destination: CompleteDismissView()) .environmentObject(onboardingViewModel) .environmentObject(displayGlucoseUnitObservable) } } } }
36.708661
165
0.629987
afde0784cf1ff6bc8bb012426eaa000c29ffff65
2,517
py
Python
python/bootmenu.py
3mdeb/bits
19da7046a7303f1de8b53165eea1a6f486757c03
[ "BSD-3-Clause" ]
215
2015-08-05T07:31:35.000Z
2022-03-25T17:34:54.000Z
python/bootmenu.py
marcol3786/bits
19da7046a7303f1de8b53165eea1a6f486757c03
[ "BSD-3-Clause" ]
12
2015-09-07T14:09:53.000Z
2021-04-07T05:03:26.000Z
python/bootmenu.py
marcol3786/bits
19da7046a7303f1de8b53165eea1a6f486757c03
[ "BSD-3-Clause" ]
71
2015-08-05T02:35:13.000Z
2022-02-11T21:16:39.000Z
# Copyright (c) 2015, Intel Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # * Neither the name of Intel Corporation nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """Boot menu generation""" from __future__ import print_function import bits import ttypager created_boot_menu = False try: import efi boot_str = "{}-bit EFI".format(str(efi.ptrsize * 8)) have_efi = True except ImportError as e: boot_str = "32-bit BIOS" have_efi = False def generate_boot_menu(): global created_boot_menu, boot_str if created_boot_menu: return cfg = "" cfg += 'menuentry "{} boot detected" {{\n'.format(boot_str) cfg += """ py 'import bootmenu; bootmenu.callback()'\n""" cfg += '}\n' if have_efi: cfg += 'menuentry "Exit to EFI" {\n' cfg += """ py 'import efi; efi.exit()'\n""" cfg += '}\n' bits.pyfs.add_static("bootmenu.cfg", cfg) created_boot_menu = True def callback(): with ttypager.page(): print("{} boot detected".format(boot_str)) print("Tests and other menu entries tailored for this environment")
37.567164
81
0.715137
969fce68dbaae362f57029e5bccd0c5c5e32b7bf
3,242
dart
Dart
app14/lib/Home.dart
BryanSOliveira/flutter
d18d331868e4ebcf0d5e07f1047bd4f1d0e31f79
[ "MIT" ]
null
null
null
app14/lib/Home.dart
BryanSOliveira/flutter
d18d331868e4ebcf0d5e07f1047bd4f1d0e31f79
[ "MIT" ]
null
null
null
app14/lib/Home.dart
BryanSOliveira/flutter
d18d331868e4ebcf0d5e07f1047bd4f1d0e31f79
[ "MIT" ]
null
null
null
import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; class Home extends StatefulWidget { @override _HomeState createState() => _HomeState(); } class _HomeState extends State<Home> { @override void initState() { // TODO: implement initState super.initState(); pegarEstadoDia(); pegarEstadoFonte(); } String _textoSalvo = "Nada salvo!"; bool dia = true; bool pequeno = true; TextEditingController _controllerCampo = TextEditingController(); _salvar() async { String valorDigitado = _controllerCampo.text; final prefs = await SharedPreferences.getInstance(); await prefs.setString("nome", valorDigitado); print("Método Salvar: $valorDigitado"); } _recuperar() async { final prefs = await SharedPreferences.getInstance(); setState(() { _textoSalvo = prefs.getString("nome").toString(); }); print("Método Recuperar: $_textoSalvo"); } _remover() async { final prefs = await SharedPreferences.getInstance(); await prefs.remove("nome"); print("Método Remover"); } _blocoFrase() { return Container( padding: EdgeInsets.all(10), color: dia ? Colors.white : Colors.black26, child: Text( '"A vingança nunca é plena, mata a alma e envenena" (Seu Madruga)', style: TextStyle(fontSize: pequeno ? 15 : 30), ), ); } Future<bool> salvarEstadoDia(bool estado) async { final prefs = await SharedPreferences.getInstance(); await prefs.setBool("dia", dia); return prefs.setBool("dia", dia); } Future<bool> pegarEstadoDia() async { final prefs = await SharedPreferences.getInstance(); setState(() { dia = prefs.getBool("dia") == true; }); return dia; } Future<bool> salvarEstadoFonte(bool pequeno) async { final prefs = await SharedPreferences.getInstance(); await prefs.setBool("pequeno", pequeno); return prefs.setBool("pequeno", pequeno); } Future<bool> pegarEstadoFonte() async { final prefs = await SharedPreferences.getInstance(); setState(() { pequeno = prefs.getBool("pequeno") == true; }); return pequeno; } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Frases"), centerTitle: true, ), body: Container( padding: EdgeInsets.all(32), child: Column( children: <Widget>[ Row( children: <Widget>[ Text('Dia'), Switch( value: dia, onChanged: (value) { setState(() { dia = value; salvarEstadoDia(value); }); }, ), Text('Pequeno'), Switch( value: pequeno, onChanged: (value) { setState(() { pequeno = value; salvarEstadoFonte(pequeno); }); }, ), ], ), _blocoFrase(), ], ), ), ); } }
24.748092
75
0.553671
7dcc641952600c7bc8b964bfc5639cd47345c428
373
rb
Ruby
lib/acts_as_list/active_record/acts/top_of_list_method_definer.rb
co-op-plug/acts_as_list
983be695a20885f9ff18acacafaf4efda27a6829
[ "MIT" ]
null
null
null
lib/acts_as_list/active_record/acts/top_of_list_method_definer.rb
co-op-plug/acts_as_list
983be695a20885f9ff18acacafaf4efda27a6829
[ "MIT" ]
null
null
null
lib/acts_as_list/active_record/acts/top_of_list_method_definer.rb
co-op-plug/acts_as_list
983be695a20885f9ff18acacafaf4efda27a6829
[ "MIT" ]
null
null
null
# frozen_string_literal: true module ActiveRecord::Acts::List::TopOfListMethodDefiner #:nodoc: def self.call(caller_class, top_of_list) caller_class.class_eval do define_method :acts_as_list_top do if top_of_list.respond_to? :call top_of_list.call(self) else top_of_list.to_i end end end end end
20.722222
64
0.662198
877c3b031f709df110aaba46cf41b42b891ceb40
799
rb
Ruby
lib/simple_apns/error.rb
julesjans/simple_apns
572a32870d86201cdcdab4998969d649ae45acf0
[ "MIT" ]
null
null
null
lib/simple_apns/error.rb
julesjans/simple_apns
572a32870d86201cdcdab4998969d649ae45acf0
[ "MIT" ]
null
null
null
lib/simple_apns/error.rb
julesjans/simple_apns
572a32870d86201cdcdab4998969d649ae45acf0
[ "MIT" ]
null
null
null
module SimpleAPNS class Error def self.process_error_response(error) puts "hello there has been an error: #{error.inspect}" end end class ServerFailure < StandardError def message "Could not communicate with the server" end end class SocketFailure < StandardError def message "Could not communicate with the socket" end end class NotificationSize < StandardError def message "The notification payload must be under 256 bytes" end end class MissingCertificate < StandardError def message "You must congfigure a certificate for this server" end end class MissingPid < StandardError def message "You must congfigure a pidfile location for this server" end end end
19.487805
62
0.678348
3c660acec9b2ba9ab1c448a58d06c1fb002c7d15
1,430
ps1
PowerShell
Modules/TechnologyToolbox.Core/Private/RemoveRegistryKeyIfEmpty.Tests.ps1
technology-toolbox/PowerShell
403531b298403befa0a7c41ab26bbfacebc95a9e
[ "MIT" ]
null
null
null
Modules/TechnologyToolbox.Core/Private/RemoveRegistryKeyIfEmpty.Tests.ps1
technology-toolbox/PowerShell
403531b298403befa0a7c41ab26bbfacebc95a9e
[ "MIT" ]
13
2019-02-26T16:19:40.000Z
2019-03-06T15:24:14.000Z
Modules/TechnologyToolbox.Core/Private/RemoveRegistryKeyIfEmpty.Tests.ps1
technology-toolbox/PowerShell
403531b298403befa0a7c41ab26bbfacebc95a9e
[ "MIT" ]
1
2022-01-05T07:56:09.000Z
2022-01-05T07:56:09.000Z
. $PSScriptRoot\RemoveRegistryKeyIfEmpty.ps1 Describe 'RemoveRegistryKeyIfEmpty Tests' { New-Item 'TestRegistry:\Empty' New-Item 'TestRegistry:\KeyWithChild' New-Item 'TestRegistry:\KeyWithChild\Child' New-Item 'TestRegistry:\KeyWithProperty' Set-ItemProperty 'TestRegistry:\KeyWithProperty' -Name 'SomeProperty' -Value 0 Mock Remove-Item {} Context '[Registry key does not exist]' { RemoveRegistryKeyIfEmpty 'TestRegistry:\SomeKeyThatDoesNotExist' It 'Does not attempt to remove registry key' { Assert-MockCalled Remove-Item -Times 0 } } Context '[Empty registry key]' { RemoveRegistryKeyIfEmpty 'TestRegistry:\Empty' It 'Removes registry key' { Assert-MockCalled Remove-Item -Times 1 -Exactly Assert-MockCalled Remove-Item -Times 1 -Exactly ` -ParameterFilter { $Path -eq 'TestRegistry:\Empty' } } } Context '[Registry key with child item]' { RemoveRegistryKeyIfEmpty 'TestRegistry:\KeyWithChild' It 'Does not remove registry key' { Assert-MockCalled Remove-Item -Times 0 } } Context '[Registry key with property]' { RemoveRegistryKeyIfEmpty 'TestRegistry:\KeyWithProperty' It 'Does not remove registry key' { Assert-MockCalled Remove-Item -Times 0 } } }
30.425532
82
0.637063
7e3cec14dc82856a84b2ab060a0473b6526f1fd0
578
swift
Swift
MEADepthCamera/File IO/OutputType.swift
pnhwill/mea-depth-camera
81df92dcaeda4cb466eeb85a5c7ce36cfff88ce2
[ "MIT" ]
2
2021-12-11T03:36:55.000Z
2022-02-01T08:41:31.000Z
MEADepthCamera/File IO/OutputType.swift
pnhwill/mea-depth-camera
81df92dcaeda4cb466eeb85a5c7ce36cfff88ce2
[ "MIT" ]
null
null
null
MEADepthCamera/File IO/OutputType.swift
pnhwill/mea-depth-camera
81df92dcaeda4cb466eeb85a5c7ce36cfff88ce2
[ "MIT" ]
1
2021-12-09T08:46:21.000Z
2021-12-09T08:46:21.000Z
// // OutputType.swift // MEADepthCamera // // Created by Will on 7/29/21. // import Foundation /// Enumeration of the different output files saved to the device. enum OutputType: String { case video case audio case depth case landmarks2D case landmarks3D case info case frameIndex var fileExtension: String { switch self { case .video, .depth: return "mov" case .audio: return "wav" case .landmarks2D, .landmarks3D, .info, .frameIndex: return "csv" } } }
18.645161
66
0.584775
4d3b8d680d54b35918316e666cb5575652e0eb37
1,103
cs
C#
Performance/WcfService/Global.asax.cs
neuecc/LightNode
61fa59623904515e37df5c59ca56a806c1506a27
[ "MIT" ]
160
2015-01-02T13:02:37.000Z
2022-03-31T03:19:31.000Z
Performance/WcfService/Global.asax.cs
neuecc/LightNode
61fa59623904515e37df5c59ca56a806c1506a27
[ "MIT" ]
25
2015-01-26T15:06:50.000Z
2016-09-27T10:30:18.000Z
Performance/WcfService/Global.asax.cs
neuecc/LightNode
61fa59623904515e37df5c59ca56a806c1506a27
[ "MIT" ]
38
2015-02-24T07:27:55.000Z
2022-02-23T17:20:58.000Z
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Activation; using System.Web; using System.Web.Routing; using System.Web.Security; using System.Web.SessionState; namespace WcfService { public class Global : System.Web.HttpApplication { protected void Application_Start(object sender, EventArgs e) { RouteTable.Routes.Add( new ServiceRoute("Home", new WebServiceHostFactory(), typeof(Home))); } protected void Session_Start(object sender, EventArgs e) { } protected void Application_BeginRequest(object sender, EventArgs e) { } protected void Application_AuthenticateRequest(object sender, EventArgs e) { } protected void Application_Error(object sender, EventArgs e) { } protected void Session_End(object sender, EventArgs e) { } protected void Application_End(object sender, EventArgs e) { } } }
21.211538
82
0.612874
0d4a1bb96450d5988c17b6db2876b0a5952b413b
2,717
cs
C#
Showcases/GroupDocs.ReportGenerator/GroupDocs.ReportGenerator.DataAccessLayer/DBHandler.cs
aliahmedgroupdocs/GroupDocs.Assembly-for-.NET
d1ecdc944f957e90cb649e150d500560cf131d86
[ "MIT" ]
4
2017-12-15T19:35:33.000Z
2020-07-13T10:28:09.000Z
Showcases/GroupDocs.ReportGenerator/GroupDocs.ReportGenerator.DataAccessLayer/DBHandler.cs
aliahmedgroupdocs/GroupDocs.Assembly-for-.NET
d1ecdc944f957e90cb649e150d500560cf131d86
[ "MIT" ]
3
2015-11-25T04:01:52.000Z
2016-03-10T06:16:35.000Z
Showcases/GroupDocs.ReportGenerator/GroupDocs.ReportGenerator.DataAccessLayer/DBHandler.cs
aliahmedgroupdocs/GroupDocs.Assembly-for-.NET
d1ecdc944f957e90cb649e150d500560cf131d86
[ "MIT" ]
10
2016-05-18T08:37:22.000Z
2021-09-01T02:21:37.000Z
using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Text; namespace GroupDocs.ReportGenerator.DataAccessLayer { /// <summary> /// General Database Handler /// </summary> public class DBHandler { SqlConnection sqlCon = new SqlConnection(); SqlCommand cmd = new SqlCommand(); DataSet ds = new DataSet(); string _ConnectionString = ""; public string ConnectionString { get { return _ConnectionString; } set { _ConnectionString = value; } } public DBHandler(String ConnString) { _ConnectionString = ConnString; } public SqlConnection getConnection() { return sqlCon; } /// <summary> /// Method to open a Database connection /// </summary> /// <returns></returns> public SqlConnection openConnection() { if (sqlCon.State != ConnectionState.Open) { sqlCon.ConnectionString = _ConnectionString; sqlCon.Open(); } return sqlCon; } /// <summary> /// Method to close a connection /// </summary> public void closeConnection() { if (sqlCon.State != ConnectionState.Closed) { sqlCon.Close(); } } /// <summary> /// If wanna execute Insert,Update and Delete /// </summary> /// <param name="sqlQuery">Query in the form of String</param> /// <returns>0 or 1</returns> public int Execute(string sqlQuery) { try { SqlCommand cmd = new SqlCommand(sqlQuery, sqlCon); openConnection(); int i = cmd.ExecuteNonQuery(); closeConnection(); return i; } catch (Exception ex) { closeConnection(); throw ex; } } /// <summary> /// To exectute select statement /// </summary> /// <param name="sql">Query in the form of String</param> /// <returns></returns> public DataSet ExecuteSelectQuery(string sql) { DataSet myDs = new DataSet(); SqlDataAdapter adapter = new SqlDataAdapter(sql, sqlCon); openConnection(); adapter.Fill(myDs); closeConnection(); return myDs; } } }
26.90099
71
0.487302
c549b4b332850f787682c10103aac570fc1a456d
1,922
css
CSS
data/usercss/13019.user.css
33kk/uso-archive
2c4962d1d507ff0eaec6dcca555efc531b37a9b4
[ "MIT" ]
118
2020-08-28T19:59:28.000Z
2022-03-26T16:28:40.000Z
data/usercss/13019.user.css
33kk/uso-archive
2c4962d1d507ff0eaec6dcca555efc531b37a9b4
[ "MIT" ]
38
2020-09-02T01:08:45.000Z
2022-01-23T02:47:24.000Z
data/usercss/13019.user.css
33kk/uso-archive
2c4962d1d507ff0eaec6dcca555efc531b37a9b4
[ "MIT" ]
21
2020-08-19T01:12:43.000Z
2022-03-15T21:55:17.000Z
/* ==UserStyle== @name Download Manager - Sydney yendys @namespace USO Archive @author yendys @description `"i gosto da gaby" by "sydney"` @version 20081216.19.52 @license NO-REDISTRIBUTION @preprocessor uso ==/UserStyle== */ body{ background-image: url(data:image/gif;base64,R0lGODlhAQDpAvcAAExBQUhCQklCQktBQUdDQ0xAQE1AQEpBQU4/P05AQE8/P1A/P1E+PlI+PlU9PVU8PFQ9PVY8PFs6OlM9PVc8PFg7O1k7O1c7O1o6Olw5OV05OV44OF45OV84OGA4OGI3N2E3N2U1NWM2NmQ2Nmk0NGY1NWA3N2c1NWg0NGkzM2c0NGozM2szM2wyMm0yMm8xMXAxMXIwMHEwMHIvL3AwMHMvL3ktLXQvL3UuLnYuLm4xMXksLHgtLXctLXosLHsrK3ssLHwrK30rK38qKn4qKoApKYEpKYIoKIIpKYMoKIQoKIUnJ4YnJ4slJYcmJogmJoklJYolJYQnJ4wkJI0kJI0jI44jI4skJI8jI5AiIpEiIpIhIZMhIZQhIZYgIJYfH5UgIJgfH5cfH50dHZkeHpoeHpQgIJwdHaYZGZsdHZ4cHJ8bG58cHKAbG6EbG50cHKMaGqUZGaIaGqQZGaYYGKcYGKgYGKkXF6oXF68VFasWFqwWFq0VFa4VFagXF7AUFLEUFLMTE68UFLETE7ITE7QSErUSErYREbcREbgREboQELoPD7kQEMENDbsPD7wPD70ODr4ODsANDbgQEMEMDMQLC8IMDMMLC8MMDL8NDcULC8YKCscKCsoJCcoICMkJCcgJCcsICMwICM0HB84HB9AGBs8GBtIFBdEFBdcDA9MEBNMFBdQEBMwHB9UEBNYDA9UDA9gCAtkCAtoBAdsBAdwBAd0AANwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAQUAP8ALAAAAAABAOkCAAj5AG0JHEiw4EBZCBMqXMgwoauHECNKnFiqosWLGDNaFMWxo8ePHzmJHEmypMmRmFKqXMmyZaSXMGPKnAlTkc2bOHPqNMSzp8+fQHkCGkq0qNGje5IqXcq0qVI7UKNKnUoVjtWrWLNqtcqmq9evYMOWGUu2rNmzZL2oXcu2rVstcOPKnUs3LpW7ePPq1fukr9+/gAP7VUK4sOHDiIcoXsy4sePFQCJLnky5co7LmDNr3nw5hufPoEOLdkG6tOnTqEuTWM26tevXI2LLnk27dmwPuHPr3s1bgu/fwIML/02huPHjyJM3WM68ufPnzBNIn069enUB2LNr1x4QADs=) !important; background-repeat: repeat-x; background-attachment:fixed !important; background-color: #444444 !important; font-family: "Trebuchet MS" !important; color: #171717 !important; }
106.777778
1,462
0.908949
d31c46f2c527ecec03cfd6940bd9c021b2e235b7
444
cs
C#
VehiclePassRegister/Profiles/VehicleProfile.cs
Sagor31h2/Vehicle-Pass-registration
f73e17c69dbfb418f7cd7643202bdacf25c228b7
[ "MIT" ]
null
null
null
VehiclePassRegister/Profiles/VehicleProfile.cs
Sagor31h2/Vehicle-Pass-registration
f73e17c69dbfb418f7cd7643202bdacf25c228b7
[ "MIT" ]
null
null
null
VehiclePassRegister/Profiles/VehicleProfile.cs
Sagor31h2/Vehicle-Pass-registration
f73e17c69dbfb418f7cd7643202bdacf25c228b7
[ "MIT" ]
null
null
null
using AutoMapper; using VehiclePassRegister.Models; using VehiclePassRegister.Models.Request; using VehiclePassRegister.Models.Response; namespace VehiclePassRegister.Profiles { public class VehicleProfile : Profile { public VehicleProfile() { CreateMap<Vehicle, VehicleReplyDto>(); CreateMap<VehicleCreateDto, Vehicle>(); CreateMap<VehicleUpdateDto, Vehicle>(); } } }
23.368421
51
0.682432
9816b104e42c67f2047a4e143731c03f7cc92184
250
py
Python
metagraph/tests/test_types.py
eriknw/metagraph-1
b6a4e92903e7779c31137a765cdb4852245918d2
[ "Apache-2.0" ]
null
null
null
metagraph/tests/test_types.py
eriknw/metagraph-1
b6a4e92903e7779c31137a765cdb4852245918d2
[ "Apache-2.0" ]
null
null
null
metagraph/tests/test_types.py
eriknw/metagraph-1
b6a4e92903e7779c31137a765cdb4852245918d2
[ "Apache-2.0" ]
null
null
null
import pytest from metagraph import types def test_nodemap_not_implemented(): nodemap = types.NodeMap() with pytest.raises(NotImplementedError): nodemap[0] with pytest.raises(NotImplementedError): nodemap.num_nodes()
17.857143
44
0.72
845f73004a2423d4947c4dc04e6bae8373732f1f
2,982
sql
SQL
sql/_23_apricot_qa/_01_sql_extension3/_04_mutitable_update_delete/_02_multi_table_delete/_01_delete_from_syntax/cases/multi_delete_clob.sql
Zhaojia2019/cubrid-testcases
475a828e4d7cf74aaf2611fcf791a6028ddd107d
[ "BSD-3-Clause" ]
9
2016-03-24T09:51:52.000Z
2022-03-23T10:49:47.000Z
sql/_23_apricot_qa/_01_sql_extension3/_04_mutitable_update_delete/_02_multi_table_delete/_01_delete_from_syntax/cases/multi_delete_clob.sql
Zhaojia2019/cubrid-testcases
475a828e4d7cf74aaf2611fcf791a6028ddd107d
[ "BSD-3-Clause" ]
173
2016-04-13T01:16:54.000Z
2022-03-16T07:50:58.000Z
sql/_23_apricot_qa/_01_sql_extension3/_04_mutitable_update_delete/_02_multi_table_delete/_01_delete_from_syntax/cases/multi_delete_clob.sql
Zhaojia2019/cubrid-testcases
475a828e4d7cf74aaf2611fcf791a6028ddd107d
[ "BSD-3-Clause" ]
38
2016-03-24T17:10:31.000Z
2021-10-30T22:55:45.000Z
--delete from 2 tables with clob type column for join condition, with composed index create table md_clob1(id1 numeric(10, 5), col1 timestamp not null default CURRENT_TIMESTAMP, col2 clob); insert into md_clob1 values(11111.11111, '2011-09-01 12:12:12', char_to_clob('cubrid')), (22222.22222, '2011-09-01 12:12:13', char_to_clob('mysql')), (33333.33333, '2011-09-01 12:12:14', char_to_clob('abc')), (44444.44444, '2011-09-01 12:12:15', char_to_clob('cubridcubrid')), (55555.55555, '2011-09-01 12:12:16', char_to_clob('mysqlmysql')), (66666.66666, '2011-09-01 12:12:17', char_to_clob('abcabc')); create table md_clob2(col1 clob, id2 numeric(10, 5)); insert into md_clob2 values(char_to_clob('cubrid'), 1234.12345), (char_to_clob('abcabc'), 3456.34555), (char_to_clob('a'), 55555.55555), (char_to_clob('abcabc'), 444.12345), (char_to_clob('aa'), 5555.1234), (char_to_clob('mysql'), 22222.22222); insert into md_clob2 values(char_to_clob('cubridcubrid'), 666.6666), (char_to_clob('mysqlmysql'), 44444.44444), (char_to_clob('aaaa'), 5656.56565), (char_to_clob('abcabcabc'), 66666.66666), (char_to_clob('hello'), 77.88777), (char_to_clob('hellohello'), 90000.909); --error, false join condition delete m1, m2 from md_clob1 m1, md_clob2 m2 where m1.col2=m2.id2; --without table aliases, 1 row deleted in eache table delete md_clob1, md_clob2 from md_clob1, md_clob2 where clob_to_char(md_clob1.col2)=clob_to_char(md_clob2.col1) and char_length(md_clob1.col1) > 5 and md_clob1.id1=md_clob2.id2; select if (count(*) = 5, 'ok', 'nok') from md_clob1; select if (count(*) = 11, 'ok', 'nok') from md_clob2; --with table aliases, 2 rows deleted delete m2 from md_clob1 m1, md_clob2 m2 where clob_to_char(m1.col2)=clob_to_char(m2.col1) and round(m2.id2) in (1234, 5555, 5657, 667); select if (count(*) = 5, 'ok', 'nok') from md_clob1; select if (count(*) = 9, 'ok', 'nok') from md_clob2; --inner join, 3 rows deleted delete m2 from md_clob2 as m2 inner join (select id1, trim(substr(clob_to_char(col2), 1, 6)) as col2 from md_clob1 where left(col2, 3) = 'abc') m1 on left(m1.col2, 3)=left(clob_to_char(m2.col1), 3); select if (count(*) = 5, 'ok', 'nok') from md_clob1; select if (count(*) = 6, 'ok', 'nok') from md_clob2; --left outer join, delete and select from the same table delete m1, md_clob2 from md_clob1 m1 left outer join md_clob2 on clob_to_char(m1.col2)=clob_to_char(md_clob2.col1) where m1.id1 > (select avg(id1) from md_clob1); select if (count(*) = 2, 'ok', 'nok') from md_clob1; select if (count(*) = 5, 'ok', 'nok') from md_clob2; --right outer join --delete and select from the same table delete m1, m2 from md_clob1 m1 right outer join md_clob2 m2 on clob_to_char(m1.col2)=clob_to_char(m2.col1) where m1.id1 < (select abs(avg(id2)) from md_clob2); select if (count(*) = 2, 'ok', 'nok') from md_clob1; select if (count(*) = 5, 'ok', 'nok') from md_clob2; --delete all data delete m1, m2 from md_clob1 m1, md_clob2 m2; drop table md_clob1, md_clob2;
48.096774
404
0.713615
2e5210f67476ca4233bcb2d9b67b3cc4491c75ec
93
swift
Swift
Tests/LinuxMain.swift
KritR/MarkovAndMe
62dbfc99e7565a73d41d4dc502ee1ac6ef4f1d7f
[ "Apache-2.0" ]
null
null
null
Tests/LinuxMain.swift
KritR/MarkovAndMe
62dbfc99e7565a73d41d4dc502ee1ac6ef4f1d7f
[ "Apache-2.0" ]
null
null
null
Tests/LinuxMain.swift
KritR/MarkovAndMe
62dbfc99e7565a73d41d4dc502ee1ac6ef4f1d7f
[ "Apache-2.0" ]
null
null
null
import XCTest @testable import GetStartedTests XCTMain([ testCase(Tests1.allTests), ])
13.285714
32
0.752688
7982cd8f5ffe6225202ddfc624f46a8fb8e5d64c
222
php
PHP
resources/views/teams/index.blade.php
Dalibor989/nba-take-two
45975879ae842b7b6e2d7eadb4e39e651429d9d1
[ "MIT" ]
null
null
null
resources/views/teams/index.blade.php
Dalibor989/nba-take-two
45975879ae842b7b6e2d7eadb4e39e651429d9d1
[ "MIT" ]
null
null
null
resources/views/teams/index.blade.php
Dalibor989/nba-take-two
45975879ae842b7b6e2d7eadb4e39e651429d9d1
[ "MIT" ]
null
null
null
@extends('layouts.app') @section('title', 'Teams') @section('content') <h3>Teams:</h3> @foreach($teams as $team) <p><a href="{{ route('show.teams', ['team' => $team]) }}">{{ $team->name }}</a></p> @endforeach @endsection
22.2
83
0.599099
ddbebbc2e2fbab2a81eca813a1852e1aedd0ddb1
2,027
java
Java
pcgen/code/src/java/pcgen/cdom/identifier/SpellSchool.java
odraccir/pcgen-deprecated
ab07cb4250e5d0419fd805197fb040a2ea425cc8
[ "OML" ]
1
2020-01-12T22:28:29.000Z
2020-01-12T22:28:29.000Z
pcgen/code/src/java/pcgen/cdom/identifier/SpellSchool.java
allardhoeve/pcgen-multiline-objects
2643b8cde1b866121290b16c26d5c8bd7ad21cbc
[ "OML" ]
null
null
null
pcgen/code/src/java/pcgen/cdom/identifier/SpellSchool.java
allardhoeve/pcgen-multiline-objects
2643b8cde1b866121290b16c26d5c8bd7ad21cbc
[ "OML" ]
null
null
null
/* * Copyright (c) 2010 Tom Parker <[email protected]> * * 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; either version 2.1 of the License, or (at your option) * any 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 GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ package pcgen.cdom.identifier; import java.net.URI; import pcgen.cdom.base.Loadable; public class SpellSchool implements Loadable, Comparable<SpellSchool> { private URI sourceURI; private String name; @Override public String getDisplayName() { return name; } @Override public String getKeyName() { return name; } @Override public String getLSTformat() { return name; } @Override public boolean isInternal() { return false; } @Override public boolean isType(String type) { return false; } @Override public void setName(String newName) { name = newName; } @Override public String toString() { return name; } @Override public boolean equals(Object other) { return other instanceof SpellSchool && name.equals(((SpellSchool) other).name); } @Override public int hashCode() { return name.hashCode(); } @Override public int compareTo(SpellSchool other) { return name.compareTo(other.name); } @Override public URI getSourceURI() { return sourceURI; } @Override public void setSourceURI(URI source) { sourceURI = source; } }
19.490385
81
0.684756
674ca13dd53940fcd17ce3e33f535dba2d176c24
4,485
ps1
PowerShell
noiseTools/prependTimestamps.ps1
johnaho/Cloakify-Powershell
700ec8030c57ff6dc8e6d3be6627b3a65861047c
[ "MIT" ]
33
2017-07-21T13:47:05.000Z
2020-05-10T07:11:25.000Z
noiseTools/prependTimestamps.ps1
dumpsterfirevip/Cloakify-Powershell
700ec8030c57ff6dc8e6d3be6627b3a65861047c
[ "MIT" ]
null
null
null
noiseTools/prependTimestamps.ps1
dumpsterfirevip/Cloakify-Powershell
700ec8030c57ff6dc8e6d3be6627b3a65861047c
[ "MIT" ]
8
2018-05-12T16:31:10.000Z
2020-10-18T04:28:21.000Z
# # Filename: prependTimestamps.py # # Version: 1.0.1 # # Author: Joe Gervais (TryCatchHCF) # # Ported to Powershell by: John Aho # # Summary: Inserts datetimestamps in front of each line of a file. Used to # add noise to a cloaked file (see cloakify.py) in order to degrade frequency # analysis attacks against the cloaked payload. # # Description: # Takes current date and randomly subtracts 1011-1104 days to generate a # starting date. Then starts randomly incrementing the datetimestamp (between # 0-664 seconds) for each entry in the cloaked file. If the datetimestamp # reaches the current date, repeats the above steps to avoid generating # timestamps into the future. # # Example: # # $ ./prependTimestamps.ps1 cloaked.txt > exfiltrateMe.txt # # Remove timestamps before trying to decloak the file # # $ cat exfiltrateMe.txt | cut -d" " -f 3- > cloaked.txt param ( [Parameter(Mandatory=$false)][string]$cloakedFile ) [void] (Invoke-Expression("chcp 65001")) #sets output of console to UTF-8 $minDaysBack = -1104 $maxDaysBack = -1011 $minSecondsStep = 0 $maxSecondsStep = 664 $minMilliseconds = 11 $maxMilliseconds = 9999 $minTick = 3 $maxTick = 9999 # Set the start date back around 2 years from today (give or take) for entropy range # Randomize a little for each run to avoid a pattern in the first line of each file $today = Get-Date $startDate = $today.AddDays( (Get-Random -Minimum $minDaysBack -Maximum $maxDaysBack)) $step = (Get-Random -Minimum $minSecondsStep -Maximum $maxSecondsStep) $startDate = [System.DateTime]::Parse(($startDate).ToString("yyyy.MM.dd")) $toparse = ((Get-Random -Minimum 0 -Maximum 23).ToString()+":"+(Get-Random -Minimum 0 -Maximum 59).ToString()+":"+ (Get-Random -Minimum 0 -Maximum 59).ToString()) $t = [System.Timespan]::Parse($toparse) $fakeDate = $startDate.Add($t) $fakeDate = $fakeDate.AddMilliseconds((Get-Random -Minimum $minMilliseconds -Maximum $maxMilliseconds)) $fakeDate = $fakeDate.AddTicks((Get-Random -Minimum $minTick -Maximum $maxTick)) if ( $cloakedFile.Length -eq 0){ write-host("usage: prependTimestamps.ps1 <cloakedFilename>") write-host("") write-host("Strip the timestamps prior to decloaking the cloaked file.") write-host("") # Generate sample of noise generator output $i = 0 while ( $i -lt 20 ){ Write-Host( Get-date $fakeDate -Format o) $fakeDate = $fakeDate.AddSeconds( (Get-Random -Minimum $minSecondsStep -Maximum $maxSecondsStep)) $fakeDate = $fakeDate.AddMilliseconds((Get-Random -Minimum $minMilliseconds -Maximum $maxMilliseconds)) $fakeDate = $fakeDate.AddTicks((Get-Random -Minimum $minTick -Maximum $maxTick)) if($fakeDate -gt $today){ $startDate = $today.AddDays( (Get-Random -Minimum $minDaysBack -Maximum $maxDaysBack)) $step = (Get-Random -Minimum $minSecondsStep -Maximum $maxSecondsStep) $startDate = [System.DateTime]::Parse(($startDate).ToString("yyyy.MM.dd")) $toparse = ((Get-Random -Minimum 0 -Maximum 23).ToString()+":"+(Get-Random -Minimum 0 -Maximum 59).ToString()+":"+ (Get-Random -Minimum 0 -Maximum 59).ToString()) $t = [System.Timespan]::Parse($toparse) $fakeDate = $startDate.Add($t) $fakeDate = $fakeDate.AddMilliseconds((Get-Random -Minimum $minMilliseconds -Maximum $maxMilliseconds)) $fakeDate = $fakeDate.AddTicks((Get-Random -Minimum $minTick -Maximum $maxTick)) } $i = $i+1 } } if( $cloakedFile.Length -gt 0){ if(Test-Path $cloakedFile){ # Generate a random with enough range to look good, scale with vals above $clFile = Get-Content $cloakedFile -Encoding UTF8 $i = 0 while($i -lt $clFile.Length ){ $clFile[$i] = ((get-date $fakeDate -Format o ) + " " + $clFile[$i]) $fakeDate = $fakeDate.AddSeconds( (Get-Random -Minimum $minSecondsStep -Maximum $maxSecondsStep)) $fakeDate = $fakeDate.AddMilliseconds((Get-Random -Minimum 12 -Maximum 9999)) $fakeDate = $fakeDate.AddTicks((Get-Random -Minimum 12 -Maximum 9999)) $i = $i+1 } Out-File -FilePath $cloakedFile -InputObject $clFile -Encoding UTF8 }else{ Write-Host "File not found!" } }
36.762295
182
0.6466
2f7bb43149dd3722448b4bf9188e5d4805294868
185
js
JavaScript
public/js/vue.min.js
qq349694377/PingGer
c1ec056aac24b6f87cb12616c51df82bdbd47214
[ "Apache-2.0" ]
null
null
null
public/js/vue.min.js
qq349694377/PingGer
c1ec056aac24b6f87cb12616c51df82bdbd47214
[ "Apache-2.0" ]
1
2020-12-05T06:32:03.000Z
2020-12-05T06:32:03.000Z
public/js/vue.min.js
qq349694377/PingGer
c1ec056aac24b6f87cb12616c51df82bdbd47214
[ "Apache-2.0" ]
null
null
null
/*-防止各大cdn公共库加载地址失效问题,此地址我们会时时监控,及调整以保障正常访问-www.jq22.com为您服务*/ /*当前为bootcss cdn公共库提供的vue-2.2.2*/ document.write("<script src='http://cdn.bootcss.com/vue/2.2.2/vue.min.js'><\/script>");
61.666667
87
0.735135
145096642b141a5aecb20957e0c80a52fefcf10d
20,039
tsx
TypeScript
src/images/reactNativImg.tsx
Codivox/codivox.com
fd733c35410e5e7137b18cdde6a9cb9488250d83
[ "RSA-MD" ]
2
2020-10-22T06:51:34.000Z
2021-03-11T10:47:47.000Z
src/images/reactNativImg.tsx
Codivox/codivox.com
fd733c35410e5e7137b18cdde6a9cb9488250d83
[ "RSA-MD" ]
35
2020-07-17T02:15:50.000Z
2021-04-29T15:09:49.000Z
src/images/reactNativImg.tsx
Codivox/codivox.com
fd733c35410e5e7137b18cdde6a9cb9488250d83
[ "RSA-MD" ]
1
2020-11-20T07:01:32.000Z
2020-11-20T07:01:32.000Z
import * as React from 'react'; import ReactNativ from '../components/AppDevelopment/ReactNativ'; function ReactNativImg(props: React.SVGProps<SVGSVGElement>) { return ( <svg width={345} height={253} viewBox="0 0 345 253" fill="none" {...props}> <g clipPath="url(#prefix__clip0)" fill="#61DAFB"> <path d="M271.761 39.61c.81-3.143-2.471-7.165-8.202-10.611 3.017-5.783 3.641-10.842 1.24-13.131-.552-.534-1.263-.903-2.089-1.116l-.556 2.158c.458.117.804.3 1.07.543 1.158 1.103 1.005 4.127-.404 7.704a30.23 30.23 0 01-1.24 2.713 51.08 51.08 0 00-6.045-2.68 49.12 49.12 0 00-2.892-5.903c3.998-2.096 7.455-2.918 9.524-2.385l.555-2.157c-2.735-.704-6.804.27-11.272 2.626-2.778-4.202-5.876-7.001-8.611-7.706l-.556 2.157c2.059.53 4.702 2.913 7.195 6.66a47.488 47.488 0 00-5.352 3.769c-2.307-.347-4.528-.538-6.6-.566a29.68 29.68 0 01.205-2.938c.485-3.816 1.802-6.54 3.341-6.958.343-.098.751-.075 1.209.043l.555-2.157c-.835-.215-1.636-.236-2.387-.037-3.199.847-5.084 5.57-5.221 12.074-6.665.264-11.458 2.196-12.266 5.33-.809 3.144 2.472 7.166 8.203 10.612-3.017 5.783-3.641 10.841-1.24 13.13.552.535 1.263.904 2.098 1.119 2.736.705 6.805-.27 11.273-2.625 2.778 4.202 5.876 7 8.611 7.705.835.215 1.636.236 2.387.037 3.199-.847 5.084-5.57 5.221-12.074 6.643-.26 11.439-2.201 12.246-5.335zm-11.289-9.787a43.921 43.921 0 01-2.327 3.475 46.596 46.596 0 00-.705-2.657 53.599 53.599 0 00-.849-2.632c1.36.567 2.658 1.17 3.881 1.814zm-7.209 9.129a52.983 52.983 0 01-3.349 3.077 54.904 54.904 0 01-8.974-2.3 54.925 54.925 0 01-1.46-4.297 51.462 51.462 0 01-1.078-4.382 52.985 52.985 0 016.402-6.407 54.928 54.928 0 018.975 2.301 54.925 54.925 0 011.46 4.296c.43 1.462.785 2.925 1.077 4.383a55.005 55.005 0 01-3.053 3.329zm3.537-.43c.203 1.434.327 2.848.381 4.203a47.248 47.248 0 01-4.297-.282 54.778 54.778 0 002.022-1.923 56.035 56.035 0 001.894-1.998zm-12.744 7.723a41.355 41.355 0 01-1.968-3.808c.885.27 1.792.534 2.718.773.935.24 1.865.46 2.782.644a39.378 39.378 0 01-3.532 2.39zm-5.933-7.604a47.67 47.67 0 01-3.882-1.814 44.46 44.46 0 012.327-3.475c.209.879.437 1.763.705 2.657.269.894.552 1.772.85 2.632zm12.535-18.236a41.617 41.617 0 011.968 3.808 65.308 65.308 0 00-2.718-.772c-.935-.241-1.865-.46-2.783-.645a39.41 39.41 0 013.533-2.39zm-8.828 3.802a55.609 55.609 0 00-3.914 3.912 42.067 42.067 0 01-.381-4.203c1.38.035 2.82.128 4.295.29zm-12.121 9.792c-3.145-2.368-4.93-4.87-4.538-6.388.391-1.519 3.164-2.857 7.059-3.401a32.223 32.223 0 013.007-.268c.079 2.042.316 4.208.721 6.468a46.398 46.398 0 00-3.718 5.293 31.653 31.653 0 01-2.531-1.704zm1.791 15.2c-1.158-1.102-1.005-4.126.404-7.703a29.94 29.94 0 011.24-2.714 51.064 51.064 0 006.044 2.682 49.12 49.12 0 002.892 5.902c-3.997 2.096-7.454 2.917-9.523 2.384-.445-.124-.801-.309-1.057-.55zm25.492-1.293c-.484 3.815-1.801 6.54-3.341 6.958-.343.097-.751.075-1.208-.043-2.059-.53-4.702-2.913-7.195-6.66a47.488 47.488 0 005.352-3.769c2.307.347 4.528.538 6.6.566a27.376 27.376 0 01-.208 2.948zm5.491-5.465a32.23 32.23 0 01-3.007.267 47.083 47.083 0 00-.72-6.468 46.525 46.525 0 003.718-5.293 33.242 33.242 0 012.541 1.707c3.145 2.368 4.929 4.87 4.538 6.388-.401 1.516-3.175 2.855-7.07 3.398z" /> <path d="M246.214 37.744c2.51.647 5.055-.808 5.684-3.25.629-2.44-.896-4.944-3.407-5.59-2.511-.647-5.055.808-5.684 3.249-.629 2.441.896 4.945 3.407 5.591z" /> </g> <path d="M82.015 201.193a7.724 7.724 0 00.677-2.667c.569-8.602-8.445-7.206-13.782-9.713-4.984-2.342-5.194-7.774-5.549-12.565-.473-6.414-.901-10.956-5.32-16.083-9.433-10.947-7.208-22.905-12.206-35.618-3.23-8.213-10.836-14.58-19.184-17.58-2.474-.889-5.353-1.561-8.386-.666-5.516 1.626-8.477 7.517-8.015 11.824.461 4.304 3.126 7.81 3.934 12.008.81 4.197-1.164 9.985-6.48 12.386-2.668 1.203-6.266 1.743-7.411 4.01-.512 1.013-.269 2.015.09 2.885 1.583 3.862 5.258 6.582 6.654 10.508 1.646 4.629-.43 8.155-2.18 12.386-.783 1.9-1.186 4.175-.131 5.941 1.947 3.254 6.7 2.387 8.927 5.294 2.65 3.462-1.914 8.95-5.715 13.17-3.8 4.22-6.962 10.625-2.53 12.537 1.38.596 3.188.526 4.808.755 7.282 1.024 9.758 7.595 11.387 13.472 1.757 6.335 8.577 8.398 13.186 12.145 5.197 4.223 6.856 12.506 15.537 8.879 5.944-2.482 8.647-8.812 12.014-13.832 3.688-5.502 7.614-10.939 9.956-17.188 1.825-4.645 7.696-7.752 9.72-12.288z" fill="#E3E5FC" /> <path d="M49.856 245.257a.392.392 0 01-.384-.311l-19.776-92.672a.393.393 0 11.77-.165l19.776 92.672a.394.394 0 01-.386.476z" fill="#fff" /> <path d="M37.257 184.375a.393.393 0 01-.386-.462l3.537-19.698a.393.393 0 01.772.14l-3.537 19.698a.393.393 0 01-.386.322zM44.273 219.083a.39.39 0 01-.322-.168l-10.737-15.436a.394.394 0 01.646-.45l10.738 15.436a.394.394 0 01-.325.618z" fill="#fff" /> <path d="M199.361 252.95c79.497 0 143.943-1.886 143.943-4.212 0-2.326-64.446-4.211-143.943-4.211-79.497 0-143.942 1.885-143.942 4.211 0 2.326 64.445 4.212 143.942 4.212z" fill="#E3E5FC" /> <path d="M232.517 231.861c-.859-1.674-1.573-3.506-1.447-5.384.229-3.411 3.053-5.972 5.488-8.373 2.434-2.401 4.827-5.647 3.906-8.941-.884-3.165-4.334-4.71-7.256-6.213-2.922-1.502-6.047-4.172-5.404-7.393.924-4.615 8.535-5.334 9.361-9.968.299-1.676-.451-3.344-1.178-4.886l-7.464-15.775c-1.139-2.406-2.16-5.594-.254-7.452 1.284-1.251 3.302-1.223 4.984-1.838 4.365-1.601 5.675-6.991 6.677-11.533 1.002-4.539 3.335-9.892 7.972-10.228 1.786-.129 3.532.579 5.074 1.492 6.115 3.618 9.887 10.86 9.35 17.946-.23 3.033-1.097 6.419.694 8.879.931 1.279 2.409 2.015 3.713 2.908 4.992 3.411 7.752 9.822 6.795 15.791-.652 4.075-2.824 8.412-.91 12.067 2.144 4.089 8.281 4.785 10.315 8.927 1.676 3.409-.229 7.461-2.429 10.559-2.199 3.097-4.861 6.313-4.766 10.11.048 1.965.854 3.834 1.067 5.787.545 4.982-2.799 9.596-6.68 12.767-5.012 4.097-12.616 8.443-19.231 6.249-7.573-2.511-14.745-8.424-18.377-15.498z" fill="#A7ADFF" /> <path d="M257.14 248.344a.394.394 0 01-.391-.361l-6.051-74.936a.395.395 0 01.361-.423c.241-.008.406.143.423.361l6.05 74.936a.394.394 0 01-.361.423h-.031z" fill="#fff" /> <path d="M252.857 195.249a.391.391 0 01-.308-.638l10.628-13.264a.395.395 0 01.554-.062.392.392 0 01.062.551l-10.629 13.265a.392.392 0 01-.307.148zM255.395 221.107a.392.392 0 01-.308-.638l10.628-13.265a.393.393 0 11.616.49l-10.628 13.264a.396.396 0 01-.308.149zM254.116 210.876a.39.39 0 01-.258-.096l-9.929-8.549a.392.392 0 11.513-.596l9.928 8.549a.394.394 0 01-.254.692z" fill="#fff" /> <path d="M258.408 228.013c-.532-1.102-1.077-2.269-.982-3.489.134-1.705 1.469-3.051 2.807-4.117 3.042-2.426 6.542-4.296 9.26-7.083 2.717-2.787 4.57-6.917 3.251-10.578-1.038-2.882-3.875-5.079-4.063-8.138-.252-4.049 4.091-6.671 6.131-10.177 1.699-2.919 1.761-6.482 2.791-9.697 1.029-3.215 3.856-6.453 7.177-5.849 3.655.664 4.951 5.233 4.996 8.95.044 3.716-.157 8.031 2.675 10.435.979.831 2.255 1.343 3.014 2.381.688.946.828 2.172.948 3.336.661 6.481 1.181 13.57-2.468 18.965-.834 1.234-1.894 2.398-2.185 3.862-.717 3.618 3.551 6.78 2.966 10.424-.498 3.089-4.074 4.531-5.952 7.035-2.133 2.843-1.951 6.943-4.114 9.761-3.224 4.201-12.377 5.057-16.603 1.875-4.788-3.61-7.161-12.75-9.649-17.896z" fill="#F44E4E" /> <path d="M273.442 248.366c-.02 0-.042-.003-.065-.006a.396.396 0 01-.324-.453l9.484-57.398a.382.382 0 01.453-.325.396.396 0 01.324.453l-9.483 57.399a.398.398 0 01-.389.33z" fill="#fff" /> <path d="M280.045 210.719a.4.4 0 01-.255-.092.395.395 0 01-.044-.555l9.377-11.006a.395.395 0 01.554-.045c.165.14.185.389.045.555l-9.378 11.006a.402.402 0 01-.299.137zM276.119 232.155a.396.396 0 01-.35-.213l-5.502-10.707a.394.394 0 01.703-.358l5.502 10.707a.395.395 0 01-.171.529.424.424 0 01-.182.042z" fill="#fff" /> <path d="M304.534 236.115c1.422-1.817 4.254-2.972 4.103-5.273-.129-1.953-2.547-3.439-2.074-5.339.448-1.788 2.891-1.967 4.724-1.752.361-1.237.089-2.552-.037-3.834-.126-1.281-.053-2.709.823-3.654.876-.946 2.779-.896 3.187.324.65-1.833 1.299-3.663 1.951-5.496.266-.753.655-1.615 1.435-1.777 1.139-.238 1.909 1.262 1.73 2.412-.179 1.15-.854 2.217-.812 3.381.054 1.477 1.461 2.765 2.939 2.689-1.52 1.184-3.199 3.162-2.138 4.769.534.808 1.726 1.48 1.374 2.381-.35.898-1.965.817-2.163 1.763-.269 1.259 2.409 1.844 1.905 3.031-1.651-.261-3.078 1.931-2.171 3.335.996 1.545 3.439 1.316 4.768 2.586.954.912 1.103 2.429.711 3.689-1.539 4.953-7.332 10.905-12.766 8.96-4.318-1.55-11.622-6.92-7.489-12.195z" fill="#FDC510" /> <path d="M313.534 249.043h-.031a.396.396 0 01-.363-.422l2.04-27.221c.014-.215.176-.375.422-.363a.396.396 0 01.364.422l-2.04 27.22a.394.394 0 01-.392.364z" fill="#fff" /> <path d="M314.391 237.615a.382.382 0 01-.249-.09l-5.006-4.08a.394.394 0 01.498-.61l5.006 4.08a.394.394 0 01-.249.7zM314.214 245.148a.394.394 0 01-.247-.7l7.909-6.386a.398.398 0 01.554.059.395.395 0 01-.059.554l-7.908 6.386a.404.404 0 01-.249.087z" fill="#fff" /> <path d="M47.93 190.097c-.523-1.821-2.16-3.347-3.377-4.986-1.214-1.638-2.006-3.689-.778-5.32.574-.759 1.514-1.327 2.306-1.976 3.616-2.963 3.817-7.416 2.672-11.294-1.144-3.879-3.42-7.57-4.108-11.507-.635-3.647.68-7.982 5.214-9.588 3.327-1.178 7.58-.411 10.203 1.492 2.622 1.905 3.71 4.743 3.44 7.435-.11 1.077-.387 2.256.413 3.165 1.579 1.799 5.692.985 7.937 2.356 1.92 1.173 1.64 3.378.83 5.107-.808 1.727-1.989 3.538-1.317 5.298.83 2.171 4.279 3.529 4.628 5.77.143.918-.277 1.861 0 2.762.776 2.538 6.563 3.859 5.354 6.308-.938 1.9-5.228 1.668-6.551 3.442-1.408 1.883 1.701 4.06 1.312 6.187-.131.725-.666 1.371-1.186 1.996-3.546 4.245-7.094 8.487-10.64 12.732-.64.767-1.293 1.545-2.177 2.169-5.446 3.848-13.738 1.371-14.664-3.571-.442-2.353-1.021-5.132-1.195-7.513-.252-3.532 2.69-6.963 1.685-10.464z" fill="#A7ADFF" /> <path fill="#4B369D" d="M58.626 171.976l.785-.047 4.503 75.044-.785.047z" /> <path fill="#4B369D" d="M60.043 193.576L70.94 180.53l.603.504-10.897 13.046zM51.266 201.014l.525-.585 9.752 8.754-.525.585z" /> <path d="M16.56 243.379c-.99-1.172-1.841-2.527-2.062-4.043-.054-.367-.06-.773.162-1.069.19-.258.515-.381.828-.445 2.222-.476 4.307 1.153 5.913 2.762a56.528 56.528 0 017.534 9.366c-1.299-2.021-1.982-5.896-1.674-8.272.011-.093.03-.196.104-.255.075-.061.182-.056.274-.039.683.131 1.114.795 1.441 1.41a31.337 31.337 0 012.485 6.238c-.37-1.34.725-2.955 1.716-3.755 1.774-1.428 1.396.565 1.01 1.735-.378 1.147-2.885 5.641-4.674 4.637-.327-.185-.408-1.187-.677-1.512-.467-.559-1.12-.744-1.79-.951-1.803-.56-3.68-.792-5.38-1.671a17.243 17.243 0 01-5.21-4.136z" fill="#A7ADFF" /> <path d="M229.578 246.958c.227-2.311.222-4.455.98-6.71.255-.761.618-1.573 1.34-1.92.137-.067.3-.112.437-.05.12.053.196.173.257.294 3.929 7.527-6.615 11.761-11.426 6.1-.296-.35-.576-.75-.618-1.209-.076-.839.725-1.564 1.561-1.662.837-.098 1.657.283 2.348.761 1.83 1.268 3.048 3.221 4.212 5.116a14.278 14.278 0 01-2.362-8.32c.014-.439.162-1.002.602-1.038.21-.017.403.103.571.232 1.197.921 1.872 2.395 2.124 3.887.251 1.489.12 3.014-.026 4.519z" fill="#F44E4E" /> <path d="M66.282 233.96c.107.003.213.03.322.089.341.185.468.605.549.985.741 3.479.722 2.625.352 7.189.778-2.848.47-2.35 1.925-4.922.283-.501.597-1.013 1.086-1.312 3.176-1.945.101 6.671-.436 7.659-1.993 3.666-5.868 4.572-9.63 3.224-3.299-1.184-6.45-3.753-7.63-7.114-.107-.302-.186-.683.041-.912.157-.157.4-.179.621-.182 1.993-.003 3.86 1.01 5.385 2.292 1.522 1.284 2.784 2.846 4.217 4.228 1.016.98 3.257.924 4.656 1.092 2.382.288 3.322-.636 5.39-1.853.45-.266.943-.507 1.466-.501.524.006 1.078.333 1.176.848.058.305-.048.618-.182.901-1.693 3.576-6.308 3.095-8.342.241-1.94-2.723-3.19-7.257-2.261-10.522.187-.661.708-1.441 1.295-1.43z" fill="#FDC510" /> <path d="M337.751 239.557a.478.478 0 01.224.061c.238.129.325.423.381.689.517 2.429.503 1.833.246 5.017.543-1.99.327-1.64 1.343-3.436.196-.35.417-.708.759-.918 2.216-1.357.07 4.654-.305 5.345-1.391 2.558-4.097 3.193-6.719 2.25-2.304-.826-4.503-2.62-5.326-4.965-.075-.212-.129-.475.031-.638.109-.109.28-.126.434-.126 1.391-.002 2.695.706 3.755 1.601 1.061.896 1.942 1.987 2.944 2.952.708.683 2.272.644 3.249.762 1.662.201 2.317-.445 3.761-1.293.314-.185.658-.356 1.024-.35.364.003.75.232.82.59.042.213-.033.431-.126.627-1.181 2.496-4.401 2.161-5.82.168-1.355-1.9-2.225-5.065-1.579-7.343.132-.456.496-1.002.904-.993z" fill="#A7ADFF" /> <path d="M121.835 106.041l32.154-35.903-4.545 10.608-25.717 25.295h-1.892z" fill="#4B369D" /> <path d="M139.577 142.661l-21.54-8.289c-3.758-1.446-5.65-5.706-4.203-9.464l6.252-16.247c1.447-3.759 5.706-5.65 9.464-4.204l21.539 8.289c3.759 1.447 5.65 5.706 4.204 9.464l-6.252 16.248c-1.447 3.758-5.703 5.65-9.464 4.203zM203.809 82.795l12.699-21.358s4.953-2.823 3.892.977c-1.06 3.8-12.268 22.22-12.268 22.22l-4.323-1.84z" fill="#4B369D" /> <path d="M167.894 65.69l-3.783 12.152-10.587 1.273s7.951-7.013 8.883-14.818c.934-7.802 5.487 1.394 5.487 1.394z" fill="#D4A79A" /> <path d="M182.902 42.668s1.396 3.316-2.818 11.328c-4.212 8.012-9.386 14.457-11.826 13.29-6.75-3.224-7.97-8.88-9.344-13.819-1.682-6.055 7.589-17.434 7.589-17.434l6.445-1.62 9.954 8.255z" fill="#EAC2AB" /> <path d="M160.71 46.401s-.682 4.931-.691 10.892c0 .224-.019.408-.162.579-.353.417-3.008-4.032-3.207-4.377-1.304-2.244-3.297-4.986-2.508-7.704.222-.758.619-1.472.689-2.255.129-1.478-1.01-2.415-1.273-3.742-.247-1.231.084-2.636.464-3.8.725-2.21 2.197-4.631 4.217-5.882 1.593-.985 2.942-.504 4.534-1.058.839-.291 1.217-1.237 1.782-1.923.871-1.052 2.287-1.533 3.652-1.57 1.685-.047 4.117.289 5.552 1.263 1.828 1.24 2.01 4.516 3.736 5.431.297.157.638.193.971.224 3.221.314 6.277.168 8.857 2.373 4.075 3.482 1.282 15.795-4.729 12.31-.688-.4-1.273-.954-1.931-1.404-3.162-2.175-7.178 1.469-9.307-4.03-.381-.982-6.955-1.332-7.041 1.352-.109 3.503-3.605 3.321-3.605 3.321z" fill="#4B369D" /> <path d="M162.174 46.32s-1.869-3.624-2.729.966c-.859 4.589 1.271 6.12 1.271 6.12l1.458-7.086z" fill="#EAC2AB" /> <path d="M114.447 216.218l-9.593 13.379-4.802-2.748 10.838-13.365c0 .003 2.838 1.125 3.557 2.734z" fill="#D4A79A" /> <path d="M116.817 246.172c-.241.286-2.085-.148-2.365-.19-2.888-.428-7.348-.94-9.556-3.011-2.149-2.018-3.246-5.063-5.057-7.366-1.276-1.62-3.053-2.767-4.668-4.032-1.78-1.397 3.66-9.677 5.801-7.847 1.733 1.483.258 4.57 5.231 4.948 4.259.324.613 5.887 4.914 10.259 3.8 3.867 8.322 4.124 5.7 7.239z" fill="#F3AA02" /> <path d="M144.217 160.784c-3.254 11.605-1.363 11.795-9.377 20.848-3.91 4.416-25.558 22.651-29.588 26.966-5.748 6.153.246 8.983 4.511 10.785 2.79 1.178 4.455 7.309 8.695 2.795.419-.445 7.718-9.867 9.909-13.994 2.507-4.727 16.888-17.656 21.844-22.2 11.799-10.816 5.835-16.013 13.055-30.173 2.748-5.392 2.138-11.132 2.952-17.333.498-3.795-5.291-21.557-13.345-18.417-5.012 1.956-3.098 12.123-2.886 16.133.149 2.773.549 5.832-.139 8.516-1.414 5.507-4.092 10.592-5.631 16.074z" fill="#4B369D" /> <path d="M169.651 222.156l3.641 16.564-5.412 1.785-2.774-17.509c.003.002 2.816-1.4 4.545-.84z" fill="#EAC2AB" /> <path d="M195.456 245.249s-4.049 1.382-11.812 1.958c-7.763.577-16.427.865-17.999-.288-1.576-1.153-2.589-10.944 0-10.944 2.588 0 3.593 3.744 8.157.403 3.909-2.863 7.032 2.535 13.838 3.973 6.806 1.439 9.56 2.015 7.816 4.898z" fill="#FDC510" /> <path d="M183.342 228.606c-.261-.607-.944-1.06-1.537-1.533-5.42-4.321-2.591-10.88-3.229-16.67-1.99-18.039 1.435-28.592-5.348-47.019-4.617-12.54-5.863-20.815-6.979-34.746-.389-4.835 9.19-11.084 1.883-9.702-3.461.655-6.878.526-10.329-.078-1.816-.319.037-.909-1.816-.319-6.31 2.015-11.006 13.312-11.085 17.664-.176 9.755 7.313 16.158 9.358 24.69 3.594 14.986 9.241 25.586 7.766 37.916-.722 6.042-1.562 12.067-2.367 18.097-.471 3.518-3.412 11.225-1.439 14.409 2.709 4.371 14.779.666 18.811.568 3.031-.075 7.195-1.214 6.311-3.277z" fill="#5A54FF" /> <path d="M169.581 95.844c-1.83-7.427.157-19.92-5.079-25.43-.537-.565-1.106-1.122-1.816-1.443-6.579-2.964-10.548 2.437-13.377 7.119-2.832 4.687-2.767 9.758-4.15 15.013-1.573 5.975-1.256 12.187-1.368 18.355-.07 3.756.389 7.486.176 11.247a45.377 45.377 0 01-1.119 7.791c-.398 1.701-2.622 5.079-1.973 6.811.515 1.371 2.871.854 4.029.893 4.481.148 8.871-1.181 12.856-3.151 3.641-1.8 7.489-1.73 11.689-2.077 2.085-.173 4.789-1.97 3.845-5.759-2.235-8.98-1.583-16.846-2.507-23.188a66.804 66.804 0 00-1.206-6.181z" fill="#D7384E" /> <path d="M157.906 80.013s9.367 21.372 13.922 24.251c4.556 2.88 8.502 2.468 16.533-2.79 8.035-5.258 15.257-11.538 16.021-12.254.764-.716 7.352-1.5 7.928-4.343.577-2.843 3.081-12.042.669-10.237-2.412 1.805-4.491 7.76-6.501 7.864-2.009.103.837-6.151-.99-5.144-1.828 1.008-1.956 2.664-2.614 4.072-.658 1.408.21 2.994-3.783 6.492-3.994 3.498-17.054 12.63-20.812 11.95-3.759-.683-17.527-20.935-18.089-22.486-.566-1.547-2.284 2.625-2.284 2.625z" fill="#EAC2AB" /> <path d="M170.815 87.048s-5.692-17.036-12.459-13.603c-6.766 3.434 3.272 21.537 3.272 21.537L172.62 89.2l-1.805-2.152z" fill="#F44E4E" /> <path d="M215.371 50.062c-.065-1.758-.154-3.613-1.106-5.09-.363-.569-.87-1.075-1.511-1.285-.562-.185-1.169-.129-1.757-.07l-8.157.814c-1.422.143-2.877.294-4.165.91-1.287.618-2.398 1.807-2.513 3.232-.081 1.005.336 1.987.857 2.849.369.613.8 1.195 1.346 1.656 1.318 1.114 3.148 1.405 4.872 1.363 1.724-.042 3.439-.37 5.163-.305 1.911.07 4.494 1.783 6.087 1.883 3.24.21.948-4.206.884-5.957zM231.593 71.257c1.567.45 2.969 1.349 4.516 1.86 2.015.664 4.184.642 6.305.614 3.82-.05 7.637-.104 11.457-.154 1.069-.014 2.278.03 2.989.825.464.52.601 1.248.719 1.937.369 2.143.738 4.284 1.105 6.428.196 1.136.364 2.41-.305 3.35-.75 1.054-2.216 1.236-3.506 1.326l-16.477 1.136c-.518.036-1.072.064-1.523-.193-.414-.238-.669-.677-.887-1.103a21.499 21.499 0 01-1.973-5.694c-.277-1.422-.422-2.91-1.116-4.181-1.083-1.979-.443-2.068-1.47-3.817-1.491-2.544-1.368-2.776.166-2.334z" fill="#E3E5FC" /> <path d="M279.438 38.194c.885.254 1.679.764 2.555 1.052 1.139.375 2.365.363 3.565.347 2.161-.028 4.321-.059 6.479-.087.604-.008 1.287.017 1.69.467.263.294.341.706.409 1.095l.626 3.635c.112.643.205 1.362-.173 1.894-.423.596-1.254.7-1.984.75-3.106.216-6.213.428-9.319.644-.294.02-.607.036-.862-.11-.235-.134-.378-.383-.501-.623a12.157 12.157 0 01-1.116-3.221c-.157-.806-.238-1.646-.633-2.365-.613-1.12-.252-1.17-.831-2.158-.842-1.44-.772-1.57.095-1.32z" fill="#A7ADFF" /> <path d="M283.985 45.064a1.007 1.007 0 100-2.015 1.007 1.007 0 000 2.015zM288.2 45.064a1.007 1.007 0 100-2.015 1.007 1.007 0 000 2.015zM292.604 45.064a1.008 1.008 0 100-2.017 1.008 1.008 0 000 2.017zM249.008 85.19h-4.604a2.15 2.15 0 01-2.143-2.143v-4.604a2.15 2.15 0 012.143-2.143h4.604a2.15 2.15 0 012.143 2.143v4.604a2.15 2.15 0 01-2.143 2.143z" fill="#fff" /> <path d="M247.054 81.295h-.699a1.457 1.457 0 01-1.453-1.453v-.7c0-.797.652-1.452 1.453-1.452h.699c.798 0 1.453.653 1.453 1.453v.7c0 .8-.655 1.452-1.453 1.452zM246.705 81.32a2.37 2.37 0 00-2.362 2.362h4.721a2.365 2.365 0 00-2.359-2.362z" fill="#4B369D" /> <path d="M210.438 50.814h-6.554a2.151 2.151 0 01-2.144-2.143v-6.554c0-1.178.966-2.144 2.144-2.144h6.554a2.15 2.15 0 012.143 2.144v6.554c0 1.18-.962 2.143-2.143 2.143z" fill="#A7ADFF" /> <defs> <clipPath id="prefix__clip0"> <path fill="#fff" transform="rotate(14.444 114.964 907.251)" d="M0 0h50.391v55.839H0z" /> </clipPath> </defs> </svg> ); } export default ReactNativImg;
108.318919
2,841
0.631918
73c11456130fad828a8da1277d9aba6da42a1a13
3,458
swift
Swift
Tests/ProjectAssetsSpec.swift
elitree/Prism
5883ed29ce490fbcf0d613dc159800031a5f3610
[ "MIT" ]
null
null
null
Tests/ProjectAssetsSpec.swift
elitree/Prism
5883ed29ce490fbcf0d613dc159800031a5f3610
[ "MIT" ]
null
null
null
Tests/ProjectAssetsSpec.swift
elitree/Prism
5883ed29ce490fbcf0d613dc159800031a5f3610
[ "MIT" ]
null
null
null
// // ProjectSpec.swift // Prism // // Created by Shai Mishali on 22/05/2019. // Copyright © 2019 Gett. All rights reserved. // import Foundation import Quick import Nimble import SnapshotTesting @testable import PrismCore @testable import ZeplinAPI class ProjectAssetsSpec: QuickSpec { override func spec() { describe("project snapshot") { it("is valid") { let projectResult = Prism(jwtToken: "fake").mock(type: .successful) let project = try! projectResult.get() assertSnapshot(matching: "\(project.debugDescription)", as: .lines, named: "project snapshot is valid") } } describe("project decoding from JSON") { context("successful") { it("should suceed and return valid Project") { let projectResult = Prism(jwtToken: "fake").mock(type: .successful) let project = try! projectResult.get() expect(project.id) == "12345" expect(project.colors.map { $0.argbValue }.joined(separator: ", ")) == "#ff62b6df, #ccdf6369, #ff0e28a6, #ff62a60e, #ffa6890e, #ffa30ea6, #ffa60e0e, #ff0e7ea6" expect(project.textStyles.map { $0.name }.joined(separator: ", ")) == "Base Heading, Base Subhead, Body, Body 2, Highlight, Large Heading" let encoded = try! project.encode() let decoded = try! ProjectAssets.decode(from: encoded) expect(project) == decoded } } context("failed") { it("should fail decoding") { let projectResult = Prism(jwtToken: "fake").mock(type: .faultyJSON) guard case .failure = projectResult else { fail("Expected error, got \(projectResult)") return } expect(try? projectResult.get()).to(beNil()) } } } describe("failed server response") { it("should return failed result") { let projectResult = Prism(jwtToken: "fake").mock(type: .failure) guard case .failure = projectResult else { fail("Expected error, got \(projectResult)") return } expect(try? projectResult.get()).to(beNil()) } } describe("invalid project ID causing invalid API URL") { it("should fail with error") { var result: Result<ProjectAssets, ZeplinAPI.Error>? Prism(jwtToken: "dsadas").getProjectAssets(for: "|||") { res in result = res } switch result { case .some(.failure(let error)): expect(error.description.starts(with: "Failed constructing URL from path")).to(beTrue()) default: fail("Expected invalid project ID error, got \(String(describing: result))") } } } describe("description") { it("should not be empty") { let projectResult = Prism(jwtToken: "fake").mock(type: .successful) let project = try! projectResult.get() expect(project.description).toNot(beEmpty()) } } } }
35.649485
179
0.516194
a474df9351fb5041f57d5a5d1dcdc499f421579e
2,662
php
PHP
application/views/user/vote-bem.php
amien020596/evot
e80af25447d59e800b0d8ceff8d19a07419cf328
[ "MIT" ]
null
null
null
application/views/user/vote-bem.php
amien020596/evot
e80af25447d59e800b0d8ceff8d19a07419cf328
[ "MIT" ]
null
null
null
application/views/user/vote-bem.php
amien020596/evot
e80af25447d59e800b0d8ceff8d19a07419cf328
[ "MIT" ]
null
null
null
<div class="container-fluid"> <div class="vote-title text-center"> <h2>Pasangan Calon Ketua dan Wakil Ketua <br>BEM FKM Undip 2018</h2> <!-- <hr> --> <p><?php echo "$waktu, $nama ($nim)"; ?> |<a href="" class="btn btn-link" data-toggle="modal" data-target="#myModal">Petunjuk</a> <!-- |<a href="" class="btn btn-link" data-toggle="modal" data-target="#exitModal">Keluar</a> --></p> </div> <div class="row text-center"> <div class="col-md-11 line"></div> </div> <div class="row text-center vote-container"> <form name="myForm" action="<?php $list_senator = array( date('Y'), strval(date('Y')-1), strval(date('Y')-2) ); if (!in_array($angkatan, $list_senator)) { echo base_url('user/review'); } else { echo base_url('user/vote-senat'); }?>" method="POST" onsubmit="return validate()"> <?php for ($i=1; $i<=$xkandidat_bem; $i++) { $d = $this->Admin_model->get_data_kandidat_bem($i);?> <div class="col-vote col-md-3"> <div class="row text-center option" style="background: rgba(166, 75, 154, 1);"> <input type="radio" id="r" class="option-input radio" name="paslonbem" data-checked="<?php echo $d->no_urut; ?>" value="<?php echo $d->no_urut; ?>" data-toggle="tooltip"/> </div> <div class="row ava-container"> <div class="col-md-6"> <img class="avatar" src="<?php echo base_url();?>assets/img/bem/kabem<?php echo $d->no_urut;?>.png" name="kabem<?php echo $d->no_urut;?>"> </div> <div class="col-md-6"> <img class="avatar" src="<?php echo base_url();?>assets/img/bem/wakabem<?php echo $d->no_urut;?>.png" name="wakabem<?php echo $d->no_urut;?>"> </div> </div> <div class="row desc-container text-center"> <div class="col-md-6"> <p><strong>CALON<br>KETUA</strong></p> <p><?php echo $d->nama_ketua; ?></p> </div> <div class="col-md-6"> <p><strong>CALON<br>WAKIL KETUA</strong></p> <p><?php echo $d->nama_wakil; ?></p> </div> </div> </div> <?php } ?> <div class="row text-center"> <div class="col-md-3 line"></div> <div class="col-md-5 line transparent"> <input type="submit" id="lanjut" name="fbem" class="btn btn-link btn-lg" value="Lanjut &raquo;" onclick="is_vote(validate())"> </div> <div class="col-md-3 line"></div> </div> </form> </div> <div class="row text-center"> <!-- <div class="col-md-3 line"></div> --> <div class="col-md-11 line footer"> <img class="footer-img" src="<?php echo base_url();?>assets/img/footerlogo.png"> <label id="copyright" class=""> Copyright &copy; Pemiltas FKM <?= date("Y");?> <br> All Right Reserved </label> </div> <!-- <div class="col-md-3 line"></div> --> </div> </div>
39.147059
233
0.603306
65a3e5ef786bff02bcc771e0bae40fada80ebc31
14,973
lua
Lua
www/.lua/ZoneDB.lua
RealTimeLogic/SharkTrustEx
e68e228fd3d29b146498e141a0fdda0060277cbb
[ "MIT" ]
2
2021-03-25T07:15:29.000Z
2021-03-26T18:29:30.000Z
www/.lua/ZoneDB.lua
RealTimeLogic/SharkTrustX
e68e228fd3d29b146498e141a0fdda0060277cbb
[ "MIT" ]
null
null
null
www/.lua/ZoneDB.lua
RealTimeLogic/SharkTrustX
e68e228fd3d29b146498e141a0fdda0060277cbb
[ "MIT" ]
1
2020-11-25T05:01:39.000Z
2020-11-25T05:01:39.000Z
local fmt, sbyte, tinsert, tunpack = string.format, string.byte, table.insert, table.unpack local su = require "sqlutil" local rcBridge = require "RevConnBridge" -- 64 byte hex key local function createHexKey(bytes) return ba.rndbs(bytes):gsub(".", function(x) return fmt("%02x", sbyte(x)) end) end -- Encapsulation of the connection used exclusively for writing -- dbExec(sql, noCommit, func) -- Async DB insert with optional callback local env, dbExec = (function() local env, wconn = io:dofile(".lua/CreateDB.lua",_ENV)() -- Requires env:io assert(env, fmt("Cannot open zones.db: %s", wconn)) assert(wconn:execute "PRAGMA foreign_keys = on;") assert(wconn:setautocommit "IMMEDIATE") local function commit() while true do local ok, err = wconn:commit "IMMEDIATE" if ok then break end if err ~= "BUSY" then trace("ERROR: commit failed on exclusive connection:", err) break end end end local function checkExec(sql, ok, err, err2) if not ok then trace("SQL err:", err2 or err, sql) end end local dbthread = ba.thread.create() local function dbExec(sql, noCommit, func) tracep(9,sql) dbthread:run( function() if sql then checkExec(sql, wconn:execute(sql)) end if not noCommit then commit() end if func then func() end end ) end return env, dbExec end)() local quote = env.quotestr local function quotedNowTime() return quote(ba.datetime"NOW":tostring()) end -- Open/close connections used exclusively for reading. local function openConn() local x, conn = su.open(env, "zones") if conn then conn:setbusytimeout(10000) end return conn end local function closeConn(conn) conn:close() end -- Wraps around openConn/closeConn and "sqlutil.lua"'s iterator -- Note, when tab=false: The iterator can at most return one element local function sqlIter(sql,tab) local conn = openConn() local next = su.iter(conn, sql, tab) return function() local t, err = next() if t then return t end if err then trace("Err:", err, sql) end closeConn(conn) end end -- can return one element, one column or a table local function dbFind(tab, sql) local conn = openConn() local x, err = true == tab and su.findt(conn, sql, {}) or su.find(conn, sql) if not x and err then trace("Err:", err) end closeConn(conn) return x end ------------------------------- READING ------------------------------------ local function getZoneKey(zname) return dbFind(false, fmt("%s%s%s", "zkey FROM zones WHERE zname=", quote(zname), " COLLATE NOCASE")) end local function zidGetZoneT(zid) return dbFind(true, fmt("%s%s", "* FROM zones WHERE zid=", zid)) end local function znameGetZoneT(zname) local t=dbFind(true, fmt("%s%s%s", "* FROM zones WHERE zname=", quote(zname), " COLLATE NOCASE")) if t then t.autoReg = t.autoReg == "1" t.sso = t.sso == "1" end return t end local function zkeyGetZoneT(zkey) return dbFind(true, fmt("%s%s%s", "* FROM zones WHERE zkey=", quote(zkey), " COLLATE NOCASE")) end local function getZoneName(zkey) return dbFind(false, fmt("%s%s%s", "zname FROM zones WHERE zkey=", quote(zkey), " COLLATE NOCASE")) end local function getZid4Zone(zkey) return dbFind(false, fmt("%s%s%s", "zid FROM zones WHERE zkey=", quote(zkey), " COLLATE NOCASE")) end -- Returns table with keys 'did,name,dkey,localAddr,wanAddr,dns,info,zid' local function keyGetDeviceT(dkey) return dbFind(true, fmt("%s%s%s", "* FROM devices WHERE dkey=", quote(dkey), " COLLATE NOCASE")) end local function nameGetDeviceT(zid, name) return dbFind(true, fmt("%s%s and name=%s%s", "* FROM devices WHERE zid=", zid, quote(name), " COLLATE NOCASE")) end local function countDevices4Zone(zid) return tonumber(dbFind(false, fmt("%s%s", "count(*) FROM devices WHERE zid=", zid))) end -- Returns iterator, which returns a table with all of the zone's keys/vals -- zid can be the zone ID (zid) or the zone key (zkey) local function getDevices4ZoneT(zid) zid = "string" == type(zid) and #zid == 64 and getZid4Zone(zid) or zid local sql = fmt("%s%s%s", "* FROM devices WHERE zid=", zid, " ORDER BY wanAddr,name ASC") return sqlIter(sql, true) end -- Get all devices for zone that are part of the WAN "wanAddr" --Returns iterator, which returns devT local function getDevices4Wan(zid, wanAddr) local sql = fmt("%s%s%s%s%s", "* FROM devices where wanAddr=", quote(wanAddr), " AND zid=", zid, " ORDER BY name ASC") return sqlIter(sql,true) end -- Get all devices a regular user has access to -- Returns: -- if tab=true: a table where key=did,val=true -- if not tab: an iterator, which returns a table with all of the zone's keys/vals local function getDevices4User(uid,tab) local sql = fmt( "%s%s%s%s", tab and "devices.did" or "*", " FROM devices INNER JOIN UsersDevAccess ON devices.did == UsersDevAccess.did WHERE UsersDevAccess.uid=", uid, " ORDER BY wanAddr,name ASC" ) if tab then local t={} local conn = openConn() local next = su.iter(conn, sql) local did,err = next() while did do t[did] = true did,err = next() end if err then trace("Err:", err, sql) end closeConn(conn) return t end return sqlIter(sql, true) end -- Returns iterator, which returns zid,zname,zkey local function getZonesT() local conn = openConn() local sql = "zid,zname,zkey FROM zones" local next = su.iter(conn, sql) return function() local zid, zname, zkey = next() if zid then return zid, zname, zkey end if zname then trace("Err:", zname, sql) end closeConn(conn) end end local function getAutoReg(zid) local enabled = dbFind(false, fmt("%s%s", "autoReg FROM zones WHERE zid=",zid)) return enabled == "1" end local function getSsoEnabled(zid) local enabled = dbFind(false, fmt("%s%s", "sso FROM zones WHERE zid=",zid)) return enabled == "1" end local function getSsoCfg(zid) local cfg = dbFind(false, fmt("%s%s", "ssocfg FROM zones WHERE zid=",zid)) return cfg and ba.json.decode(cfg) end -- Returns table array with all wan addresses for zone ID local function getWanL(zid) local conn = openConn() local list = {} local sql = fmt("%s%s", "DISTINCT wanAddr FROM devices where zid=", zid) for wanAddr in su.iter(conn, sql) do tinsert(list, wanAddr) end closeConn(conn) return list end -- Returns iterator, which returns uid,email,regTime,accessTime,poweruser local function getUsers(zid) local conn = openConn() local sql = fmt("%s%s","uid,email,regTime,accessTime,poweruser FROM users WHERE zid=", zid) local next = su.iter(conn, sql) return function() local uid,email,regTime,accessTime,poweruser = next() if uid then return uid,email,regTime,accessTime,poweruser == "1" end if email then trace("Err:", email, sql) end closeConn(conn) end end -- Get user info by email addr. -- Returns userT local function getUserT(zid, email) local uT = dbFind(true, fmt("%s%s%s%s%s", "* FROM users WHERE zid=", zid, " AND email=", quote(email), " COLLATE NOCASE")) if uT then uT.poweruser = uT.poweruser ~= "0" end return uT end ------------------------------- WRITING ------------------------------------ local function addZone(zname, admEmail, admPwd, func) if getZoneKey(zname) then trace("Err: zone exists:", zname) return end local zkey while true do zkey = createHexKey(32) if not dbFind(false, fmt("%s%s%s", "zkey FROM zones WHERE zkey=", quote(zkey), " COLLATE NOCASE")) then break end end local now = quotedNowTime() dbExec( fmt( "%s(%s,%s,%s,%s,%s,%s,%s,0)", "INSERT INTO zones (zname,regTime,accessTime,admEmail,admPwd,zkey,zsecret,autoReg) VALUES", quote(zname), now, now, quote(admEmail), quote(admPwd), quote(zkey), quote(createHexKey(32)) ), false, func ) -- Return a simplified zoneT. We just need these values for bindzonedb() return {zname = zname, zkey = zkey, zid = 0} end local function updateAdmPwd(zid, admPwd) dbExec(fmt("UPDATE zones SET admPwd=%s WHERE zid=%s", quote(admPwd), zid)) end local function updateUSerPwd(zid, email, pwd) dbExec(fmt("UPDATE users SET pwd=%s WHERE zid=%s AND email=%s COLLATE NOCASE", quote(pwd), zid, quote(email))) end local function setAutoReg(zid, enable) dbExec(fmt("UPDATE zones SET autoReg=%d WHERE zid=%s", enable and 1 or 0, zid)) end local function setSsoEnabled(zid, enable) dbExec(fmt("UPDATE zones SET sso=%d WHERE zid=%s", enable and 1 or 0, zid)) end local function setSsoCfg(zid, tab) dbExec(fmt("UPDATE zones SET ssocfg=%s WHERE zid=%s", quote(ba.json.encode(tab)), zid)) end local function removeZone(zkey,func) local zid = getZid4Zone(zkey) if not zid then trace("Not found:", zname) return end local devsL={} for devT in getDevices4ZoneT(zid) do tinsert(devsL, devT) end for _,devT in ipairs(devsL) do dbExec(fmt("%s%s", "DELETE FROM UsersDevAccess WHERE did=", devT.did), true) rcBridge.removeDevice(devT.dkey) end dbExec(fmt("%s%s", "DELETE FROM devices WHERE zid=", zid), true) dbExec(fmt("%s%s", "DELETE FROM users WHERE zid=", zid), true) dbExec(fmt("%s%s", "DELETE FROM zones WHERE zid=", zid),false,func) end local function removeUsers(uidL) for _,uid in pairs(uidL) do dbExec(fmt("%s%s", "DELETE FROM UsersDevAccess WHERE uid=", uid), true) dbExec(fmt("%s%s", "DELETE FROM Users WHERE uid=", uid), true) end dbExec() -- Commit end local function addDevice(zkey, name, localAddr, wanAddr, dns, info, func) local zid = getZid4Zone(zkey) if not zid then trace("zkey not found:", zkey) return end if dbFind(false, fmt("%s%s AND name=%s%s", "dkey FROM devices WHERE zid=", zid, quote(name), " COLLATE NOCASE")) then trace("Err: device exists:", name) return end local dkey while true do dkey = createHexKey(10) if not dbFind(false, fmt("%s%s%s", "dkey FROM devices WHERE dkey=", quote(dkey), " COLLATE NOCASE")) then break end end local now = quotedNowTime() dbExec( fmt( "%s(%s,%s,%s,%s,%s,%s,%s,%s,%s)", "INSERT INTO devices (name,dkey,localAddr,wanAddr,dns,info,regTime,accessTime,zid) VALUES", quote(name), quote(dkey), quote(localAddr), quote(wanAddr), quote(dns), quote(info), now, now, zid ), false, func ) return dkey end local function updateAddress4Device(dkey, localAddr, wanAddr, dns, func) dbExec( fmt( "UPDATE devices SET localAddr=%s, wanAddr=%s, dns=%s, accessTime=%s WHERE dkey=%s", quote(localAddr), quote(wanAddr), quote(dns), quotedNowTime(), quote(dkey) ), false, func ) end local function updateTime4Device(dkey) dbExec(fmt("UPDATE devices SET accessTime=%s WHERE dkey=%s", quotedNowTime(), quote(dkey))) end local function removeDevice(dkey, func) local t = keyGetDeviceT(dkey) if t then dbExec(fmt("%s%s", "DELETE FROM UsersDevAccess WHERE did=", t.did), true) dbExec(fmt("%s%s%s", "DELETE FROM devices WHERE did=", t.did, " COLLATE NOCASE"), false, func) rcBridge.removeDevice(dkey) else trace("Not found", dkey) end end local function addUser(zid, email, pwd, poweruser, func) local now=quotedNowTime() dbExec( fmt( "%s(%s,%s,%s,%s,%d,%s)", "INSERT INTO users (email,pwd,regTime,accessTime,poweruser,zid) VALUES", quote(email), quote(pwd), now, now, poweruser and 1 or 0, zid ), false, func ) end local function setUserAccessTime(uid) dbExec(fmt("UPDATE users SET accessTime=%s WHERE uid=%s", quotedNowTime(), uid)) end local function setPoweruser(uid, poweruser) dbExec(fmt("UPDATE users SET poweruser=%d WHERE uid=%s", poweruser and 1 or 0, uid)) end -- Create an entry in UserDevAccess if the entry does not exist local function createUserDevAccess(uid,did,noCommit) -- Execute UPSERT dbExec( fmt( "%s(%s,%s)%s", "INSERT INTO UsersDevAccess (did,uid) VALUES", did, uid, "ON CONFLICT (did,uid) DO NOTHING" ), noCommit ) end -- Auto set user access for all devices part of "wanAddr". -- This function is called when user logs in. local function setUserAccess4Wan(zid, uid, wanAddr) for devT in getDevices4Wan(zid, wanAddr) do createUserDevAccess(uid,devT.did, true) end dbExec() -- Commit end -- Create or delete an entry in UsersDevAccess local function setDevAccess4User(uid,did,enable) if enable then createUserDevAccess(uid,did) else dbExec(fmt("%s uid=%s and did=%s", "DELETE FROM UsersDevAccess WHERE", uid,did)) end end return { addDevice = addDevice, -- (zkey, name, localAddr, wanAddr, dns, info, func) addUser = addUser, -- (zid, email, pwd, poweruser) addZone = addZone, -- (zname, admEmail, admPwd, func) countDevices4Zone = countDevices4Zone, -- (zid) getAutoReg=getAutoReg, -- (zid) getSsoEnabled=getSsoEnabled, -- (zid) getSsoCfg=getSsoCfg, -- (zid) getDevices4User=getDevices4User, -- (uid) getDevices4Wan = getDevices4Wan, -- (zid, wanAddr) getDevices4ZoneT = getDevices4ZoneT, -- (zid) getUserT = getUserT, -- (zid, email) getUsers=getUsers, -- (zid) getWanL = getWanL, -- (zid) getZid4Zone = getZid4Zone, -- (zkey) getZoneKey = getZoneKey, -- (zname) getZoneName = getZoneName, -- (zkey) getZonesT = getZonesT, -- () keyGetDeviceT = keyGetDeviceT, -- (dkey) nameGetDeviceT = nameGetDeviceT, -- (zid, name) removeDevice = removeDevice, -- (dkey, func) removeUsers=removeUsers, -- (uidL) removeZone = removeZone, -- (zkey) setAutoReg=setAutoReg, -- (zid, enable) setSsoEnabled=setSsoEnabled, -- (zid, enable) setSsoCfg=setSsoCfg, -- (zid, lua-table) setDevAccess4User=setDevAccess4User, -- (uid,did,enable) setUserAccessTime=setUserAccessTime , -- (uid) setPoweruser=setPoweruser, -- (uid, poweruser) setUserAccess4Wan = setUserAccess4Wan, -- (zid, uid, wanAddr) updateAddress4Device = updateAddress4Device, -- (dkey, localAddr, wanAddr, dns, func) updateAdmPwd = updateAdmPwd, -- (zid, admPwd) updateTime4Device = updateTime4Device, -- (dkey) updateUSerPwd = updateUSerPwd, -- (zid, email, pwd) zidGetZoneT = zidGetZoneT, -- (zid) zkeyGetZoneT = zkeyGetZoneT, -- (zkey) znameGetZoneT = znameGetZoneT -- (zname) }
30.494908
121
0.641288
cbd6b6233ffa36e9a0d47aff1eef0a375c872114
266
c
C
2nd/core/windows/write0.c
keitaroskmt/cpuex2020_1
33cdc033a6184286232f4ce7729030708213b6f8
[ "BSD-3-Clause-Attribution", "FSFAP" ]
null
null
null
2nd/core/windows/write0.c
keitaroskmt/cpuex2020_1
33cdc033a6184286232f4ce7729030708213b6f8
[ "BSD-3-Clause-Attribution", "FSFAP" ]
null
null
null
2nd/core/windows/write0.c
keitaroskmt/cpuex2020_1
33cdc033a6184286232f4ce7729030708213b6f8
[ "BSD-3-Clause-Attribution", "FSFAP" ]
3
2020-10-08T04:16:58.000Z
2021-10-11T13:19:30.000Z
#include <stdio.h> int main(){ FILE *fp; fp = fopen("main_with0.mem","w"); int n = 624288; char buf[33] = "00000000000000000000000000000000\n"; for(int i=0;i<n;i++){ fwrite(&buf,sizeof(buf),1,fp); } fclose(fp); return 0; }
16.625
56
0.548872
3b3674ed2c84600d3db700ccbf42bbd4e0e3e772
817
rs
Rust
kernel/src/gdt.rs
itto-ki/SawayakanaOS
1057427c51c0dea6c8ccfba30d307dbb84e6bd13
[ "MIT" ]
4
2018-08-06T14:07:13.000Z
2021-03-19T12:46:49.000Z
kernel/src/gdt.rs
itto-ki/SawayakanaOS
1057427c51c0dea6c8ccfba30d307dbb84e6bd13
[ "MIT" ]
1
2018-08-09T06:24:49.000Z
2018-08-09T06:24:49.000Z
kernel/src/gdt.rs
itto-ki/SawayakanaOS
1057427c51c0dea6c8ccfba30d307dbb84e6bd13
[ "MIT" ]
1
2020-03-04T09:39:47.000Z
2020-03-04T09:39:47.000Z
// Reference: https://wiki.osdev.org/Global_Descriptor_Table // http://softwaretechnique.jp/OS_Development/kernel_development02.html #[repr(packed)] pub struct GdtEntry { pub segment_limit_low: u16, pub base_address_low: u16, pub base_address_mid: u8, pub access: u8, pub flags_limit: u8, pub base_address_high: u8, } impl GdtEntry { pub const fn new(offset: u32, limit: u32, access: u8, flags: u8) -> Self { GdtEntry { segment_limit_low: limit as u16, base_address_low: offset as u16, base_address_mid: (offset >> 16) as u8, access: access, flags_limit: flags & 0xF0 | ((limit >> 16) as u8) & 0x0F, base_address_high: (offset >> 24) as u8, } } }
32.68
82
0.586291
40e930dbe06c60ea2fd77af71a229154096699d1
310
sql
SQL
cube/setup/db/upgrade/5.2.13.sql
aoxiaoqiang/tempUpload
89d01c21b712386f6e2300c4abbd217158a58349
[ "MIT" ]
null
null
null
cube/setup/db/upgrade/5.2.13.sql
aoxiaoqiang/tempUpload
89d01c21b712386f6e2300c4abbd217158a58349
[ "MIT" ]
null
null
null
cube/setup/db/upgrade/5.2.13.sql
aoxiaoqiang/tempUpload
89d01c21b712386f6e2300c4abbd217158a58349
[ "MIT" ]
null
null
null
ALTER TABLE `CubeCart_geo_country` ADD `eu` TINYINT UNSIGNED NOT NULL DEFAULT '0', ADD INDEX ( `eu` ); #EOQ UPDATE `CubeCart_geo_country` SET `eu` = 1 WHERE `iso` IN('BG','CZ','DK','DE','EE','IE','EL','ES','FR','HR','IT','CY','LV','LT','LU','HU','MT','NL','AT','PL','PT','RO','SI','SK','FI','SE','UK'); #EOQ
155
199
0.570968
12e9c09c85c83b9cfd52e1a2bbdf1bd24c771293
1,641
cs
C#
Reaqtive/Core/Reaqtive.Linq/Reaqtive/Operators/Throw.cs
ScriptBox99/reaqtor
0680ffc1557912db349877fc422481479b4acf76
[ "MIT" ]
485
2021-05-18T14:32:32.000Z
2022-03-29T21:23:46.000Z
Reaqtive/Core/Reaqtive.Linq/Reaqtive/Operators/Throw.cs
ScriptBox99/reaqtor
0680ffc1557912db349877fc422481479b4acf76
[ "MIT" ]
54
2021-05-18T19:08:03.000Z
2022-03-21T20:21:26.000Z
Reaqtive/Core/Reaqtive.Linq/Reaqtive/Operators/Throw.cs
ScriptBox99/reaqtor
0680ffc1557912db349877fc422481479b4acf76
[ "MIT" ]
35
2021-05-18T14:35:48.000Z
2022-01-21T23:35:35.000Z
// 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. using System; using Reaqtive.Tasks; namespace Reaqtive.Operators { internal sealed class Throw<TResult> : SubscribableBase<TResult> { private readonly Exception _error; public Throw(Exception error) { _error = error; } protected override ISubscription SubscribeCore(IObserver<TResult> observer) { return new _(this, observer); } private sealed class _ : StatefulUnaryOperator<Throw<TResult>, TResult> { private IOperatorContext _context; public _(Throw<TResult> parent, IObserver<TResult> observer) : base(parent, observer) { } public override string Name => "rc:Throw"; public override Version Version => Versioning.v1; public override void SetContext(IOperatorContext context) { base.SetContext(context); _context = context; } protected override void OnStart() { _context.Scheduler.Schedule(new ActionTask(() => { _context.TraceSource.Throw_Processing(_context.InstanceId); Output.OnError(Params._error); Dispose(); })); _context.TraceSource.Throw_Scheduling(_context.InstanceId); } } } }
27.35
83
0.572212
549a5c3bb029b00789d026e4c9514fe942fd1cfa
1,583
h
C
PrivateFrameworks/MediaMiningKit/CLSContactHistoryCollector.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
17
2018-11-13T04:02:58.000Z
2022-01-20T09:27:13.000Z
PrivateFrameworks/MediaMiningKit/CLSContactHistoryCollector.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
3
2018-04-06T02:02:27.000Z
2018-10-02T01:12:10.000Z
PrivateFrameworks/MediaMiningKit/CLSContactHistoryCollector.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
1
2018-09-28T13:54:23.000Z
2018-09-28T13:54:23.000Z
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "NSObject.h" #import "CNChangeHistoryEventVisitor.h" @class NSData, NSMutableArray, NSString; @interface CLSContactHistoryCollector : NSObject <CNChangeHistoryEventVisitor> { BOOL _didDropEverything; NSMutableArray *_insertedContactIdentifiers; NSMutableArray *_updatedContactIdentifiers; NSMutableArray *_deletedContactIdentifiers; NSData *_contactHistoryToken; } @property(retain, nonatomic) NSData *contactHistoryToken; // @synthesize contactHistoryToken=_contactHistoryToken; @property(retain, nonatomic) NSMutableArray *deletedContactIdentifiers; // @synthesize deletedContactIdentifiers=_deletedContactIdentifiers; @property(retain, nonatomic) NSMutableArray *updatedContactIdentifiers; // @synthesize updatedContactIdentifiers=_updatedContactIdentifiers; @property(retain, nonatomic) NSMutableArray *insertedContactIdentifiers; // @synthesize insertedContactIdentifiers=_insertedContactIdentifiers; @property BOOL didDropEverything; // @synthesize didDropEverything=_didDropEverything; - (void).cxx_destruct; - (void)visitDeleteContactEvent:(id)arg1; - (void)visitUpdateContactEvent:(id)arg1; - (void)visitAddContactEvent:(id)arg1; - (void)visitDropEverythingEvent:(id)arg1; - (id)init; // Remaining properties @property(readonly, copy) NSString *debugDescription; @property(readonly, copy) NSString *description; @property(readonly) unsigned long long hash; @property(readonly) Class superclass; @end
37.690476
143
0.804169
a1305f0a92337107c191f04401c4915c639f9e55
804
ts
TypeScript
node_modules/@metaplex-foundation/mpl-token-vault/dist/src/transactions/InitVault.d.ts
vamise/fyfy-candy-machine
5f41f42b9609d29c42419984265b48e90b0a5f85
[ "MIT" ]
null
null
null
node_modules/@metaplex-foundation/mpl-token-vault/dist/src/transactions/InitVault.d.ts
vamise/fyfy-candy-machine
5f41f42b9609d29c42419984265b48e90b0a5f85
[ "MIT" ]
null
null
null
node_modules/@metaplex-foundation/mpl-token-vault/dist/src/transactions/InitVault.d.ts
vamise/fyfy-candy-machine
5f41f42b9609d29c42419984265b48e90b0a5f85
[ "MIT" ]
null
null
null
import { Borsh, Transaction } from '@metaplex-foundation/mpl-core'; import { PublicKey, TransactionCtorFields } from '@solana/web3.js'; import { VaultInstructions } from '../VaultProgram'; export declare class InitVaultArgs extends Borsh.Data<{ allowFurtherShareCreation: boolean; }> { static readonly SCHEMA: any; instruction: VaultInstructions; allowFurtherShareCreation: boolean; } declare type InitVaultParams = { vault: PublicKey; vaultAuthority: PublicKey; fractionalMint: PublicKey; redeemTreasury: PublicKey; fractionalTreasury: PublicKey; pricingLookupAddress: PublicKey; allowFurtherShareCreation: boolean; }; export declare class InitVault extends Transaction { constructor(options: TransactionCtorFields, params: InitVaultParams); } export {};
33.5
73
0.761194
f42322980e0f887b845cd6d67532e2b8bb2bc297
497
cs
C#
TheLogRun.UnitTestProject/Projection/SnapshotTaken_UnitTest.cs
MerrionComputing/AzureFunctions-TheLongRun-Leagues
df163024710001cf0a7f01f9e3193162d519c935
[ "Unlicense" ]
13
2018-04-20T15:04:27.000Z
2020-05-30T07:17:38.000Z
TheLogRun.UnitTestProject/Projection/SnapshotTaken_UnitTest.cs
MerrionComputing/AzureFunctions-TheLongRun-Leagues
df163024710001cf0a7f01f9e3193162d519c935
[ "Unlicense" ]
9
2018-12-31T14:55:29.000Z
2019-03-16T09:23:18.000Z
TheLogRun.UnitTestProject/Projection/SnapshotTaken_UnitTest.cs
MerrionComputing/AzureFunctions-TheLongRun-Leagues
df163024710001cf0a7f01f9e3193162d519c935
[ "Unlicense" ]
3
2019-02-17T08:07:04.000Z
2020-08-28T14:22:05.000Z
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using TheLongRun.Common.Events.Projection; namespace TheLogRun.UnitTestProject.Projection { [TestClass] public class SnapshotTaken_UnitTest { [TestMethod] public void Constructor_TestMethod() { SnapshotTaken testEvt = new SnapshotTaken("123", new DateTime(2018, 08, 12), 12, "Unit testing", @"C:\Temp"); Assert.IsNotNull(testEvt); } } }
22.590909
92
0.641851
25d8a2b4a45face67bab7864768d2de8868ca324
563
cs
C#
src/Assimp/Silk.NET.Assimp/Enums/BlendMode.gen.cs
Libertus-Lab/Silk.NET
20598c5db4f6faea1e3b51d2bf6a6e99639cbef4
[ "MIT" ]
null
null
null
src/Assimp/Silk.NET.Assimp/Enums/BlendMode.gen.cs
Libertus-Lab/Silk.NET
20598c5db4f6faea1e3b51d2bf6a6e99639cbef4
[ "MIT" ]
null
null
null
src/Assimp/Silk.NET.Assimp/Enums/BlendMode.gen.cs
Libertus-Lab/Silk.NET
20598c5db4f6faea1e3b51d2bf6a6e99639cbef4
[ "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. using System; using Silk.NET.Core.Attributes; #pragma warning disable 1591 namespace Silk.NET.Assimp { [Flags] [NativeName("Name", "aiBlendMode")] public enum BlendMode : int { [NativeName("Name", "")] None = 0, [NativeName("Name", "aiBlendMode_Default")] BlendModeDefault = 0x0, [NativeName("Name", "aiBlendMode_Additive")] BlendModeAdditive = 0x1, } }
23.458333
71
0.648313
e2c25f2c379ec1138a07d3b91ae609f9c753e97f
411
py
Python
scripts/wallpaper.py
thirteen-incense/dwm
9aa7c00d0f93a86433428d1448f1676545d615db
[ "MIT" ]
null
null
null
scripts/wallpaper.py
thirteen-incense/dwm
9aa7c00d0f93a86433428d1448f1676545d615db
[ "MIT" ]
null
null
null
scripts/wallpaper.py
thirteen-incense/dwm
9aa7c00d0f93a86433428d1448f1676545d615db
[ "MIT" ]
null
null
null
#!/usr/bin/env python import os import time import random path = "/home/Octo/.wallpapers/" files = os.listdir(path) while 1 == 1 : paper_list = list(map(lambda x: (random.random(), x), files)) paper_list.sort() for i in range(len(paper_list)): (x,y) = paper_list[i] z = path + y os.system("feh --bg-fill %s &" % (z)) # print('%d %s' % (i,y)) time.sleep(60)
21.631579
65
0.559611
393785a56f8b29ca25b2fd89e8a4cc863b01fd22
392
py
Python
0238 Product of Array Except Self.py
MdAbedin/leetcode
e835f2e716ea5fe87f30b84801ede9bc023749e7
[ "MIT" ]
4
2020-09-11T02:36:11.000Z
2021-09-29T20:47:11.000Z
0238 Product of Array Except Self.py
MdAbedin/leetcode
e835f2e716ea5fe87f30b84801ede9bc023749e7
[ "MIT" ]
3
2020-09-10T03:51:42.000Z
2021-09-25T01:41:57.000Z
0238 Product of Array Except Self.py
MdAbedin/leetcode
e835f2e716ea5fe87f30b84801ede9bc023749e7
[ "MIT" ]
6
2020-09-10T03:46:15.000Z
2021-09-25T01:24:48.000Z
class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: prod = 1 prods = [1]*len(nums) for i in range(len(nums)): prods[i] = prod prod *= nums[i] prod = 1 for i in range(len(nums)-1, -1, -1): prods[i] *= prod prod *= nums[i] return prods
24.5
62
0.423469
ce485d3945ec01938ce1cc2b0d888ebd8daff438
958
lua
Lua
config/neovim/lua/config/api/vimacs.lua
sei40kr/npm-aliases
c1dd180a277b6ddc27f751e60b5dbbacc697847a
[ "MIT" ]
null
null
null
config/neovim/lua/config/api/vimacs.lua
sei40kr/npm-aliases
c1dd180a277b6ddc27f751e60b5dbbacc697847a
[ "MIT" ]
null
null
null
config/neovim/lua/config/api/vimacs.lua
sei40kr/npm-aliases
c1dd180a277b6ddc27f751e60b5dbbacc697847a
[ "MIT" ]
null
null
null
local M = {} function M.kill_word() local col = vim.api.nvim_win_get_cursor(0)[2] local line = vim.api.nvim_get_current_line() if #line <= col then vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes("<Del><C-o>dw", true, true, true), "i", true ) else vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes("<C-o>dw", true, true, true), "i", true ) end end function M.kill_line() local col = vim.api.nvim_win_get_cursor(0)[2] local line = vim.api.nvim_get_current_line() if #line <= col then vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes("<Del>", true, true, true), "i", true ) else vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes("<C-o>d$", true, true, true), "i", true ) end end return M
22.809524
77
0.532359
a38be9776a8b1b1e9d8a6dac26756922eb66902d
387
ts
TypeScript
api-schemas/src/routes/user-info.ts
szczurzy-torpedowiec/greatest
015aa685004baa13f8a1bad47aa6b5c221cb5c70
[ "MIT" ]
2
2021-09-18T21:30:56.000Z
2021-10-09T14:52:03.000Z
api-schemas/src/routes/user-info.ts
dominik-korsa/board-camera
6b2182f145551f20194e98b4a0675e31e46c10ca
[ "MIT" ]
null
null
null
api-schemas/src/routes/user-info.ts
dominik-korsa/board-camera
6b2182f145551f20194e98b4a0675e31e46c10ca
[ "MIT" ]
1
2021-10-16T20:42:50.000Z
2021-10-16T20:42:50.000Z
import { Static, Type } from '@sinclair/typebox'; import { nullable } from '../utility'; export const viewerSchema = Type.Object({ name: Type.String(), email: Type.String(), avatarUrl: Type.String(), }); export type Viewer = Static<typeof viewerSchema>; export const getViewerReplySchema = nullable(viewerSchema); export type GetViewerReply = Static<typeof getViewerReplySchema>;
32.25
65
0.744186
af544261ca4ea8f6fc4e6be9524df1d9def19bc6
3,998
py
Python
ENIAC/api/mongo_operate.py
Ahrli/fast_tools
144d764e4f169d3ab3753dcc6a79db9f9449de59
[ "Apache-2.0" ]
1
2021-12-11T16:33:47.000Z
2021-12-11T16:33:47.000Z
ENIAC/api/mongo_operate.py
webclinic017/fast_tools
144d764e4f169d3ab3753dcc6a79db9f9449de59
[ "Apache-2.0" ]
null
null
null
ENIAC/api/mongo_operate.py
webclinic017/fast_tools
144d764e4f169d3ab3753dcc6a79db9f9449de59
[ "Apache-2.0" ]
3
2021-11-22T09:46:43.000Z
2022-01-28T22:33:07.000Z
import pandas as pd from pymongo import MongoClient from pymongo.errors import BulkWriteError, DuplicateKeyError from pymongo import InsertOne import arrow import pendulum import numpy as np # mongo 2 df def read_mongo( # ='BTC_statistics_v3', db='kline_factors', collection='bt_day_GEMINI', query={}, # 查询 select={'_id': 0}, # 选择字段 sortby="_id", # 排序字段 upAndDown=1, # 升序 # limitNum=9999999999, # 限制数量 limitNum=999999, # 限制数量 # url='mongodb://root:[email protected]:3717,dds-uf66056e937ca0942.mongodb.rds.aliyuncs.com:3717/admin?replicaSet=mgset-10450573', url='mongodb://192.168.249.154:27017', no_id=0, # 默认不删除_id _dtype='float32'): """ Read from Mongo and Store into DataFrame """ # Connect to MongoDB with MongoClient(url) as client: collection = client[db][collection] data = collection.find(query, select).sort(sortby, upAndDown).limit(limitNum) df = pd.DataFrame(list(data), dtype=_dtype) # Delete the _id if no_id: del df['_id'] return df def read_mongo_aggregate( db='stock_data', collection='dfcf_ajax_data', pipline=[ {"$match": {"date": "2020-03-31", "$or": [{'market': 'SH'}, {'market': 'SZ'}]}}, {"$group": {"_id": {"mc": "$mc", "Type": "$Type", }, "num": {"$sum": 1}, "cgsz": {"$sum": "$cgsz"}}}, {"$project": {"mc": "$_id.mc", "Type": "$_id.Type", "num": "$num", "cgsz": "$cgsz"}}, {'$sort': {"num": -1}}, {'$limit': 99999999}], url='mongodb://192.168.249.154:27017', no_id=1, # 默认不删除_id _dtype='float32'): """ Read from Mongo and Store into DataFrame """ # Connect to MongoDB with MongoClient(url) as client: collection = client[db][collection] data = collection.aggregate(pipline) df = pd.DataFrame(list(data), dtype=_dtype) # Delete the _id if no_id: del df['_id'] return df # df 2 mongo def update_mongo(db='kline_factors', collection='test_collection_4', _df=pd.DataFrame(np.random.randn(6, 4), index=pd.date_range('20130101', periods=6), columns=['time_key', 'A', 'B', 'C']), _id=['time_key', 'OKEX.BTC'], # 最后一个字段为标签,之前为df的字段 url='mongodb://root:[email protected]:3717,dds-uf66056e937ca0942.mongodb.rds.aliyuncs.com:3717/admin?replicaSet=mgset-10450573', limitNum=1000, # todo 每 1000行 提交mongo 1次 bulk=0, # 是否批量提交 默认不批量提交,从而记录非重复_id数量 ): _list = _df.to_dict(orient='records') with MongoClient(url) as client: collection = client[db][collection] data = [] num = 0 if bulk == 1: for i, j in zip(_list, list(_df[_id[0]])): i['_id'] = f"{j}_{_id[-1]}" data.append(InsertOne(i)) try: collection.bulk_write(data, # ordered=False, # 是否有序写入 ) return len(_df) except BulkWriteError as bwe: print(bwe.details) return -1 else: for i, j in zip(_list, list(_df[_id[0]])): i['_id'] = f"{j}_{_id[-1]}" try: collection.insert_one(i) num += 1 except DuplicateKeyError as bwe: # print(bwe.details) pass return num
35.696429
183
0.492246
7dacb03c66819dd90c40556cb3deb1ecbca46a57
365
rs
Rust
rust/build.rs
jayzz55/grpc-errors
3494f846416668dd5b813bbae1ff73fbaa2b08e7
[ "MIT" ]
479
2017-03-30T10:33:04.000Z
2022-03-30T17:01:48.000Z
rust/build.rs
jayzz55/grpc-errors
3494f846416668dd5b813bbae1ff73fbaa2b08e7
[ "MIT" ]
17
2017-10-19T08:46:52.000Z
2022-02-18T07:35:13.000Z
rust/build.rs
jayzz55/grpc-errors
3494f846416668dd5b813bbae1ff73fbaa2b08e7
[ "MIT" ]
76
2017-09-28T18:04:22.000Z
2022-03-23T13:13:37.000Z
use std::path::Path; fn main() { let proto_out = "src/proto"; let proto_root = Path::new("../").canonicalize().unwrap(); let proto_file = Path::new("../hello.proto").canonicalize().unwrap(); protoc_grpcio::compile_grpc_protos( &[proto_file], &[proto_root], &proto_out ).expect("Failed to compile gRPC definitions!"); }
26.071429
73
0.610959
749fc2cc1300a57cf51318da97b126499d8a70c3
640
css
CSS
demo/styles/app.css
scatcher/angular-point-offline-generator
a08c556387a5716680be5d3f7c17ce4bf8af07ae
[ "MIT" ]
null
null
null
demo/styles/app.css
scatcher/angular-point-offline-generator
a08c556387a5716680be5d3f7c17ce4bf8af07ae
[ "MIT" ]
null
null
null
demo/styles/app.css
scatcher/angular-point-offline-generator
a08c556387a5716680be5d3f7c17ce4bf8af07ae
[ "MIT" ]
null
null
null
.application-content { margin-top: 60px; } .splash { text-align: center; margin: 10% 0 0 0; } .splash .message { font-size: 5em; line-height: 1.5em; -webkit-text-shadow: rgba(0, 0, 0, 0.5) 0px 0px 15px; text-shadow: rgba(0, 0, 0, 0.5) 0px 0px 15px; text-transform: uppercase; } .splash .icon-spinner { text-align: center; display: inline-block; font-size: 5em; margin-top: 50px; } .loader { margin: 6px 8px 4px 8px; visibility: hidden; } .loader .active { visibility: visible; } .page-content { margin: 0; padding: 8px; } BODY { overflow: inherit; height: auto; }
17.777778
57
0.604688