This file contains 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
iVBORw0KGgoAAAANSUhEUgAAAJYAAACNCAIAAADachTtAAAACXBIWXMAAD2EAAA9hAHVrK90AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4 |
This file contains 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
app.post('/images' | |
, function(req, res, next) { | |
var form = formidable.IncomingForm(); | |
form.parse(req, function(err, fields, files) { | |
console.log('__err__', err); // err === [Error: Request aborted] | |
console.log('__fields__', fields); // fields === {} | |
console.log('__files__', files); // files === {} | |
next(); | |
}); | |
} |
This file contains 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
/* | |
* In OS X 10.9 the resulting command to start render.js with phantomjs | |
* (aka `stdin` on line 5 of client.js) exceeds the maximum command length, | |
* 262144 on my system. | |
*/ | |
var NodePDF = require('nodepdf'); | |
var pdf = new NodePDF(null, 'foo.pdf', { | |
'content': contentString, |
This file contains 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 decrypt(cipherText, key) { | |
var keyInt = key.codePointAt(0), | |
plainText = ''; | |
for (var char = 0; char < cipherText.length; char += 2) | |
plainText += String.fromCharCode(parseInt(cipherText.substr(char, 2), 16) ^ keyInt); | |
return plainText; | |
} |
This file contains 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 linkGiftCards(giftCards, customerId, callback) { | |
function linkCard(card, id, callback2) { | |
// do some stuff | |
callback2(); | |
} | |
async.each(giftCards, function (card, callback2) { | |
linkCard(card, customerId, callback2); | |
}, function (err) { |
This file contains 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
test |
This file contains 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
require 'test_helper' | |
class IndependentMatcheesControllerTest < ActionController::TestCase | |
# Without this method I get... | |
# RuntimeError: @controller is nil: make sure you set it in your test's setup method. | |
# test/controllers/independent_matchees_controller_test.rb:15:in `block in <class:IndependentMatcheesControllerTest>' | |
# With it I get... | |
# NameError: uninitialized constant IndependentMatcheesControllerTest::IndependentMatcheesController | |
# test/controllers/independent_matchees_controller_test.rb:11:in `setup' | |
def setup |
This file contains 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 test_data = [ | |
{ id: 'a', order_by: 1 }, | |
{ id: 'b', order_by: 2 }, | |
{ id: 'c', order_by: 3 }, | |
{ id: 'd', order_by: 4 }, | |
{ id: 'e', order_by: 5 }, | |
{ id: 'f', order_by: 6 }, | |
{ id: 'g', order_by: 7 }, | |
{ id: 'h', order_by: 8 }, | |
{ id: 'i', order_by: 9 } |
This file contains 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
'use strict' | |
const a = [{ id: 1 }, { id: 2 }, { id: 1 }, { id: 3 }]; // guaranteed to have a length less than 25 | |
function unique1(a) { | |
const r = []; | |
o: for (let o of a) { | |
for (let i of r) | |
if (o.id === i.id) |
This file contains 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
'use strict' | |
const blocks = { | |
symbols: '[\u2000-\u2bff]', | |
cjk: '[\u2e80-\u9fff]', | |
surrogates: '[\ud800-\udbff]', | |
selectors: '[\ufe00-\ufe0f]' | |
}; | |
const valid = new RegExp(`^${Object.keys(blocks).map(key => blocks[key]).join('|')}$`); |
OlderNewer