Skip to content

Instantly share code, notes, and snippets.

View dfasolin's full-sized avatar
🌚
Working from moon

Danilo Salmazio dfasolin

🌚
Working from moon
View GitHub Profile
@justinweiss
justinweiss / filterable.rb
Last active August 12, 2024 10:10
Filterable
# Call scopes directly from your URL params:
#
# @products = Product.filter(params.slice(:status, :location, :starts_with))
module Filterable
extend ActiveSupport::Concern
module ClassMethods
# Call the class methods with names based on the keys in <tt>filtering_params</tt>
# with their associated values. For example, "{ status: 'delayed' }" would call
@creaktive
creaktive / 00-PerlAssincrono.pod
Created January 15, 2011 20:57
Perl Assíncrono

Perl Assíncrono

Introdução

Esse artigo é dedicado aos 20 anos da WWW :)

#Dr StrangeCode or "How I Learned to Stop Worrying and Love the Rails 3.0 Upgrade"* I recently upgraded one of my Rails applications from 2.3.5 to 3.0.0 (and from ruby 1.8.7 to 1.9.2). I took a series of notes of all the problems and issues I ran into. ##Ruby 1.8.7 to 1.9.2 upgrade

  • FasterCSV is part of 1.9.2, but not 1.8.7. If you want to maintain compatibility with both, then keep using FasterCSV.
  • ftools no longer exists in ruby 1.9.2. Was using it in a require. I just used fileutils instead.
  • I had a bunch of old-style case/when statements that no longer work in 1.9.
    hours = case r[6..6]
        when "M": [0,11]
 when "A": [12, 18]