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 queue = []; | |
function enqueue (work) { | |
queue.push(work); | |
} | |
function dequeue () { | |
for (var i = 0; i < queue.length; ++i) void function (work, i) { | |
work( | |
function (isDone) { |
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
werle:~/tmp | |
× cc setenvbug.c -o setenvbug | |
werle:~/tmp | |
√ valgrind --leak-check=yes --track-origins=yes --dsymutil=yes setenvbug | |
==37306== Memcheck, a memory error detector | |
==37306== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. | |
==37306== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info | |
==37306== Command: setenvbug | |
==37306== |
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
werle:~/repos/libuv-http ☀ master | |
√ make | |
git clone --depth 1 https://chromium.googlesource.com/external/gyp.git ./deps/gyp | |
Cloning into './deps/gyp'... | |
remote: Counting objects: 1631, done | |
remote: Finding sources: 100% (1631/1631) | |
remote: Total 1631 (delta 332), reused 980 (delta 332) | |
Receiving objects: 100% (1631/1631), 813.68 KiB | 0 bytes/s, done. | |
Resolving deltas: 100% (332/332), done. | |
Checking connectivity... done. |
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
files.items | |
.filter(function (file) { | |
// search parents array looking for atleast once | |
// parent that has the id you are looking for | |
return file.parents.some(function (parent) { | |
return PARENT_ID_YOU_CARE_ABOUT == parent.id | |
}); | |
}) | |
.forEach(function (file) { | |
// do stuff with each file after filtering here... |
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
curl -s https://ws.spotify.com/search/1/track.json?q=portugal+the+man | bpkg json -b | grep tracks | grep href | grep spotify:track | awk '{print $2}' | tr -d '"' | tr -d 'spotify:track:' |
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
#!/bin/bash | |
HOST="$1" | |
PORT="$2" | |
umq recv ${PORT} & | |
while read -r buf; do | |
nmap "${HOST}" -p "${PORT}" --open 2>/dev/null | \ | |
awk '/scan report for/ {$1=$2=$3=$4=""; print $0}' | \ | |
tr -d ' ' | { | |
while read -r host; do |
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
import foo from A; // - this just declares the identifier `foo' | |
console.log(foo); // undefined - (but doesn't throw ?) | |
console.log(A.foo); // [Function: foo] - (maybe this is available due to the `import' statement) | |
console.log(B.bar); // [Function: bar] - (I guess not, there is no need for an `import' statement for the `B' module?) | |
/** | |
* The following will throw: | |
* |
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
#define X(n) \ | |
if (isset($opts[ # n ])) { \ | |
self::$ n = $opts[ # 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
function s (fn, args) { | |
var code = null; | |
var f = null; | |
args = args.map(function (a) { | |
return 'function' == typeof a ? a.toString() : a; | |
}); | |
args = JSON.stringify(args); | |
code = '(' + fn.toString() +').apply(null,'+ args + ')'; | |
f = new Function(code); |
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 b (fn) { | |
var str = fn.toString(); | |
var buf = ""; | |
var ch = 0; | |
var len = str.length; | |
var i = 0; | |
var inBody = false; | |
while (len--) { | |
ch = str[i++]; |