Skip to content

Instantly share code, notes, and snippets.

View dgoldie's full-sized avatar

Doug Goldie dgoldie

  • Mountain View, CA
View GitHub Profile
@dgoldie
dgoldie / rcov.rake
Created June 7, 2011 20:35 — forked from jstirk/rcov.rake
rcov rake task for Rails 3, cucumber, rspec
# Forked to get it working with Rails 3 and RSpec 2
# Updated to aggregate Cucumber and rspec correctly
# Updated to not fail in production when Cucumber, rspec aren't available
#
# From http://github.com/jaymcgavren
#
# Save this as rcov.rake in lib/tasks and use rcov:all =>
# to get accurate spec/feature coverage data
#
# Use rcov:rspec or rcov:cucumber
Then /^(?:|I )should see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, selector|
with_scope(selector) do
if defined?(Spec::Rails::Matchers)
page.should have_xpath("//*[text()='#{text}']", :visible => true)
else
assert page.has_xpath("//*[text()='#{text}']", :visible => true)
end
end
end
@dgoldie
dgoldie / bootstrap_form_builder.rb
Created January 2, 2012 18:14 — forked from jamiepenney/bootstrap_form_builder.rb
Form builder for Twitter Bootstrap form elements.
class BootstrapFormBuilder < ActionView::Helpers::FormBuilder
def get_error_text(object, field, options)
if object.nil? || options[:hide_errors]
""
else
errors = object.errors[field.to_sym]
if errors.empty? then "" else errors.first end
end
end
@dgoldie
dgoldie / hack.sh
Created April 1, 2012 09:07 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@dgoldie
dgoldie / gist:5613705
Created May 20, 2013 17:20
git pull old repo of ruby-science
doug@apollo: ~/code/2012/books/ruby-science (master)
$ git pull
remote: Counting objects: 731, done.
remote: Compressing objects: 100% (424/424), done.
remote: Total 610 (delta 379), reused 389 (delta 175)
Receiving objects: 100% (610/610), 2.94 MiB | 1.25 MiB/s, done.
Resolving deltas: 100% (379/379), completed with 77 local objects.
From https://github.com/thoughtbot/ruby-science
c43b2c1..6a66cc9 master -> origin/master
+ 4e55f10...7070c40 dc-introduction-edits -> origin/dc-introduction-edits (forced update)
@dgoldie
dgoldie / gist:5613717
Created May 20, 2013 17:22
git pull of new repo of ruby-science
doug@apollo: ~/code/2013/books/ruby-science (master)
$ git pull
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 5 (delta 3), reused 5 (delta 3)
Unpacking objects: 100% (5/5), done.
From https://github.com/thoughtbot/ruby-science
6a66cc9..4b2d9e2 hw-tell-dont-ask -> origin/hw-tell-dont-ask
Already up-to-date.
doug@apollo: ~/code/2013/books/ruby-science (master)
@dgoldie
dgoldie / Guardfile
Last active December 25, 2015 08:29 — forked from Emerson/Guardfile
guard 'minitest' do
# with Minitest::Unit
watch(%r|^test/(.*)\/?test_(.*)\.rb|)
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
watch(%r|^test/test_helper\.rb|) { "test" }
# Rails 4 - App Files
watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/controllers/#{m[1]}_test.rb" }
watch(%r|^app/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}_test.rb" }
2.0.0@galactica apollo:~/code/2013/apps/boatbound/galactica (develop)!!!
$ bin/rspec spec/controllers/users/registrations_controller_spec.rb:104
You are using WebMock 1.16.1. VCR 2.8.0 has been tested against WebMock >= 1.8.0, < 1.16, and you are using a newer version. If you experience VCR issues, consider downgrading WebMock as it may fix it.
Run options: include {:locations=>{"./spec/controllers/users/registrations_controller_spec.rb"=>[104]}}
Users::RegistrationsController
POST create
init: #<User id: nil, deleted_at: nil, public_id: nil, referral_code: nil, invited_by: nil, acquisition_source: nil, role: "user", user_state: "email_only", read_lifesavers: nil, notification_preferences: nil, blocked: false, first_name: nil, last_name: nil, cell_number: nil, cell_verification: "false", profile_text: nil, profile_image_file_name: nil, profile_image_content_type: nil, profile_image_file_size: nil, profile_image_updated_at: nil, first_message_response_rate: #<BigDecimal:7fe02e23d2f8,'0.1E1',9(18)>, first_me
@dgoldie
dgoldie / phoenix_view_changes
Created June 24, 2014 20:01
phoenix view changes
# copied from local phoenix cloned repo to new app 'myapp'
2.1.2 apollo:~/code/libraries/phoenix/lib/phoenix (master)
$ cp controller.ex ~/code/work/elixir/myapp/deps/phoenix/lib/phoenix/controller/controller.ex
2.1.2 apollo:~/code/libraries/phoenix/lib/phoenix (master)
$ cp view.ex ~/code/work/elixir/myapp/deps/phoenix/lib/phoenix/view.ex
2.1.2 apollo:~/code/libraries/phoenix/lib/phoenix (master)
$ cp -R html/ ~/code/work/elixir/myapp/deps/phoenix/lib/phoenix/
2.1.2 apollo:~/code/libraries/phoenix/lib/phoenix (master)