Skip to content

Instantly share code, notes, and snippets.

View lporras's full-sized avatar
🏠
Working from home

Luis Alfredo Porras Páez lporras

🏠
Working from home
View GitHub Profile
@lporras
lporras / rspec.rake
Created January 13, 2011 16:03
rake for run all rspec test with rcov.
require 'rubygems'
require 'rspec/core/rake_task'
require "rspec"
namespace :test do
desc "Run all specs."
Rspec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/**/*_spec.rb'
t.verbose = false
end
@lporras
lporras / Tips: Hirb Gem
Created January 13, 2011 22:11
How to user Hirb gem in rails 3
1. add to gemfile:
gem 'hirb'
2. run bundle command
3. open the rails console
4. input: require 'hirb'
5. Enable the use of hirb on rails console: Hirb.enable
@lporras
lporras / ruby-1.9-tips.rb
Created April 5, 2011 02:20 — forked from guilleiguaran/ruby-1.9-tips.rb
Ruby 1.9 Tips
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
# Add fixture-generation methods to ControllerExampleGroup. We load
# this file within our spec_helper.rb
Spec::Rails::Example::ControllerExampleGroup.class_eval do
# Saves the markup to a fixture file using the given name
def save_fixture(markup, name)
fixture_path = File.join(RAILS_ROOT, '/tmp/js_dom_fixtures')
Dir.mkdir(fixture_path) unless File.exists?(fixture_path)
@lporras
lporras / rails_3_1_rc4_changes.md
Created July 26, 2011 00:13 — forked from ryanb/rails_3_1_rc4_changes.md
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 RC4

  • The new rake task assets:clean removes precompiled assets. [fxn]

  • Application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle. [fxn]

  • Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]

  • Template generation for jdbcpostgresql #jruby [Vishnu Atrai]

@lporras
lporras / gist:1254714
Created September 30, 2011 19:16
some useful bash scripts
find trailing spaces
--------------------
grep -R -E "^[[:space:]]+$" * -n
@lporras
lporras / debugger.rb
Created October 1, 2011 19:45 — forked from guilleiguaran/debugger.rb
Setting ruby-debug for Pow
Debugger.settings[:autoeval] = true
Debugger.settings[:autolist] = 1
Debugger.settings[:reload_source_on_change] = true
Debugger.start_remote
@lporras
lporras / people_controller.rb
Created December 12, 2011 18:01 — forked from enthal/people_controller.rb
simple rails rsepc testing that devise before_filter :authenticate_user! covers controller actions
class PeopleController < ApplicationController
before_filter :authenticate_user!, :except => [:index, :show]
...
end
@lporras
lporras / ruby_debug_pow.markdown
Created December 15, 2011 23:48 — forked from alexagui/ruby_debug_pow.markdown
How to Ruby Debug with Pow

How to Ruby Debug with Pow

Below are steps I followed to get ruby debugger ruby-debug running with Pow. Based on info from this thread basecamp/pow#43 and this blog post http://flochip.com/2011/04/13/running-pow-with-rdebug/

1) Update your Gemfile

Assuming you're writing your app in Ruby 1.9 and using Bundler, just add the dependency to your development gems:

@lporras
lporras / factories.rb
Created January 6, 2012 20:50 — forked from robertomiranda/factories.rb
Simulate Paperclip Attachments With FactoryGirl
Factory.define :item do |f|
include ActionDispatch::TestProcess
f.name "Macbook Pro 15"
f.price_in_dollars 1500
f.photo fixture_file_upload('/files/avatar.jpg', 'image/jpg')
end