Based on https://gist.github.com/jchunky/3444833
class QuizAnswer < ActiveRecord::Base
...
def user_answer_collection
return [] if !user_answer
user_answer.split(",")
end
# Create a file in config/initializers/version.rb, with the following string in it | |
# APP_VERSION = "0.0.0" | |
# | |
# Add this file to lib/tasks | |
# | |
# Add the following to ~/.bash_profile | |
# function release() { | |
# version=`bundle exec rake version:next` | |
# git flow release start $version && bundle exec rake version:bump && git commit -a -m "version bump" && git flow release finish $version && git push origin master | |
# } |
Based on https://gist.github.com/jchunky/3444833
class QuizAnswer < ActiveRecord::Base
...
def user_answer_collection
return [] if !user_answer
user_answer.split(",")
end
#!/usr/bin/env ruby | |
# provides a basic timer, and predicts how long something will take you based on how long each individual step is taking you. | |
# Parameters: | |
# timer [num_steps=100] [at_steps] | |
def main | |
total_steps = 100; |
def pretty_phone_number(str_num) | |
# I know how to handle 9 digit numbers | |
# I know how to handle 10 digit numbers | |
# for above that I only know how to divide into 3s | |
result = "" | |
case | |
when str_num.length==10 | |
result << '('+str_num[0..2]+') '+str_num[3..5]+'-'+str_num[6..9] | |
when str_num.length == 11 && str_num =~ /^1/ |
#!/usr/bin/ruby | |
# from http://www.3till7.net/2010/02/23/convenient-file-searching-with-ruby-grep-and-file/ | |
unless ARGV.length >= 2 | |
puts "Usage: #$0 file_extension query" | |
puts "\tExample: #$0 '*.h' 'struct list_head'" | |
exit | |
end | |
unless ARGV.length == 2 |