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/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 |
| 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/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; |
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 | |
| # } |
After upgrading to Ruby 2.1, the rails app and apache we got the following error in our apache log:
/usr/bin/ruby: warning: RUBY_HEAP_MIN_SLOTS is obsolete. Use RUBY_GC_HEAP_INIT_SLOTS instead.
/usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- phusion_passenger (LoadError)
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/phusion-passenger/helper-scripts/passenger-spawn-server:76:in `<main>'
[ pid=56858 thr=140583398008576 file=ext/apache2/Hooks.cpp:884 time=2014-04-25 22:10:55.823 ]: Unexpected error in mod_passenger: Cannot spawn application '/home/web1.kmedcommunications.com/current': Could not read from the spawn server: Connection reset by peer (104)
Backtrace:
(empty)
| Menopause | |
| Antibiotics | |
| Exercise | |
| Jaundice | |
| Rectal |
| Menopause | |
| Antibiotics | |
| Exercise | |
| Jaundice | |
| Rectal |
h - left
j - down
k - up
l - right
0 - end of line
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Simple Auth App</title> | |
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | |
| </head> | |
| <body> | |
| <script> | |
| // get the URL parameters received from the authorization server | |
| var state = getUrlParameter("state"); // session key |