Skip to content

Instantly share code, notes, and snippets.

View mikel's full-sized avatar

Mikel Lindsaar mikel

View GitHub Profile
Installing Rails from github
$ git clone http://github.com/carlhuda/bundler
$ cd bundler
$ gem build bundler.gemspec
$ gem install bundler
$ cd ..
$ git clone http://github.com/rails/rails
$ ruby rails/railties/bin/rails test --dev
mikel@baci.lindsaar.net ~/Code/railsplugins
$ rake spec --trace
** Invoke spec (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)

Thu Jun 3 01:26:47 UTC 2010 Mikel Lindsaar <mikel@rubyx.com>

  • Removed unnecessary “-” from <<- call

== 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
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' |
// 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';
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;
@mikel
mikel / model.rb
Created August 27, 2011 04:49
Simple Question Based Captcha
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
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
@mikel
mikel / gist:1626425
Created January 17, 2012 12:03
capybara-mechanize rake spec after upgrading to Mechanize 2.1
⚡ 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