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/osascript | |
run_command("cd ~/Projects/resque") | |
run_command("redis-server redis.conf") | |
open_tab() | |
run_command("cd ~/Projects/resque") | |
run_command("shotgun config.ru") | |
open_tab() |
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
require 'open-uri' | |
# url dsl -- the ultimate url dsl! | |
# | |
# You just can't beat this: | |
# | |
# $ irb -r url_dsl | |
# >> include URLDSL | |
# => Object | |
# >> http://github.com/defunkt.json |
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
require "rubygems" | |
require "mongo_mapper" | |
MongoMapper.database = 'test_db' | |
class Person | |
include MongoMapper::Document | |
key :first_name, String | |
key :last_name, String |
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
grammar BasicLISP | |
rule expression | |
"(" (expression / method_call) ")" | |
end | |
rule method_call | |
[\w]+ argument* | |
end | |
rule argument |
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 FunctionalTest { | |
def fold(args: Array[Int], lambda: (Int, Int) => Int) : Int = { | |
var result = 0 | |
args.foreach((arg: Int) => result = lambda(result, arg)) | |
result | |
} | |
def fold2(lambda: (Int, Int) => Int) : (Array[Int]) => Int = { | |
def folded(args: Array[Int]) : Int = { | |
var result = 0 |
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
(define lat? | |
(lambda (l) | |
(or (null? l) (and (atom? (car l)) (lat? (cdr l)))))) | |
(define rember | |
(lambda (a lat) | |
(cond | |
((null? lat) lat) | |
((eq? a (car lat)) (cdr lat)) | |
(else (cons (car lat) (rember a (cdr lat))))))) |
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
<html> | |
<script src="jquery-1.4.2.min.js"></script> | |
<script> | |
var bitly = { | |
login: "your_login", | |
api_key: "your_api_key" | |
}; | |
chrome.browserAction.onClicked.addListener(function(tab) { | |
$.get("http://api.bit.ly/v3/shorten?login=" + bitly.login + |
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
-module(fold). | |
-export([fold/2, fold/3]). | |
fold([First | Rest], Fun) -> | |
fold(Rest, Fun, First); | |
fold([], Fun) -> | |
[]. | |
fold([First | Rest], Fun, Result) -> | |
fold(Rest, Fun, Fun(Result, First)); |
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
(define atom? | |
(lambda (a) | |
(not (or (null? a) (pair? a))))) | |
(define rember* | |
(lambda (a l) | |
(cond | |
((null? l) `()) | |
((pair? (car l)) (cons (rember* a (car l)) (rember* a (cdr l)))) | |
((eq? (car l) a) (rember* a (cdr l))) |
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
~/Projects/project[master] > rvm default | |
~/Projects/project[master] > which ruby | |
/Users/dce/.rvm/rubies/ruby-1.8.7-p249/bin/ruby | |
~/Projects/project[master] > sc | |
Loading development environment (Rails 2.3.8) | |
ruby-1.8.7-p249 > BigDecimal("9.05").to_f | |
=> 9.05 | |
ruby-1.8.7-p249 > exit | |
~/Projects/project[master] > rvm system | |
~/Projects/project[master] > which ruby |