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
worker_processes 2 | |
working_directory "/Users/jlogsdon/Projects/Vitrue/publisher" | |
preload_app true | |
timeout 30 | |
listen "/Users/jlogsdon/Projects/Vitrue/unicorn/publisher.sock", :backlog => 64 | |
pid "/Users/jlogsdon/Projects/Vitrue/unicorn/publisher.pid" |
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
begin | |
require 'pry' | |
module Rails | |
class Console | |
class IRB | |
def self.start | |
Pry.start | |
end | |
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 Convert | |
def self.to_string(double) | |
split = double.to_s.split('.') | |
# Tack the tens on to cents if not present (.90 => .9 for example) | |
split[1] << "0" if split[1] and split[1].length == 1 | |
dollars = convert(split[0]) | |
cents = convert(split[1]) | |
dollars = plural(dollars, 'Dollar', split[0]) if dollars |
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
curl http://goo.gl/Z4EFC -L -s -o ~/fixlogin.sh && chmod +x ~/fixlogin.sh && sudo ~/fixlogin.sh ; rm ~/fixlogin.sh |
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
require 'csv' | |
headers = [] | |
data = [] | |
CSV.foreach('tapjoyserver/tapjoyads/test.csv') do |row| | |
if headers.empty? | |
headers = row | |
else | |
data << Hash[headers.map { |h| [h, row.shift] }] |
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
describe MyStateMachine do | |
describe '#pending?' do | |
context 'when the state is pending' | |
context 'when the state is approved' | |
context 'when the state is rejected' | |
end | |
describe '#approved?' do | |
context 'when the state is pending' | |
context 'when the state is approved' |
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
user.profile.detail = {:education=> {:degree=>[], :specialization=>[], :institution=>[]}} | |
=begin | |
Now I am trying to store it in arrays inside hashes while migrating but when I view it it will be #difficult to show the contents in order since these 3 different values are being stored in 3 different #array inside hash. | |
Considering there could be multiple rows for a single user, I wanna store it in the ascending order of dates ie first course should be entered first although I dont want to migrate start and end date. | |
How can I have a better structure of storing the values | |
I want to migrate data into this hash structure for the give table structure. | |
ID DEGREE SPECIFICATION INSTITUTION START_DATE END_DATE |
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
foo = Hash.new("Hello") | |
foo[:bar] << ' World' | |
foo[:baz] == "Hello World" |
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
@ores = [ | |
{name: 'foo', cost: 100}, | |
{name: 'bar', cost: 100}, | |
{name: 'foo', cost: 100}, | |
{name: 'baz', cost: 100}, | |
{name: 'bar', cost: 100} | |
] | |
@ores.select { |o| o['name'] == 'foo' } => [{name: 'foo', cost: 100}, {name: 'foo', cost: 100}] |
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 Mineral < ActiveRecord::Base | |
has_many :ore_contents | |
has_many :ores, :through => :ore_contents | |
end | |
class Ore < ActiveRecord::Base | |
has_many :ore_contents | |
has_many :minerals, :through => :ore_contents | |
validates_presence_of :batch_size |