This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var options = { | |
| "gender": "#{search_params['gender']}", | |
| "age": "#{current_user.age}", | |
| "language": "#{search_params['language']}", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class NilObject | |
| def initialize(klass=nil) | |
| @klass=klass | |
| end | |
| def method_missing(name, *args) | |
| return self unless @klass | |
| klass.new.respond_to? name ? self : super | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Duck < ActiveRecord::Base | |
| def awake? | |
| status == 'awake' | |
| end | |
| def quack | |
| puts quack_style | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/ruby | |
| # Split the given mp3 file into 2:05 minute pieces | |
| file_name = ARGV[0] | |
| # file_length = ARGV[1] | |
| dir_name = file_name.split('.').first | |
| `mkdir #{dir_name}` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ActionController #:nodoc: | |
| class Base | |
| def bwi_respond_with(*resources, &block) | |
| options = {} | |
| methods = [:pkid] | |
| options = resources.pop if resources.size > 1 && resources.last.is_a?(Hash) | |
| if options[:methods] | |
| if options[:methods].is_a?(Array) |
NewerOlder