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
# -*- coding: utf-8 -*-
import re
p = re.compile('.*[^\x20-\x7F]')
print p.match('abc')
print p.match('ä')
print p.match('äbc')
print p.match('bcä')
# -*- coding: utf-8 -*-
import re
p = re.compile('^[\x20-\x7F]*$')
print p.match('abc')
print p.match('ä')
print p.match('äbc')
print p.match('bcä')
function sendMailAsync(opts) {
return new Promise(function (resolve, reject) {
sendMailAsync(opts, function (err, res) {
if (err) {
err.response = res;
reject(err);
} else {
resolve(res);
}
});
'use strict';
var LRU = require('lru-cache');
function getArgs() {
var i = arguments.length, args = new Array(i);
while (i--) { args[i] = arguments[i]; }
return args;
}
#!/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
#
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));
});

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()
[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)
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
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);
};