Skip to content

Instantly share code, notes, and snippets.

View vjeux's full-sized avatar

Christopher Chedeau vjeux

View GitHub Profile
@vjeux
vjeux / gist:797361
Created January 26, 2011 20:20
Basic jQuery
/*!
* jQuery JavaScript Library v1.4.4
* http://jquery.com/
*
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
/*!
* jQuery JavaScript Library v1.4.4
* http://jquery.com/
*
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
@vjeux
vjeux / LICENSE.txt
Created May 22, 2011 19:02 — forked from WebReflection/LICENSE.txt
140byt.es -- Array Shuffle
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:
// Source: http://davidflanagan.com/Talks/jsconf11/BytesAndBlobs.html
// Load File
function loadBlob(path, callback) {
webkitRequestFileSystem( // Ask for filesystem
PERSISTENT, 50*1024*1024,
function(fs) { // When we get filesystem
fs.root.getFile( // Ask for a fs entry
path, {}, // With this name
function(entry) { // When we get entry
// Handle when the DOM is ready
ready: function( wait ) {
// Either a released hold or an DOMready/load event and not yet ready
if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready, 1 );
}
// Remember that the DOM is ready
/* Input */
function f1(i) {
console.log('f1');
if (i) {
console.log(1);
} else if (i > 2)
console.log(2);
else if (true) {
// 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: