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
# 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 / bootstrap_errors.rb
Created September 27, 2015 23:22
Rails bootstrap error forms Initializer
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
html = %(<div class="field_with_errors">#{html_tag}</div>).html_safe
# add nokogiri gem to Gemfile
form_fields = [
'textarea',
'input',
'select'
]
@lporras
lporras / backbone-validation-bootstrap.js.coffee
Created September 27, 2015 23:50 — forked from driehle/backbone-validation-bootstrap.js.coffee
Render error messages of Backbone.Validation for Twitter Bootstrap
# --------------------------------------------
# This code is for Twitter Bootstrap 2!
# --------------------------------------------
#
# The MIT License (MIT)
# Copyright (c) 2012-2015 Dennis Riehle
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
@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
@lporras
lporras / syntax_highlighting.py
Created January 12, 2012 16:08 — forked from JeanMertz/syntax_highlighting.py
Ruby on Rails syntax highlight switcher for Sublime Text 2
import sublime, sublime_plugin
import os
class DetectFileTypeCommand(sublime_plugin.EventListener):
""" Detects current file type if the file's extension isn't conclusive """
""" Modified for Ruby on Rails and Sublime Text 2 """
""" Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """
def on_load(self, view):
filename = view.file_name()