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
| /* | |
| ##Device = Desktops | |
| ##Screen = 1281px to higher resolution desktops | |
| */ | |
| @media (min-width: 1281px) { | |
| /* CSS */ | |
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
| # 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 |
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
| # Function to print strftime results | |
| def print_strftime_formats(a,cur_date) | |
| a.each do |format| | |
| b = "%#{format}" | |
| output = cur_date.strftime(b) | |
| puts "t.strftime('#{b}'), => #{output}" | |
| end | |
| end | |
| a = ('a'..'z').to_a |
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
| # in controller | |
| # for local files | |
| send_file '/path/to/file', :type => 'image/jpeg', :disposition => 'attachment' | |
| # for remote files | |
| require 'open-uri' | |
| url = 'http://someserver.com/path/../filename.jpg' | |
| data = open(url).read | |
| send_data data, :disposition => 'attachment', :filename=>"photo.jpg" |