View tm_comment_blocks.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
#!/usr/bin/env ruby | |
str = STDIN.read | |
out = '' | |
str.each_line do |line| | |
if line[0] == 35 | |
out << line | |
elsif line[0] != 35 | |
out << "#" + "\t" + line | |
end | |
end |
View tm_comment_blocks.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
#!/usr/bin/env ruby | |
str = STDIN.read | |
start_marker, end_marker = "=begin\n", "\n=end" | |
out = '' | |
str.each_line do |line| | |
if str.split.shift == "=begin" | |
@uncomment = true | |
end | |
View 99bottles.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
require 'pp' | |
@unique_number_words = { | |
1 => "one", 2 => "two", 3 => "three", | |
4 => "four", 5 => "five", 6 => "six", | |
7 => "seven", 8 => "eight", 9 => "nine", | |
10 => "ten", 11 => "eleven", 12 => "twelve", 13 => "thirteen" | |
} | |
@compound_number_words = { |
View insert_grid.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
module Sass::Script::Functions | |
def insert_grid(columns, width_string) | |
assert_type columns, :Number | |
assert_type width_string, :String | |
width = width_string.match(/\A(\d+)(\w+)\z/)[1] | |
type = width_string.match(/\A(\d+)(\w+)\z/)[2] | |
raise StandardError, "You must set width_string with unit ie '960px'. " unless ["px","em", "pt", "%"].include?(type) | |
grid, grid_segment_width = "", 0 |
View ruby-hough.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
begin | |
['oily_png', 'pp'].each do |g| | |
require g | |
end | |
rescue LoadError => e | |
puts "Could not load '#{e}'"; exit | |
end | |
class Hough | |
Convert = "/usr/local/bin/convert" |
View gist:1264514
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
➜ ~ rvm --trace 1.9.2,1.9.3 benchmark test.rb | |
+__rvm_parse_args:727> [[ -n 4.3.11 ]] | |
+__rvm_parse_args:750> [[ -z '' && -n '' ]] | |
+__rvm_parse_args:752> [[ 0 -eq 1 || -n '' ]] | |
+__rvm_parse_args:20> [[ -n 1.9.2,1.9.3 ]] | |
+__rvm_parse_args:22> rvm_token=1.9.2,1.9.3 | |
+__rvm_parse_args:24> (( 2 > 0 )) | |
+__rvm_parse_args:26> next_token=benchmark | |
+__rvm_parse_args:27> shift | |
+__rvm_parse_args:32> case 1.9.2,1.9.3 ([[:alnum:]]*|@*) |
View gist:1264538
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
ruby-1.9.3-rc1: | |
system: | |
uname: "Darwin gitorious.promedicalinc.com 11.0.0 Darwin Kernel Version 11.0.0: Sat Jun 18 12:56:35 PDT 2011; root:xnu-1699.22.73~1/RELEASE_X86_64 x86_64" | |
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)" | |
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)" | |
rvm: | |
version: "rvm 1.8.5 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]" |
View gist:1264541
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
ruby-1.9.2-p290: | |
system: | |
uname: "Darwin gitorious.promedicalinc.com 11.0.0 Darwin Kernel Version 11.0.0: Sat Jun 18 12:56:35 PDT 2011; root:xnu-1699.22.73~1/RELEASE_X86_64 x86_64" | |
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)" | |
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)" | |
rvm: | |
version: "rvm 1.8.5 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]" |
View gist:1271481
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
➜ ~ rvm --trace 1.9.2,1.9.3 benchmark test.rb | |
+__rvm_parse_args:730> [[ -n 4.3.11 ]] | |
+__rvm_parse_args:753> [[ -z '' && -n '' ]] | |
+__rvm_parse_args:755> [[ 0 -eq 1 || -n '' ]] | |
+__rvm_parse_args:20> [[ -n 1.9.2,1.9.3 ]] | |
+__rvm_parse_args:22> rvm_token=1.9.2,1.9.3 | |
+__rvm_parse_args:24> (( 2 > 0 )) | |
+__rvm_parse_args:26> next_token=benchmark | |
+__rvm_parse_args:27> shift | |
+__rvm_parse_args:32> case 1.9.2,1.9.3 ([[:alnum:]]*|@*) |
View pconsole.sh
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
pconsole () { | |
if [[ -n $1 ]]; | |
then RAILS_ENV=$1 pry -r ./config/environment.rb -r rails/console/app -r rails/console/helpers; | |
elif [[ -r ./config/environment.rb ]]; | |
then RAILS_ENV=development pry -r ./config/environment.rb -r rails/console/app -r rails/console/helpers; | |
elif [[ -z $1 ]]; | |
then pry; | |
fi } | |
# Place in ~/.zshrc || ~/.bashrc to open pry with rails environment like this: |
OlderNewer