Skip to content

Instantly share code, notes, and snippets.

View nsanta's full-sized avatar

Nicolas Santa nsanta

  • Rio Cuarto, Cordoba, Argentina
View GitHub Profile
@bellmyer
bellmyer / recovery.rb
Created August 14, 2019 16:58
Recover files that were git added, but never committed before a git-reset
#!/usr/bin/env ruby
hours_ago = ARGV.shift
recovery_dir = ARGV.shift
Dir.mkdir(recovery_dir) unless File.exists?(recovery_dir)
# find all objects that were created less than X hours ago
files = `find .git/objects -type f -atime -#{hours_ago}h`.split("\n")
defmodule ApplicationRouter do
use Dynamo.Router
prepare do
# Pick which parts of the request you want to fetch
# You can comment the line below if you don't need
# any of them or move them to a forwarded router
conn.fetch([:cookies, :params])
end
@cemeng
cemeng / gist:3355490
Created August 15, 2012 03:38
Jasmine, Angular, Rails, Coffeescript - my oh my

Goals:

  • Support Coffeescript testing
  • Headless - run from command line
  • Test can be written in Coffeescript

Test libraries, two main alternatives:

  • Jasmine
  • Mocha

Jasmine is older - actively maintained by PivotalLabs, de facto JS testing for Rails projects? So I'd expect there are more gems/projects that integrate Jasmine and Rails compared to Mocha (at the moment anyway).

@foca
foca / gist:821116
Created February 10, 2011 19:07
This is totally evil.
o1 = Object.new
o2 = Object.new
def (1 > 2 ? o1 : o2).blah
puts "blah"
end
o2.blah #=> puts "blah"
o1.blah #=> NoMethodError
# Mongoid association matchers for RSpec 2.x and 1.x
#
# Save this file to your spec/support directory
#
# Usage:
#
# describe User do
# it { should reference_one :profile }
# end
#
file 'Gemfile', <<-GEMS
source 'http://gemcutter.org'
gem "rails", "3.0.0.beta4"
gem "bson_ext"
gem "mongoid", "2.0.0.beta4"
gem "haml", "3.0.0.rc.2"
gem "compass", "0.10.0.rc4"
gem "inherited_resources"
group :test do
@derencius
derencius / mongoid-heroku.rb
Created May 7, 2010 04:53 — forked from ivanacostarubio/mongoid-heroku.rb
rails3 mongoid template
file 'Gemfile', <<-GEMS
source 'http://gemcutter.org'
gem "rails", "3.0.0.beta3"
gem "bson_ext"
gem "mongoid", "2.0.0.beta4"
gem "haml", "3.0.0.rc.2"
gem "compass", "0.10.0.rc4"
gem "inherited_resources"
group :test do