Skip to content

Instantly share code, notes, and snippets.

View myndzi's full-sized avatar

Kris Reeves myndzi

  • Sigma Bold
  • Olympia, WA
View GitHub Profile
async.auto({
get_data: function(callback){
callback(null, 'data', 'converted to array');
},
make_folder: function(callback){
callback(null, 'folder');
},
write_file: ['get_data', 'make_folder', function(callback, results){
callback(null, 'filename');
}],
# /etc/rsyslog.conf Configuration file for rsyslog.
#
# For more information see
# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html
#
# Default logging rules can be found in /etc/rsyslog.d/50-default.conf
#################
#### MODULES ####
var items = [huge array];
var concurrency = 5, i = items[0], x = items.length;
return Promise.map(new Array(concurrency), function next(val) {
if (i === items.length) { return; }
return getData(items[i++]).then(next);
});
var toServer = csp.chan();
var throttled = throttle(toServer);
csp.go(function* () {
var msg;
while (true) {
msg = yield csp.take(toServer);
if (msg === csp.CLOSED) { return; }
console.log(msg);
var _console_error = console.error;
console.error = function () {
var err = new Error();
var here = '>>' + err.stack.split('\n')[2];
_console_error.apply(console, [here]);
_console_error.apply(console, arguments);
};
rooms-stairs
STANDARDSCROLL_UP
CURSOR_UP
A_MOVE_N
End of group
STANDARDSCROLL_LEFT
CURSOR_LEFT
WORLD_PARAM_DECREASE
A_MOVE_W
End of group
[kris.re@krisre data.task]$ make benchmark
cd test/benchmarks && npm install
node test/benchmarks/runner
Benchmarks for: Serial (light tasks)...
o Callbacks (baseline) x 830 ops/sec ±0.80% (126 runs sampled)
o Callbacks (Async) x 809 ops/sec ±0.70% (124 runs sampled)
o Tasks (Data.Future) x 821 ops/sec ±0.79% (124 runs sampled)
o Promises/A+ (Bluebird) x 767 ops/sec ±0.97% (120 runs sampled)

any.describe()

Returns a plain object representing the schema's rules and properties. May contain the following keys:

  • type - the base type of the schema object
  • flags - properties that affect the behavior of a validation, e.g. insensitive
  • description - data set by .description()
    • multiple calls to .description() will overwrite previous data
  • notes - array of data set by .notes()
  • tags - array of data set by .tags()
  • meta - array of data set by .meta()
var chunksize = 50;
return (function next(items) {
if (!items.length) { return; }
return knex('table')
.insert(items.slice(0, chunksize))
.then(function () {
return next(items.slice(chunksize));
});
#!/usr/bin/env bash
#
# Copyright (C) 2010-2015 Axel Fontaine
#
# 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
#