This file contains hidden or 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
/* прирмер использлования скрипта для браузера - подключенного ко всем переходам nightmare*/ | |
var Nightmare = require('nightmare'); | |
const path = require('path'); | |
var nightmare = new Nightmare({ | |
"show": true, | |
"alwaysOnTop": false, | |
"typeInterval": 400, | |
"pollInterval": 1000, |
This file contains hidden or 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
// http://stackoverflow.com/questions/9888387/print-number-of-keys-in-redis | |
eval “return #redis.call(‘keys’, ‘mbt*‘)” 0 | |
// or | |
dbsize |
This file contains hidden or 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 nightmare = new Nightmare({ | |
"show": true, | |
"alwaysOnTop": false, | |
"switches": { | |
"ignore-certificate-errors": true | |
}, | |
"allowDisplayingInsecureContent": true | |
}); | |
var urls = ['http://ya.ru', 'https://moreboats.com']; |
This file contains hidden or 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
/** | |
* | |
* @param {Function} fn - source callback-based function | |
* @param {Function} ctx - context | |
*/ | |
const promisifyMe = function( fn, ctx ) { | |
return function wrappped() { | |
var args = Array.prototype.slice.call( arguments ); | |
return new Promise( function( resolve, reject ) { | |
var tempCallback = function( err, data ) { |
This file contains hidden or 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 async = require('async'); | |
function createUser(id, callback) { | |
console.info('ITERATION', id); | |
callback(null, { id: 'user' + id }); | |
} | |
async.times(5, function(n, next) { | |
createUser(n, function(err, user) { | |
next(err, user); |
This file contains hidden or 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
// module | |
(function(){ | |
"use strict"; | |
this.Calc = function () { | |
return Object.freeze({ | |
add: function(x, y) { return x + y; }, | |
div: function(x, y) { return x / y; }, | |
version: 0.01, | |
}); |
This file contains hidden or 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
window.Object.defineProperty( Element.prototype, 'documentOffsetTop', { | |
get: function () { | |
return this.offsetTop + ( this.offsetParent ? this.offsetParent.documentOffsetTop : 0 ); | |
} | |
} ); | |
window.Object.defineProperty( Element.prototype, 'documentOffsetLeft', { | |
get: function () { | |
return this.offsetLeft + ( this.offsetParent ? this.offsetParent.documentOffsetLeft : 0 ); | |
} |
This file contains hidden or 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 fireEvent(obj, evt){ | |
var fireOnThis = obj; | |
if (document.createEvent) { | |
var evObj = document.createEvent('MouseEvents'); | |
evObj.initEvent(evt, true, false); | |
fireOnThis.dispatchEvent(evObj); | |
} else if (document.createEventObject) { | |
fireOnThis.fireEvent('on' + evt); | |
} |
This file contains hidden or 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
{ | |
$match: { | |
date: { | |
$gte: criteria.startDate, | |
$lt: criteria.endDate | |
} | |
} | |
}, | |
{ | |
$project: { |
This file contains hidden or 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
<div> | |
<span class="tristate tristate-checkbox"> | |
<input type="radio" id="item1-state-off" name="item1" value="-1" checked> | |
<input type="radio" id="item1-state-null" name="item1" value="0"> | |
<input type="radio" id="item1-state-on" name="item1" value="1"> | |
<i></i> | |
<label for="item1-state-null">Выключено</label> | |
<label for="item1-state-on">Не задано</label> | |
<label for="item1-state-off">Включено</label> | |
</span> |