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 args = { /* ... */ }; | |
| someActionThatRetrievesArchPromise() | |
| .then(function(Arch) { | |
| var arch = Arch.alterArch(); | |
| return arch | |
| .invoke.call(Arch, 'createExamplesNodes', args) | |
| .then(function() { | |
| return arch; | |
| }); |
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
| // PRJ/[...]/b-page.bemhtml | |
| block b-page { | |
| default: { | |
| var ctx = this.ctx, | |
| dtype = apply(this._mode = 'doctype'), | |
| buf = [ | |
| dtype, | |
| { |
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 http = require('http'), | |
| util = require('util'), | |
| port = process.env.PORT || 3014, | |
| counter = 1; | |
| /* global lang:true */ | |
| lang = 'ru'; | |
| function onRequest(req, res) { | |
| counter += 1; // Oops |
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(); |
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
| /*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
| /* 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
| 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
| /** @module cococo */ | |
| /** | |
| * A silly control-flow runner | |
| * @param {GeneratorFunction} gen | |
| * @returns {Function} | |
| */ | |
| function cococo(gen) { | |
| return function(done) { | |
| var g = gen(); |