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
# Parsing and processing script arguments | |
while [ $# -gt 0 ]; do | |
case $1 in | |
-p) | |
shift | |
PORT=$1 | |
;; | |
--pbuilder-basetgz=*) | |
BASETGZ="$(echo $1 | cut -d = -f 2)" | |
;; |
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
if(global.Intl) { | |
global.Intl = require('intl'); | |
} | |
var IntlMessageFormat = require('intl-messageformat'); | |
var formats = { | |
number : { | |
rur : { | |
style : 'currency', |
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 Ctor(param1, param2, param3) { | |
this._param1 = param1; | |
this._param2 = param2; | |
this._param3 = param3; | |
} | |
Ctor.create = function(p1, p2, p3) { | |
return new this(p1, p2, p3); | |
} |
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 cococo */ | |
/** | |
* A silly control-flow runner | |
* @param {GeneratorFunction} gen | |
* @returns {Function} | |
*/ | |
function cococo(gen) { | |
return function(done) { | |
var g = gen(); |
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 fs = require('fs'), | |
path = require('path'); | |
/** | |
* Async version of `scan` | |
* | |
* @example | |
* var scan = require('./scan-async'); | |
* scan('<dir>', function(err, files) { | |
* // do something with `files` object |
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
/* jshint esnext:true */ | |
/** | |
* "Producer-Consumer" implementation using generators. | |
* @see http://en.wikipedia.org/wiki/Deterministic_concurrency#Comparison_with_generators | |
*/ | |
var SIZE = 3, | |
queue = newQueue(); |
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
/*borschik:include:i-bem.js*/; | |
modules.require(['i-bem'], function(BEM) { | |
BEM.decl('block1', { | |
method1 : function() { | |
console.log('m1'); | |
} | |
}); |
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
block('global').def(function() { | |
var data = this.param('req'), | |
host = this.param('apiHost'), | |
params = {}; | |
return async(function() { | |
try { | |
var result = await(this.httpInvoke({ host : host, path : '/some/api' }); | |
var status = result.status; |
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 bemxjst = require('bem-xjst'), | |
FN_RE = /^function(?:\s+\w+)?\s*\([^\)]*\)\s*\{|\}$/g; | |
function noop() { | |
return '[sorry]'; | |
} | |
function parse(fn) { | |
var body = fn.toString().replace(FN_RE, '').trim(); |