Skip to content

Instantly share code, notes, and snippets.

View chapel's full-sized avatar

Jacob Chapel chapel

View GitHub Profile
/ Fatalities
var fatalities = {
triggers: {
konamiCode: function(scriptPath, scriptFn) {
console.log("Added function");
var konamiKeys = [], konamiCombo = "38,38,40,40,37,39,37,39,66,65";
$(document).keydown(function(e) {
konamiKeys.push(e.keyCode);
if(konamiKeys.toString().indexOf(konamiCombo) >= 0) {
$(document).unbind('keydown', arguments.callee);
/*===========================================================================
SETTINGS
============================================================================= */
var port = 3000,
cacheAge = 60000 * 60 * 24 * 365,
logs = {
set: false,
string: '\\n ' + ':date'.bold.underline + '\\n\\n' + ' IP: '.cyan.bold
+ ' ' + ':remote-addr'.white + '\\n' + ' Method: '.red.bold
[20:18] mraleph: ryah: I have an interesting observation for you about that infamous and sad comparison with erlang. If I throttle accept (i.e. accept return after 50 accepted connections from https://github.com/joyent/node/blob/master/lib/net.js#L907 then response rate seems to improve by 20-30% and number of errors drops.
[20:18] baudehlo: haven't they always?
[20:18] baudehlo: a|i: https://github.com/squaremo/rabbit.js
[20:19] ryah: mraleph: interesting
[20:19] mjr_: mraleph: I figured it was something like that
[20:19] ryah: do you think we're blocked on accepting?
[20:19] kersny has joined the channel
[20:19] ryah: that's an easy fix
[20:19] a|i: baudehlo: any ideas which approach is more efficient?
[20:19] AsDfGh1231 has joined the channel
exports.exec = (options, callback) ->
# Load image
fs.readFile './image.jpg', (err, img) ->
if err
return callback(err, null);
# POST image to imgur
request {
method: 'POST',
body: "image=" + img.toString() + "&key=42e1c4982b52fabcae9033ff428d5175",
uri: 'http://imgur.com/api/upload.json',
var http = require('http');
var querystring = require('querystring');
var data = {
message: 'Hello'
};
var form_data = querystring.stringify(data);
var options = {
https://gist.github.com/830022
spit_error = (err) ->
console.error "#{err}\nFor more help see: ngist -h"
process.exit 1
opt.user = opt.user or opt.u
opt.token = opt.token or opt.t
opt.out = opt.out or opt.o
var req = http.request({
host: '127.0.0.1',
port: '5984',
path: '/ms/',
method: 'POST',
headers: {
'Content-Type': 'application/json' // Need to add headers object
}}, function(res){
var sigma = '';
res.on('data',function(chunk){sigma+=chunk})
function(){};