Skip to content

Instantly share code, notes, and snippets.

View espadrine's full-sized avatar

Thaddée Tyl espadrine

View GitHub Profile
@espadrine
espadrine / tweet.sh
Created November 2, 2011 18:05
Twitter bash script
#!/bin/bash
# Configure your account.
USER=espadrine
# Ask for the password.
echo -n password\ ; read -s PASS
curl -u $USER:$PASS -d status="$1" http://twitter.com/statuses/update.xml
@espadrine
espadrine / data-markdown.user.js
Created November 8, 2011 21:18 — forked from paulirish/data-markdown.user.js
*[data-markdown] - use markdown, sometimes, in your HTML
// ==UserScript==
// @name Use Markdown, sometimes, in your HTML.
// @author Paul Irish <http://paulirish.com/>, bits by Thaddee Tyl <http://espadrine.github.com/>
// @link http://git.io/data-markdown
// @include *
// ==/UserScript==
// If you're not using this as a userscript just delete from this line up. It's cool, homey.
@espadrine
espadrine / data-markdown.user.js
Created November 9, 2011 06:40 — forked from passcod/data-markdown.user.js
*[data-markdown] - use markdown, sometimes, in your HTML
// ==UserScript==
// @name *[data-markdown]
// @version 2.0
// @description Use Markdown, sometimes, in your HTML.
// @author Paul Irish <http://paulirish.com/> and others
// @include *
// ==/UserScript==
// Contribs:
// Thaddee Tyl <http://espadrine.github.com/>
@espadrine
espadrine / configure.log
Created November 19, 2011 21:07
Configure output while trying to compile the Rust compiler
configure: looking for configure programs
configure: found mkdir
configure: found printf
configure: found cut
configure: found grep
configure: found xargs
configure: found cp
configure: found find
configure: found uname
configure: found date
@espadrine
espadrine / async-ed
Created January 19, 2012 13:51
Array Processing in Event Loops
var async = require('async');
function differedFactorial(n /* Number */, cb /* Function */) {
if (n < 0) cb(new Error('Complex infinity'));
setTimeout(function() {
var result = 1;
for (; n > 1; n--) {
result = result * n;
}
cb(null, result); // No errors, result is given.
@espadrine
espadrine / robert.sh
Created March 18, 2012 20:06
Get the definition of a french word from the command-line shell.
#!/bin/bash
# INSTALL: Put this in a shell script (eg, `~/bin/robert`).
# USE: `$ robert anticonstitutionnellement`.
wordId=$(curl "http://petitrobert.bvdep.com/list.asp?word=$1" \
-b "PR1Login=OK" 2>/dev/null \
| sed -En "/onload/{s/.*'([A-Z0-9]+)'.*/\1/
p
}")
@espadrine
espadrine / client.js
Created June 26, 2012 18:25
Isaac's Module Idea
let {sum, pi} = import './math.js';
alert('2n = ' + sum(pi, pi));
@espadrine
espadrine / reflect-vs-esprima.js
Created August 5, 2012 07:50
Reflect.parse vs. Esprima
// In order to get Reflect.parse, we need to run this in a chrome environment.
Components.utils.import("resource://gre/modules/reflect.jsm");
function Esprima(exports) {
'use strict';
var Token,
TokenName,
Syntax,
@espadrine
espadrine / assert.js
Created November 19, 2012 14:57
The only assert implementation that makes sense
function assert(condition) {
if (!condition) { debugger; }
}
@espadrine
espadrine / parse-tokenize.js
Last active December 11, 2015 19:19
Speed testing: Esprima parse vs. Reflect parse vs. Esprima tokenize. Put this in Firefox' scratchpad.
var jquery = "/*!\n * jQuery JavaScript Library v1.9.0\n * http://jquery.com/\n *\n * Includes Sizzle.js\n * http://sizzlejs.com/\n *\n * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors\n * Released under the MIT license\n * http://jquery.org/license\n *\n * Date: 2013-1-14\n */\n(function( window, undefined ) {\n\"use strict\";\nvar\n\t// A central reference to the root jQuery(document)\n\trootjQuery,\n\n\t// The deferred used on DOM ready\n\treadyList,\n\n\t// Use the correct document accordingly with window argument (sandbox)\n\tdocument = window.document,\n\tlocation = window.location,\n\n\t// Map over jQuery in case of overwrite\n\t_jQuery = window.jQuery,\n\n\t// Map over the $ in case of overwrite\n\t_$ = window.$,\n\n\t// [[Class]] -> type pairs\n\tclass2type = {},\n\n\t// List of deleted data cache ids, so we can reuse them\n\tcore_deletedIds = [],\n\n\tcore_version = \"1.9.0\",\n\n\t// Save a reference to some core methods\n\tcore_concat = core_deletedIds.concat,\n\tcore_push = c