I hereby claim:
- I am fny on github.
- I am fny (https://keybase.io/fny) on keybase.
- I have a public key whose fingerprint is 477B 6E2F 415F 02BC AA6C 44E0 1E9C CF9B 131E 417C
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| [ | |
| { | |
| "code": "ARI", | |
| "name": "Cardinals", | |
| "full_name": "Arizona Cardinals" | |
| }, | |
| { | |
| "code": "ATL", | |
| "name": "Falcons", | |
| "full_name": "Atlanta Falcons" |
| require 'csv' | |
| def dump_relation(file_name, relation) | |
| File.open(file_name, 'w') do |file| | |
| # Load the data once | |
| records = relation.to_a | |
| # Write headers | |
| file.puts records.first.attributes.keys.to_csv | |
| # Write records | |
| records.each { |record| file.puts record.attributes.values.to_csv } |
| # Before | |
| Rails.application.config.assets.version = '1.0' | |
| Rails.application.config.assets.paths << Emoji.images_path | |
| Rails.application.config.assets.precompile += %w( search.js ) | |
| # After | |
| Rails.application.config.assets.tap do |assets| | |
| assets.version = '1.0' | |
| assets.paths << Emoji.images_path | |
| assets.precompile += %w( search.js ) |
| { | |
| "folders": | |
| [ | |
| { | |
| "file_exclude_patterns": | |
| [ | |
| "*.sqlite3" | |
| ], | |
| "folder_exclude_patterns": | |
| [ |
| module DateRangeParams | |
| extend ActiveSupport::Concern | |
| included do | |
| helper_method :start_date | |
| helper_method :end_date | |
| helper_method :date_range | |
| def self.set_default_end_date(&block) | |
| @default_end_date = block |
| require 'benchmark/ips' | |
| MONDO_HASH = (1..50).each_with_object({}) { |num, hash| | |
| hash[num.to_s] = num | |
| } | |
| # Monkey-patching a map_values to test; this should probably be a refinement | |
| class Hash | |
| def map_values | |
| merge({}) { |key, value| yield(value) } |
| # This file lives in `app/.elasticbeanstalk/config.yml.erb` | |
| branch-defaults: | |
| master: | |
| environment: <%= eb_environment %> | |
| # environment: contigo-worker-env # Enable for worker | |
| # Put global configs below! |
| class WholeNumberValidator < ActiveModel::EachValidator | |
| def validate_each(record, attribute, value) | |
| unless value =~ /\A\d+\.0*\z/ | |
| record.errors[attribute] << (options[:message] || "must be a whole number") | |
| end | |
| end | |
| end |
| # Processes CSV compiled from http://names.mongabay.com/most_common_surnames.htm | |
| # into a surnames text file and a CSV | |
| require 'csv' | |
| require 'active_support/core_ext/string' | |
| surnames_data = {} | |
| def process_name(name) | |
| # Format names like McCallister |