This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function BarcodeScannerDetector(options) { | |
this.options = options || {}; // Default | |
this.options.keypressDelay = this.options.keypressDelay || 100; // Delay between press | |
this.chars = []; // Our barcode | |
this.events(); | |
} | |
BarcodeScannerDetector.prototype.delay = function(callback, ms) { | |
clearTimeout(this.timer); | |
this.timer = setTimeout(callback, ms); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var n = 7; | |
var center = Math.round(n / 2); | |
var steps = 1; | |
var stepCnt = n * n; | |
var y = center; | |
var x = center; | |
var getPos = (function* getPos() { | |
while (true) { | |
yield 'up' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// exchange btc to eth | |
// trx - transaction from db | |
let hitbtc = new ccxt.hitbtc(); | |
hitbtc.apiKey = ''; | |
hitbtc.secret = ''; | |
// check balance | |
const balance = await hitbtc.fetchBalance(); | |
// balance >= trx.amountFrom check in btc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function argsList(method) { | |
method = method.toString(); | |
const fn = /^function\s*[^\(]*\(\s*([^\)]*)\)/m; | |
const cls = /constructor\s*[^\(]*\(\s*([^\)]*)\)/m; | |
const FN_ARGS = method[0] === 'f' ? fn : cls; | |
const depsStr = method.match(FN_ARGS); | |
const deps = (depsStr) ? depsStr[1].trim().split(/[\s,]+/) : ['']; | |
if (deps[0] === '') { | |
return []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/** | |
* Created by Alexander Litvinov | |
* Email: alexander@codeordie.ru | |
* May be freely distributed under the MIT license | |
*/ | |
let singleton = Symbol(); | |
let singletonEnforcer = Symbol(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by Alexander Litvinov | |
* Email: alexander@codeordie.ru | |
* May be freely distributed under the MIT license | |
*/ | |
namespace common\behaviors; | |
use Yii; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kill -9 $(lsof -t -i :9000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach(Yii::app()->user->getFlashes() as $key => $message) { | |
echo '<div class="flash-' . $key . '">' . $message . "</div>\n"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
protected function checkMethodExists($method) | |
{ | |
if (!method_exists($this, $method)) | |
throw new CException("Method CController::{$method}() not found"); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('DS') or define('DS', DIRECTORY_SEPARATOR); ?> |
NewerOlder