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
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
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
var m = {exports: {}}; | |
(function (module, exports, require) { | |
console.log(module, exports, require('./foo.js')); | |
})(m, m.exports, function (name) { return Function(String(fs.readFileSync(name)))(); }); |
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'; | |
// kronecker delta | |
let kd = (i, j) => i == j ? 1 : 0; | |
// (In)ij identity matrix constructor | |
let I = n => { | |
let a = [], k = 0; | |
for (let i = 0; i < n; ++i) | |
for (let j = 0; j < n; ++j) | |
a[k++] = kd(i, j); |
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
/* | |
* The Daily Voice | |
* Copyright 2012 Daily Voice (www.DailyVoice.com) | |
* | |
* 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 | |
* |
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
/** | |
* With some magic getters/setters you can achieve similar syntax like Ruby | |
**/ | |
function foo() { console.log('im foo') } | |
foo.__defineGetter__('new', function(){ return new foo }) | |
f = foo.new | |
// >> im foo | |
void console.log((new foo) instanceof foo) | |
// >> im foo |
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 Module(scope, global){ | |
this.scope = scope; | |
this.exports = {}; | |
this.global = global || window || this; | |
} | |
function ModuleError(message) { | |
Error.call(this); | |
Error.captureStackTrace(this, ModuleError); | |
this.name = 'ModuleError'; |
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 http, server, emit | |
http = require('http') | |
server = http.createServer(function () { console.log('ok') }) | |
emit = emit = server.emit | |
server.emit = function () { | |
// log it out | |
console.log('[server]:', arguments[0]) | |
// apply old emit | |
emit.apply(this, arguments); | |
}; |
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 mongoose = require('mongoose'), | |
Config = mongoose.model('Config') | |
exports.create = function(req, res) { | |
var conf = new Config(req.body); | |
console.log(conf) | |
conf.save(function(err) { |