Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View isaacs's full-sized avatar
🔮
only way out is through

isaacs isaacs

🔮
only way out is through
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<script>
// 238!
function L(U,C){var d=document,f='firstChild',r='readyState',h=d.documentElement[f],s=d.createElement('script'),m=s[r]?'onreadystatechange':0;s.src=U;s[m||'onload']=function(){if(!m||/ded|te/.test(s[r]))s[m]=0,C()}h.insertBefore(s,h[f])}
// async loading of javascript files, starting asap.
L("http://example.com/example.js",function () {
doSomething();
exports.app = function (env) {
return {
status : 200,
headers : {"Content-Type":"text/plain"},
body : ["hello, world"]
};
};
@isaacs
isaacs / file.js
Created September 8, 2009 05:55 — forked from anonymous/file.js
// more lines, ever-so-slightly faster search, though.
function checkValidMove (xo, pos, state) {
// invalid move.
if (state[pos[0]][pos[1]] !== '') return false;
state[pos[0]][pos[1]] = xo;
// check row
for (var i = 0, col = 0; i < 3; i ++) if (state[pos[0]][i] === xo) col ++;
if (col === 3) return "a winner is you";
isaacs@sistertrain-lm:~
[16:46:52 6410] $ curl http://github.com/isaacs/npm/raw/master/bin/npm-install | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
168 168 168 168 0 0 794 0 --:--:-- --:--:-- --:--:-- 1435
/Users/isaacs/.npm-install
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6259 100 6259 0 0 8974 0 --:--:-- --:--:-- --:--:-- 8974
/Users/isaacs/.npm-install/isaacs-npm-0e7b3a9
@isaacs
isaacs / npm.txt
Created October 13, 2009 07:48 — forked from richtaur/npm.txt
# Node Package Manager
npm [npm-options] command [command options]
install <package>
[-b (stable, edge, nightly) | --branch]
[-f | --force]
[-v | --version]
remove <package>
[-f | --force]
// npm --help
//
// npm - The Node Package Manager
// usage: npm [npm-options] <command>
//
// [npm-options] Options to be passed to the npm progam itself.
//
// -d --dry-run Don't do anything real
//
// -h --help Show this message
/**
* @author apipkin and isaacs
*/
EchoFin = EchoFin || {};
EchoFin.itemsLoading = 0;
EchoFin.GlobalLoaded = false;
YUI().use('node', 'anim', function (Y) {
this.names = {
user: "x"
,host: "x"
,server: "x"
,real: "x"
};
// fuck IE
this.names = {
user: "x",
@isaacs
isaacs / _.js
Created November 12, 2009 07:48
(function () {
// transform the function such that you can fix any of the arguments,
// passing _ as a "placeholder".
// for example:
// function timesSquared (x, y) { return x * y * y }
// var times2Squared = _(timesSquared)( _, 2 ) or timesSquared._(_, 2);
// times2Squared(3) = timesSquared(3, 2) = 12
// In the _ified function, if all the spaces are not filled in, it returns
// another _ified function with the remaining spaces blank.
#!/usr/bin/env ruby
# urlmonitor - print out the URLs requested system wide on the main network interface
# Accept a network interface name as an optional argument
iface = ARGV.first
# No interface specified? Try to guess which one is king..
unless iface
`ifconfig -l`.split.each do |iface|
next if iface =~ /^lo/