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
Rails::Application.routes.draw do | |
# Limits the admin site only on the admin subdomain | |
constraints subdomain: /^admin/ do | |
ActiveAdmin.routes(self) | |
# Make resque only available to the admin users & redirect to admin login | |
# if trying to access resque without being logged in. | |
match('/admin/resque/admin/login' => redirect('/admin/login')) | |
authenticate :admin_user do | |
mount Resque::Server.new, :at => "/admin/resque" |
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
(-10..-5).include?(-7) | |
#=> true | |
(-5..-10).include?(-7) | |
#=> false | |
(10..5).include?(7) | |
#=> false | |
(5..10).include?(7) | |
#=> true | |
# OK, so maybe 10..5 wraps the whole set of integers? |
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 min: | |
~Painless Javascript | |
koting hatduklgg | |
with wind tunnel | |
~tenderlove.dup jremsikjr | |
~iwanttolearnruby.com | |
(collecting resources for learning ruby) |
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
⚡ rake | |
(in /Volumes/data/Users/mikel/Code/capybara-mechanize) | |
/Users/mikel/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -S bundle exec rspec "spec/driver/mechanize_driver_spec.rb" "spec/driver/remote_mechanize_driver_spec.rb" "spec/session/mechanize_spec.rb" "spec/session/remote_mechanize_spec.rb" | |
....F.............................FFFF.F.FFFFFFFFFFFFFFFFFFFFFFFFFFFFF...................................................................................................................................................................................................................................................................................................................................................................................................................................................................FFFF | |
Failures: | |
1) Capybara::Driver::Mechanize, in local model should include the right host when remote | |
Failure/Error: @driver.visit("#{REMOTE_TEST_URL}/host") | |
Received the following error for a GET |
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 TaxCalculator do | |
context "low income bracket" do | |
it "should be zero cents in the dollar for income less than 6000" do | |
[-200, 0, 3000, 5999.99].each do |income_level| | |
subject.income = income_level | |
subject.should == 0 | |
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
class User < ActiveRecord::Base | |
attr_accessor :captcha_answer | |
attr_writer :captcha_question | |
def captcha_question | |
@captcha_question ||= captcha_questions.to_a[rand(a.length)].first | |
end | |
def captcha_questions |
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
When /^I click on the "([^"]*)" question$/ do |title| | |
question = Question.find_by_title(title) | |
all(:css, "form#edit_question_#{question.id} thead").each { |node| node.click } | |
end | |
When /^I press enter in the "([^"]*)" field$/ do |name| | |
page.execute_script(%Q{ | |
var e = jQuery.Event('keypress'); | |
e.keyCode = 13; |
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
// Fires up Asteroids through pressing Ctrl-A | |
// | |
var isCtrl = false; | |
$(document).keyup(function (e) { | |
if(e.which == 17) isCtrl=false; | |
}).keydown(function (e) { | |
if(e.which == 17) isCtrl=true; | |
if(e.which == 65 && isCtrl == true) { | |
if($('script#Asteroids').size()==0){ | |
var s = document.createElement('script');s.type='text/javascript'; |
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
I need SQL to turn this: | |
| user_id | question_name | answer | | |
| 1 | 'q1' | 'a' | | |
| 1 | 'q2' | 'b' | | |
| 1 | 'q3' | 'c' | | |
| 2 | 'q1' | 'd' | | |
| 2 | 'q2' | 'e' | | |
| 2 | 'q3' | 'f' | |
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
== master | |
Updating documentation on ActiveResource HTTP Mock and also adding test coverage | |
http://github.com/mikel/rails/commit/e02bba31479be4c12a115556124b1b1a0d6d25de | |
Adding option to ActiveResource to allow you to not reset the previously stored requests and responses by passing false to respond_to | |
http://github.com/mikel/rails/commit/2a1b23f851ea3d4634fc68b74fe6b1afed23d3ef | |
== 3-0-stable | |
Updating documentation on ActiveResource HTTP Mock and also adding test coverage |
NewerOlder