This file contains 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
ActiveRecord::Base.uncached do | |
# loop here | |
end |
This file contains 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
.wrapper { | |
background-image: url('images/bg.jpg'); | |
background-repeat: no-repeat; | |
background-position: 0 0; | |
-webkit-background-size: cover; | |
-moz-background-size: cover; | |
-o-background-size: cover; | |
background-size: cover; | |
} |
This file contains 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
@each $property in margin, padding { | |
@each $location in top, right, bottom, left { | |
@for $i from 0 through 15 { | |
.#{$property}-#{$location}-#{$i * 10} { #{$property}-#{$location}: 10px * $i; } | |
} | |
} | |
} |
This file contains 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 doSomething() { | |
return { | |
then: function(callback) { | |
return "3"; | |
}, | |
error: function(callback) { | |
return "4"; | |
} | |
}; |
This file contains 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
require 'stripe' | |
require 'ostruct' | |
# modified & fixed for more subscription based Stripe account from: https://gist.github.com/jacobpatton/a68d228bf2414852d862 | |
# | |
# puts Stripe::Mrr.new(api_key: 'api_key').report | |
# | |
module Stripe | |
class Mrr | |
attr_reader :api_key |
This file contains 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
Country.create(:name => 'Afghanistan', :iso3 => 'AFG', :iso2 => 'AF', :numcode => 4) | |
Country.create(:name => 'Åland Islands', :iso3 => 'ALA', :iso2 => 'AX', :numcode => 248) | |
Country.create(:name => 'Albania', :iso3 => 'ALB', :iso2 => 'AL', :numcode => 8) | |
Country.create(:name => 'Algeria', :iso3 => 'DZA', :iso2 => 'DZ', :numcode => 12) | |
Country.create(:name => 'American Samoa', :iso3 => 'ASM', :iso2 => 'AS', :numcode => 16) | |
Country.create(:name => 'Andorra', :iso3 => 'AND', :iso2 => 'AD', :numcode => 20) | |
Country.create(:name => 'Angola', :iso3 => 'AGO', :iso2 => 'AO', :numcode => 24) | |
Country.create(:name => 'Anguilla', :iso3 => 'AIA', :iso2 => 'AI', :numcode => 660) | |
Country.create(:name => 'Antarctica', :iso3 => 'ATA', :iso2 => 'AQ', :numcode => 10) | |
Country.create(:name => 'Antigua and Barbuda', :iso3 => 'ATG', :iso2 => 'AG', :numcode => 28) |
This file contains 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
# I'm using smarter-csv gem to help parse the CSV | |
require 'net/ftp' | |
filename = 'filename-here.csv' | |
temp_file = Tempfile.new("download-#{filename}") | |
temp_file.binmode | |
import_options = {chunk_size: 10000, downcase_header: true, :row_sep => :auto, encoding: "UTF-8"} | |
size = 0 | |
progress = 0 |
This file contains 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
uri = URI('https://api.catalog.com/v2/products') | |
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http| | |
request = Net::HTTP::Get.new uri | |
request.basic_auth 'user', 'pass' | |
http.request request do |response| | |
open 'temp_file_name', 'wb' do |io| | |
response.read_body do |chunk| | |
io.write chunk |
This file contains 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 Human | |
def talk | |
puts "I’m talking" | |
end | |
private | |
def whisper | |
puts "I’m whispering" | |
end |