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
| def morse(s) | |
| dictionary = { 'a' => '.-', 'b' => '-...', 'c' => '-.-.', 'd' => '-..', 'e' => '.', 'f' => '..-.', 'g' => '--.', 'h' => '....', 'i' => '..', 'j' => '.---', 'k' => '-.-', 'l' => '.-..', 'm' => '--', 'n' => '-.', 'o' => '---', 'p' => '.--.', 'q' => '--.-', 'r' => '.-.', 's' => '...', 't' => '-', 'u' => '..-', 'v' => '...-', 'w' => '.--', 'x' => '-..-', 'y' => '-.--', 'z' => '--..' } | |
| word = '' | |
| s.downcase! | |
| for i in 0..(s.length - 1) do | |
| if dictionary[s[i,1]] | |
| word << dictionary[s[i,1]] | |
| elsif s[i,1] == ' ' | |
| word << ' ' | |
| end |
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
| def morse(s) | |
| dictionary = { 'a' => '.-', 'b' => '-...', 'c' => '-.-.', 'd' => '-..', 'e' => '.', 'f' => '..-.', 'g' => '--.', 'h' => '....', 'i' => '..', 'j' => '.---', 'k' => '-.-', 'l' => '.-..', 'm' => '--', 'n' => '-.', 'o' => '---', 'p' => '.--.', 'q' => '--.-', 'r' => '.-.', 's' => '...', 't' => '-', 'u' => '..-', 'v' => '...-', 'w' => '.--', 'x' => '-..-', 'y' => '-.--', 'z' => '--..', '0' => '-----', '1' => '.----', '2' => '..---', '3' => '...--', '4' => '....-', '5' => '.....', '6' => '-....', '7' => '--...', '8' => '---..', '9' => '----.' } | |
| word = '' | |
| s.downcase! | |
| for i in 0..(s.length - 1) do | |
| if dictionary[s[i,1]] | |
| word << dictionary[s[i,1]] | |
| elsif s[i,1] == ' ' | |
| word << ' ' | |
| end |
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
| def morse(s) | |
| dictionary = { 'a' => '.-', 'b' => '-...', 'c' => '-.-.', 'd' => '-..', 'e' => '.', 'f' => '..-.', 'g' => '--.', 'h' => '....', 'i' => '..', 'j' => '.---', 'k' => '-.-', 'l' => '.-..', 'm' => '--', 'n' => '-.', 'o' => '---', 'p' => '.--.', 'q' => '--.-', 'r' => '.-.', 's' => '...', 't' => '-', 'u' => '..-', 'v' => '...-', 'w' => '.--', 'x' => '-..-', 'y' => '-.--', 'z' => '--..', '0' => '-----', '1' => '.----', '2' => '..---', '3' => '...--', '4' => '....-', '5' => '.....', '6' => '-....', '7' => '--...', '8' => '---..', '9' => '----.' } | |
| word = '' | |
| s.downcase! | |
| for i in 0..(s.length - 1) do | |
| if dictionary[s[i,1]] | |
| word << dictionary[s[i,1]] | |
| elsif s[i,1] == ' ' | |
| word << ' ' | |
| end |
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
| def test_form_for | |
| form_for(@post, :as => :post, :html => { :id => 'create-post' }) do |f| | |
| concat f.label(:title) | |
| concat f.text_field(:title) | |
| concat f.text_area(:body) | |
| concat f.check_box(:secret) | |
| concat f.submit('Create post') | |
| end | |
| expected = |
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
| def test_form_for_deprecated | |
| assert_deprecated do | |
| form_for(:post, @post, :html => { :id => 'create-post' }) do |f| | |
| concat f.label(:title) { "The Title" } | |
| concat f.text_field(:title) | |
| concat f.text_area(:body) | |
| concat f.check_box(:secret) | |
| concat f.submit('Create post') | |
| end | |
| end |
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
| <"<form method=\"post\" action=\"http://www.example.com\" id=\"create-post\" accept-charset=\"UTF-8\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" value=\"✓\" type=\"hidden\" /></div><label for=\"post_title\">The Title</label><input name=\"post[title]\" size=\"30\" id=\"post_title\" value=\"Hello World\" type=\"text\" /><textarea name=\"post[body]\" id=\"post_body\" rows=\"20\" cols=\"40\">Back to the hill and over it again!</textarea><input name=\"post[secret]\" value=\"0\" type=\"hidden\" /><input checked=\"checked\" name=\"post[secret]\" id=\"post_secret\" value=\"1\" type=\"checkbox\" /><input name=\"commit\" id=\"post_submit\" value=\"Create post\" type=\"submit\" /></form>"> expected to be == to | |
| <"<form class=\"post_edit\" method=\"post\" action=\"/posts/123\" id=\"create-post\" accept-charset=\"UTF-8\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" value=\"✓\" type=\"hidden\" /><input name=\"_method\" value=\"put\" type=\"hidden\" /></div><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
| "Fabio Kung <[email protected]> | |
| " | |
| "Use Vim settings, rather then Vi settings (much better!). | |
| "This must be first, because it changes other options as a side effect. | |
| set nocompatible | |
| "allow backspacing over everything in insert mode | |
| set backspace=indent,eol,start | |
| "store lots of :cmdline history |
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
| reseller_login /reseller_login {:action=>"login", :controller=>"resellers"} | |
| reseller_join /reseller_join {:action=>"new", :controller=>"resellers"} | |
| reseller_welcome /reseller_welcome {:action=>"welcome", :controller=>"resellers"} | |
| reseller_thanks /reseller_thanks {:action=>"thanks", :controller=>"resellers"} | |
| reseller_activate /reseller_activate/:activation_code {:action=>"activate", :controller=>"re |
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
| #user_nav | |
| - if user_signed_in? | |
| Signed in as #{current_user.email}. Not you? | |
| \#{link_to "Sign out", destroy_user_session_path} | |
| - else | |
| = link_to "Sign up", new_user_registration_path | |
| or | |
| \#{link_to "Sign in", new_user_session_path} |
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
| class Bill | |
| def assign_rps_number_and_serial(save_it = nil) | |
| rps = Bill.order(:rps_serial, :rps_number).where('rps_number IS NOT NULL').select(:rps_number, :rps_serial).last | |
| number = rps.try(:rps_number) || 1 | |
| serial = rps.try(:rps_serial) || 'A' | |
| self.rps_number, self.rps_serial = if number < 999999999999 | |
| [number + 1, serial] | |
| else | |
| [1, serial + 'A'] |
OlderNewer