Skip to content

Instantly share code, notes, and snippets.

View vjeux's full-sized avatar

Christopher Chedeau vjeux

View GitHub Profile
// Change
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
responses = {};
xml = xhr.responseXML;
// Construct response list
if ( xml && xml.documentElement /* #4958 */ ) {
responses.xml = xml;
while outer_condition()
while inner_condition()
[a, b] = pick2()
delta = swap a, b
if delta < 0 or Math.random() < Math.exp(-(delta + 1) / T)
cost += delta
else
swap a, b # revert
T *= C
@vjeux
vjeux / gist:1422736
Created December 2, 2011 10:32
Wikipedia Favicon
{ header: { reserved: 0, type: 0, imageCount: 1, padding: [ 0, 1, 0 ] },
images:
[ { width: 16,
height: 16,
paletteCount: 16,
reserved: 0,
colorPlanes: 1,
bitsPerPixel: 4,
size: 296,
offset: 22,
@vjeux
vjeux / LICENSE.txt
Created December 12, 2011 12:36 — forked from madrobby/LICENSE.txt
Functional array sorting
Copyright (c) 2011 Christopher Chedeau, http://blog.vjeux.com/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
(self.scene.global.H / 2 - y + Math.random() - 0.5) / upscale)
callback()
) # f
], callback # waterfall
), callback # while
) # f
), callback # paralell
) # f
], callback # waterfall
), callback # while
) # f
@vjeux
vjeux / gist:1616150
Created January 15, 2012 15:22
TameJS Output
// Input
var message = "I'm starting to get turned on.";
await {
for (var i = 0; i < 10; i++) {
setTimeout (defer (), 10);
setTimeout (defer (), 100);
}
}
console.log (message);
function f(a) {
var b = yield 'A';
var c = yield 'B';
}
gen = f('a');
var A = gen.next();
var B = gen.send('b');
gen.send('c');
Scrap = require '../src/scrap.js'
match = require 'match'
# Create a new Scrap with the base for all the following requests
wikipedia = new Scrap
path: 'http://en.wikipedia.org/'
# Download the front page as string
wikipedia.get '/', (page) ->
Scrap = require '../src/scrap.js'
match = require 'match'
# Create a new Scrap with the base for all the following requests
wikipedia = new Scrap
path: 'http://en.wikipedia.org/'
# Download the front page as string
wikipedia.get '/', (page) ->