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
STEP 1 | |
------- | |
cache hotplays.json (user centeric) in redis or as a static file | |
When hotplays.json is hit: | |
serve cached copy | |
fire off a worker to re-cache it | |
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
laying hens | |
hand tools | |
drill press | |
wood lathe |
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
... | |
def feeds_counts | |
@result = [] | |
current_user.feeds.each do |feed| | |
@result << { | |
id: feed.id, | |
title: feed.title, | |
count: feed.post_count_since_last_read | |
} | |
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
def feeds_counts | |
@result = [] | |
current_user.feeds.each do |feed| | |
@result << { | |
id: feed.id, | |
title: feed.title, | |
count: feed.post_count_since_last_read | |
} | |
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
[[{"trdprc_1"=>"470.09", "open_prc"=>"467.0101", "mnemonic"=>"AAPL", "cf_close"=>"494.64", "cf_date"=>"11 SEP 2013", "cf_exchng"=>"NSQ", "cf_high"=>"473.69", "cf_low"=>"464.81", "cf_volume"=>"24862036", "cf_name"=>"APPLE INC"}, {"trdprc_1"=>"470.09", "open_prc"=>"467.0101", "mnemonic"=>"AAPL", "cf_close"=>"494.64", "cf_date"=>"11 SEP 2013", "cf_exchng"=>"NSQ", "cf_high"=>"473.69", "cf_low"=>"464.81", "cf_volume"=>"24862036", "cf_name"=>"APPLE INC"}, {"trdprc_1"=>"470.09", "open_prc"=>"467.0101", "mnemonic"=>"AAPL", "cf_close"=>"494.64", "cf_date"=>"11 SEP 2013", "cf_exchng"=>"NSQ", "cf_high"=>"473.69", "cf_low"=>"464.81", "cf_volume"=>"24862036", "cf_name"=>"APPLE INC"}, {"trdprc_1"=>"470.09", "open_prc"=>"467.0101", "mnemonic"=>"AAPL", "cf_close"=>"494.64", "cf_date"=>"11 SEP 2013", "cf_exchng"=>"NSQ", "cf_high"=>"473.69", "cf_low"=>"464.81", "cf_volume"=>"24862036", "cf_name"=>"APPLE INC"}, {"trdprc_1"=>"470.09", "open_prc"=>"467.0101", "mnemonic"=>"AAPL", "cf_close"=>"494.64", "cf_date"=>"11 SEP 2013", "cf |
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 PersonName | |
attr_reader :first_name, :middle_initial, :last_name | |
def full_name(*options) | |
return send(:full_name_first_name_first) if options.nil? || options.empty? | |
options.map {|option| raise OptionError.new unless options_whitelist.include?(option) } | |
method = "full_name_OPT" | |
send(:"#{method.gsub("OPT", options[0].to_s)}") | |
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
create_table "bonds", :force => true do |t| | |
t.string "currency" | |
t.string "display_name" | |
t.decimal "current_yield", :precision => 19, :scale => 4 | |
t.decimal "previous_yield", :precision => 19, :scale => 4 | |
t.datetime "close_date" | |
t.string "ric" | |
t.datetime "created_at", :null => false | |
t.datetime "updated_at", :null => false | |
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
alias rtest='ruby -Ilib -Itest ' | |
alias gs="git status" | |
alias gcb="git checkout -b " | |
alias gch="git checkout " | |
alias gca="git commit -a" | |
alias gpo="git push origin " | |
alias gri="git rebase -i " | |
alias gfo="git fetch origin" | |
alias gl='git log --pretty='\''format:%Cblue%h%d%Creset %ar %Cgreen%an%Creset %s'\'' --graph' |
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 "forwardable" | |
class Items | |
include Enumerable | |
extend Forwardable | |
def_delegators :@all, :each, :map, :inject, | |
:reduce, :select, :reject | |
attr_reader :all, :filtered |
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
printer = ->(msg) { puts "#{msg}" } | |
logger = ->(msg) { File.open("test.txt", "a") {|f| f.write(msg) } } | |
class Person | |
def initialize(first_name, last_name) | |
@first_name, @last_name = first_name, | |
last_name | |
end |