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
puts "Holy crap, Batman, this is freakin' wicked!" |
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 ruby | |
# Example Usage: | |
# vcard2asterisk *.vcf | |
# vcard2asterisk http://getvcard.com/dogetvcard.asp?UID=LD7U7mM | |
require 'rubygems' | |
require 'vpim/vcard' | |
def format_phone_number(phone) |
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 ruby | |
# usage: ruby vcard_skidoosh.rb vcard.vcf | |
# outputs a bunch of asterisk commands to stdout. | |
# taste it. | |
# Cargo culters: look elsewhere for best practices and good coding principles | |
# Original regex idea from @coderifous's earlier revisions of http://gist.github.com/32529 | |
ARGV.collect{ |f| open(f).readlines }.flatten.each do |line| | |
if line =~ /^FN:(.*)$/ |
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
;;; Load twittering mode. | |
(require 'twittering-mode) | |
(load "~/.pw/twittering-pw.el" 'noerror) |
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
# Helper controller macros that define: | |
# on_get, on_post, on_put, on_delete | |
module ControllerMacros | |
[:get, :post, :put, :delete].each do |method| | |
class_eval <<-RUBY | |
def on_#{method}(action, options = {}, &block) | |
on_http_method(#{method.inspect}, action, options, &block) | |
end | |
RUBY |
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
module ControllerMacros | |
[:get, :post, :put, :delete].each do |method| | |
class_eval <<-RUBY | |
def on_#{method}(action, options = {}, &block) | |
on_http_method(#{method.inspect}, action, options, &block) | |
end | |
RUBY | |
end | |
def on_http_method(method, action, options = {}, &block) |
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 ruby | |
Package = Struct.new(:name, :path, :main, :globs) | |
packages = | |
[ | |
Package.new("ruby", "~/external/ruby-1.8.7-p72", "README", %w(*.c lib/**/*.rb)), | |
Package.new("rails", "~/external/rails", "railties/README", %w(*/README */lib/**/*)), | |
Package.new("shoulda", "~/external/shoulda", "README.rdoc", %w(lib/**/*.rb)) | |
] |
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
class Test::Unit::TestCase | |
# Ensures that the model has a method named scope_name that returns a NamedScope object with the | |
# proxy options set to the options you supply. scope_name can be either a symbol, or a method | |
# call which will be evaled against the model. The eval'd method call has access to all the same | |
# instance variables that a should statement would. | |
# | |
# Options: Any of the options that the named scope would pass on to find. | |
# | |
# Example: | |
# |
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
# Change the window title of X terminals | |
case $TERM in | |
xterm*|rxvt|Eterm|eterm) | |
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"' | |
;; | |
screen) | |
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"' | |
;; | |
esac |
OlderNewer