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
| create.response { redirect_to welcome_user_path(@user) } |
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
| var new_user_form = jQuery('#new_user_form form'); | |
| new_user_form.fn({ | |
| transitionToEntry: function() { | |
| jQuery(this).removeClass('captcha').addClass('entry'); | |
| jQuery(this).submit(function() { | |
| jQuery(this).fn('transitionToCaptcha'); | |
| return false; | |
| }); | |
| }, | |
| transitionToCaptcha: function() { |
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
| Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil) | |
| =(nil 41) | |
| (if (= (char-before) 41) (progn (backward-list))) | |
| (when (= (char-before) 41) (backward-list)) | |
| (progn (skip-syntax-backward " ") (when (= ... 41) (backward-list)) (back-to-indentation) (cond (same-indent-p ...) (continued-expr-p ...) (t ...))) | |
| (if (looking-at "[({[][ ]*\\(/[/*]\\|$\\)") (progn (skip-syntax-backward " ") (when ... ...) (back-to-indentation) (cond ... ... ...)) (unless same-indent-p (forward-char) (skip-chars-forward " ")) (current-column)) | |
| (cond (ctrl-stmt-indent) ((js-continued-var-decl-list-p) (js-re-search-backward "\\<var\\>" nil t) (+ ... javascript-indent-level)) ((nth 1 parse-status) (goto-char ...) (if ... ... ... ...)) (continued-expr-p javascript-indent-level) (t (let ... ... ind))) | |
| (let ((ctrl-stmt-indent ...) (same-indent-p ...) (continued-expr-p ...)) (cond (ctrl-stmt-indent) (... ... ...) (... ... ...) (continued-expr-p javascript-indent-level) (t ...))) | |
| (save-excursion ( |
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
| (add-hook 'javascript-mode-hook | |
| (lambda () | |
| (textmate-mode) | |
| (local-set-key "\r" | |
| (lambda () (interactive) | |
| (insert-line-before-closing-braces) | |
| (newline-and-indent))))) | |
| (defun insert-line-before-closing-braces () | |
| (interactive) |
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
| describe AccountService, "#transfer" do | |
| before(:each) do | |
| @from = Account.new 500 | |
| @to = Account.new 100 | |
| @service = AccountService.new | |
| end | |
| def do_transfer | |
| @service.transfer @from, @to, 150 | |
| 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
| #!/usr/bin/env ruby | |
| if File.exist?("blackjack") | |
| puts "whoops looks like you already have a folder named blackjack" | |
| exit | |
| end | |
| `git clone git://github.com/pat-maddox/blackjack.git` | |
| Dir.chdir("blackjack") do | |
| remote_branches = `git branch -r`.split("\n").map{|s| s.strip}.reject {|b| b.include? 'master'} | |
| remote_branches.each do |remote_branch| |
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
| [*1..99].reverse.each do |i| | |
| phrase = ["#{i} bottles of beer on the wall", | |
| "#{i} bottles of beer", | |
| "You take one down", | |
| "You pass it around", | |
| "#{i - 1} bottles of beer on the wall.."].join(".. ") | |
| `say #{phrase}` | |
| 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
| class PeopleController < ApplicationController | |
| def create | |
| begin | |
| p = Person.new params[:person] | |
| p.save | |
| render :text => "yay!" | |
| rescue | |
| render :text => "oops!" | |
| 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
| befores = {} | |
| Before do | |
| if block = befores[current_scenario.name] | |
| block.call | |
| end | |
| end | |
| # Maybe get this behavior for free and provide |
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 CaptchaResponse | |
| RECAPTCHA_API_SERVER = 'http://api.recaptcha.net' | |
| RECAPTCHA_API_SECURE_SERVER = 'https://api-secure.recaptcha.net' | |
| RECAPTCHA_VERIFY_SERVER = 'api-verify.recaptcha.net' | |
| attr_writer :user | |
| attr_reader :errors | |
| class << self | |
| private :new | |
| attr_writer :mode |