Skip to content

Instantly share code, notes, and snippets.

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
[[{"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
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
...
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
@dreamr
dreamr / gist:6415655
Last active December 22, 2015 04:18
cl-digger searches
laying hens
hand tools
drill press
wood lathe
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
<div id="content">
<ul id="hotplay_tabs">
<li class="selected">
<a href="/hotplays/58">Main</a>
</li>
<li class="">
<a href="/hotplays/58/targeting">Targeting</a>
</li>
<li class="">
<a href="/hotplays/58/crm">CRM</a>
fdebe0c (dreamr/invite_template_save) 2 days ago Dreamr Merge pull request #366 from 01Click/dreamr/buyer_collateral_internal
* 9dcc48d (dreamr/buyer_collateral_internal) 2 days ago Dreamr OKelly added internal back into buyer collateral
719ba6d 2 days ago Dreamr OKelly added source to collateral form
95bd9da 2 days ago Dreamr OKelly removed buyer video
6434d9a 2 days ago Dreamr OKelly buyers don't need child collateral
5e55876 (dreamr/faster_ci_via_bucket) 3 days ago Dreamr OKelly testing faster ci
b8ae03e 3 days ago Danny Bosan fix formatting problem in yml
34910bf 3 days ago Danny Bosan whitespace change after travis command
2e25271 3 days ago Danny Bosan remove duplicate ENV vars
1c6d6f5 3 days ago Danny Bosan secure the last remaining ENVs
@dreamr
dreamr / gist:5888851
Created June 28, 2013 23:11
pretty git log
alias gl='git log --pretty='\''format:%Cblue%h%d%Creset %ar %Cgreen%an%Creset %s'\'' --graph'
@dreamr
dreamr / my_functional_logger.rb
Last active December 18, 2015 21:19
My stab at functional coding in Ruby!
# simply takes an array and joins it with --'s
format_log_line = ->(func) {
if func.kind_of?(Array)
func.flatten.compact.join(" -- ").concat("\n")
else
func
end
}
# write a file, functional stylee