This file contains hidden or 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 macruby | |
framework 'AppKit' | |
# Inspired by: http://cocoawithlove.com/2010/09/minimalist-cocoa-programming.html | |
# Inits NSApp | |
NSApplication.sharedApplication | |
# Allows an app without an applicaiton bundle or info.plist to still be an app |
This file contains hidden or 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 macruby | |
framework 'AppKit' | |
module AppDelegate | |
extend self | |
def applicationDidFinishLaunching(notification) | |
voice_type = "com.apple.speech.synthesis.voice.GoodNews" | |
@voice = NSSpeechSynthesizer.alloc.initWithVoice(voice_type) |
This file contains hidden or 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
# A config.ru useful for serving static sites from the "Bamboo" heroku stack. | |
# | |
# Interface: | |
# | |
# Url Path | Action | |
# -------- | ------------------------------------------------------------- | |
# / | contents of: index.html OR | |
# | contents of: 404.html OR | |
# | default 404 message | |
# | |
This file contains hidden or 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
# Parse a json encoded hashmap or return an empty one and print a warning | |
parseMsg = (jsonStr) -> | |
try json = JSON.parse jsonStr | |
catch err then handleParseErr err, jsonStr | |
json ? {} | |
handleParseErr = (err, jsonStr) -> | |
console.error '[WARN]','JSON parser:', err, 'input json was:', jsonStr |
This file contains hidden or 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 | |
if [ ! -r "/usr/local/git" ] || [ ! -f /usr/bin/git ]; then | |
echo "Git doesn't appear to be installed via this installer. Aborting" | |
exit 1 | |
fi | |
echo "This will uninstall git by removing /usr/local/git/**/*, /etc/paths.d/git, /etc/manpaths.d/git" | |
printf "Type 'yes' if you sure you wish to continue: " | |
read response | |
if [ "$response" == "yes" ]; then | |
sudo rm -rf /usr/local/git/ |
This file contains hidden or 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
echo hello |
This file contains hidden or 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
// OBJECT PROGRAMMING | |
avi = { | |
walk: function() { console.log(this.name + ' is walking') }, | |
name: 'Avi' | |
} | |
avi.walk() | |
avi.lastName = 'Kaufman' |
This file contains hidden or 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
echo hello from gist |
This file contains hidden or 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 | |
# Given some html (on stdin), wraps it in html that applies the same aesthetic | |
# that github uses for rendering markdown-processed content | |
# Usage: | |
# markdown < in.md | ghstyles > out.html | |
# If you have node.js installed I recommend the [marked] processor. It's fast, | |
# supports "github flavored" markdown by default and has no dependencies |
This file contains hidden or 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 nestedListMatch = function(lists, match) { | |
var firstItem = lists[0]; | |
if(firstItem === match) { | |
return match; | |
}else if (Array.isArray(firstItem)){ | |
var result = nestedListMatch(firstItem, match) | |
if(result === match) { |