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 git_prompt { | |
local STATUS=`git status 2>&1` | |
if [[ "$STATUS" != *'Not a git repository'* ]] | |
then | |
if [[ "$STATUS" == *'working directory clean'* ]] | |
then | |
echo -e "\033[0;32m$(__git_ps1)\033[m" | |
else | |
echo -e "\033[0;31m$(__git_ps1)\033[m" |
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
/* | |
--- | |
name: Slick.Finder | |
description: The new, superfast css selector engine. | |
provides: Slick.Finder | |
requires: Slick.Parser | |
... | |
*/ | |
(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
function filePermissionsToNumber(perms){ | |
var result = 0; | |
var parts = perms.split(''); | |
if (parts[0] == 'r') result += 400; | |
if (parts[1] == 'w') result += 200; | |
if (parts[2] == 'x') result += 100; | |
if (parts[3] == 'r') result += 40; |
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 Rand15 = function(){ | |
return Math.floor(Math.random() * 16); | |
}; | |
var share = function(arr){ | |
var sum = 0; | |
for (var i = arr.length; i--;) sum += arr[i]; | |
return arr.map(function(value){ return value / sum; }); | |
}; |
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 Getable = new Class({ | |
get: function(key){ | |
if (Array.isArray(key)){ | |
var result = {}; | |
for (var i = 0; i < key.length; i++){ | |
result[key[i]] = this.get(key[i]); | |
} | |
return result; | |
} |
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/bash | |
slides=1; | |
video=1; | |
for var in "$@" | |
do | |
if [ "${var}" = "--slidesOnly" ]; then | |
video=0; |
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
// Observerable Mixin | |
var ObserverableSubject = new Class({ | |
on: function(type){ | |
var observerables = (this._observerables || (this._observerables = {})); | |
var observerable = observerables[type]; | |
if (!observerable){ | |
var _Observerable = this.constructor.lookupObserverable(type); | |
if (!_Obseverable) throw new Error('this type of observerable is not defined for this object'); |
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
#!/usr/bin/env node | |
var exec = require('child_process').exec; | |
var sys = require('sys'); | |
var help = [ | |
'timer.js [OPTIONS]', | |
'', | |
'OPTIONS:', | |
' --time Set expiration time (HH:II)', |
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
// returns the ClickEmitter object (and creates a new ClickEmitter) | |
// should return an error when the event type does not have a matched | |
// emitter class (defined by defineEmitter) | |
var emitter = myElement.on('click'); | |
// Emitter methods: create, add, remove | |
// returns a Listener object | |
var listener = emitter.create(function(event){ | |
event instanceof ClickEvent // true |
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
// totally untested and not working code | |
var Emitter = new Class({ | |
initialize: function(object){ | |
this.object = object; | |
}, | |
destruct: function(){}, | |
addListener: function(fn){ | |
this.listeners.push(fn); |