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 urls = ['http://www.google.com', 'http://www.twitter.com']; | |
function get_request(url) { | |
return new Promise(function (resolve, reject) { | |
... | |
}); | |
} |
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
Error: write EPROTO | |
at Object.exports._errnoException (util.js:874:11) | |
at exports._exceptionWithHostPort (util.js:897:20) | |
at WriteWrap.afterWrite (net.js:763:14) |
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
Error: write EPROTO | |
at Object.exports._errnoException (util.js:874:11) | |
at exports._exceptionWithHostPort (util.js:897:20) | |
at WriteWrap.afterWrite (net.js:763:14) |
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 Schema = function (input) { | |
var output = {}; | |
Object.keys(input).forEach(function (key) { | |
if (input[key] === Number) { | |
output[key] = 'REAL'; | |
} | |
else if (input[key] === String || input[key] === 'TEXT') { | |
output[key] = 'TEXT'; |
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
[ | |
{ | |
"code": "AF", | |
"name": "Afghanistan", | |
"provinces": [ | |
{ | |
"code": "BDS", | |
"name": "Badakhshān" | |
}, | |
{ |
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
PROJECT = hello_erlang | |
DEP_PLUGINS = cowboy hexpm.mk | |
BUILD_DEPS = hexpm.mk | |
dep_hexpm.mk = git https://github.com/botsunit/mix.mk.git master | |
dep_cowboy_commit = 2.1.0 | |
dep_pgapp = hex 0.0.2 | |
dep_poison = hex 3.1.0 | |
dep_epgsql = hex 3.4.0 |
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
// mandeljit.c | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <sys/mman.h> | |
#include <stdarg.h> | |
typedef struct { | |
char *dest; | |
} microasm; | |
// this makes it more obvious what we're doing later on |
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
const bindEvent = (eventNames, selector, handler) => { | |
eventNames.split(' ').forEach((eventName) => { | |
document.addEventListener(eventName, function (event) { | |
if (event.target.matches(selector + ', ' + selector + ' *')) { | |
handler.apply(event.target.closest(selector), arguments) | |
} | |
}, false) | |
}) | |
} |
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
const FIRST_FRAME_PCI_BYTE = 0x01 | |
const CONSECUTIVE_FRAME_PCI_BYTE = 0x02 | |
const FIRST_FRAME_DATA_LENGTH = 5 | |
const CONSECUTIVE_FRAME_DATA_LENGTH = 7 | |
const PADDING_BYTE = 0xAA | |
const buildFirstFrame = (responseSid, data) => { | |
const responseLength = data.length + 1 // add a byte for response SID | |
const firstFrameData = data.slice(0, FIRST_FRAME_DATA_LENGTH) | |
const firstFrameHeader = Buffer.from([ |
OlderNewer