Skip to content

Instantly share code, notes, and snippets.

@soarez
soarez / 4b238b4c2ae8f5cf409cea5ca214b480b00e1a86_test_results.txt
Created October 21, 2012 11:03
Test results for joyent/node 4b238b4
make -C out BUILDTYPE=Release V=1
LD_LIBRARY_PATH=/Users/Soarez/src/joyent/node/out/Release/lib.host:/Users/Soarez/src/joyent/node/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../.; mkdir -p /Users/Soarez/src/joyent/node/out/Release/obj/gen; python tools/js2c.py "/Users/Soarez/src/joyent/node/out/Release/obj/gen/node_natives.h" src/node.js lib/_debugger.js lib/_linklist.js lib/assert.js lib/buffer.js lib/buffer_ieee754.js lib/child_process.js lib/console.js lib/constants.js lib/crypto.js lib/cluster.js lib/dgram.js lib/dns.js lib/domain.js lib/events.js lib/freelist.js lib/fs.js lib/http.js lib/https.js lib/module.js lib/net.js lib/os.js lib/path.js lib/punycode.js lib/querystring.js lib/readline.js lib/repl.js lib/stream.js lib/string_decoder.js lib/sys.js lib/timers.js lib/tls.js lib/tty.js lib/url.js lib/util.js lib/vm.js lib/zlib.js ./config.gypi src/macros.py
c++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D_DARWIN_USE_64_BIT_INODE=1' '-DNODE_WANT_INTERNALS=1' '-DARCH="x64
@soarez
soarez / gist:3852067
Created October 8, 2012 11:39
Jumbler
function randomizeLetters(string) {
var letters = string.split('');
var result = '';
while(letters.length)
result += letters.splice(Math.floor(Math.random() * letters.length), 1)[0];
return result;
}
function jumbleWord(word) {
@soarez
soarez / gist:3673845
Created September 8, 2012 11:28
Old rulio smooth speak module
var util = require('util');
var _ = require('lodash');
var liveconf = require('liveconf');
var conf = liveconf('smootSpeak.json');
module.exports = exports = function(client) {
var queues = [
{ regex: /\bsanchez\b/i, text: 'btw I hear that mr Sanchez is an awesome fella' },
@soarez
soarez / gist:3513190
Created August 29, 2012 14:14
.NET async method
public async Task<string> UsersLoginAsync(string login, string password)
{
var url = "login.xml";
var template = @"
<?xml version=""1.0"" encoding=""UTF-8""?>
<credentials>
<login>{0}</login>
<password>{1}</password>
</credentials>
@soarez
soarez / gist:3481961
Created August 26, 2012 17:46
EC2 Amazon Linux AMI port prerouting with NAT iptables
# List rules
sudo iptables -t nat -L
# Add rule to forward 80 to 3080
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3080
# Will delete all rules from nat table
sudo iptables -F -t nat
@soarez
soarez / gist:3374570
Created August 16, 2012 23:44
word_diff
int partial_match(char *word_a, char *word_b, int len) {
int res, idx;
res = 0;
for(idx = 0; idx < len; ++idx)
if (word_a[idx] == word_b[idx])
++res;
return res;
}
@soarez
soarez / gist:2818228
Created May 28, 2012 09:49
Private state
var @priv = {};
function Animal() {
priv[this] = {};
priv[this].walked = false;
}
Animal.prototype.walk = function walk() {
console.log('walking...')
priv[this].walked = true