Skip to content

Instantly share code, notes, and snippets.

View geronimod's full-sized avatar
🇦🇷
Working from home

Geronimo Diaz geronimod

🇦🇷
Working from home
View GitHub Profile
@geronimod
geronimod / fizzbuzz.rb
Last active December 28, 2015 21:59
Kata Fizz Buzz
require 'minitest/autorun'
class FizzBuzz
class FizzBuzz::NonNatural < StandardError; end
def self.check(input)
raise NonNatural if !input.is_a?(Integer) || input < 1
if input % 15 == 0
'fizzbuzz'
@geronimod
geronimod / spec.rb
Created November 5, 2013 18:15
Test
it "should make the right csv" do
@dummy_class.should_not == nil
@dummy_class.respond_to?(:fetch_data).should == true
expected_return = []
@dummy_class.fetch_data expected_return
expected = [["Competitive Campaign", "", "comp camp 1", "comp camp 2", "test"], ["Release Date", "", "2013-01-01", "2013-01-01", "2013-01-01"], ["Campaign ID", "", 345, 346, 339], ["Days", "Weeks", "views"], [0, 0, "", "", ""], [1, "", "", "", ""], [2, "", "", "", ""], [3, "", "", "", ""], [4, "", "", "", ""], [5, "", "", "", ""], [6, "", "", "", ""], [7, 1, "", "", ""], [8, "", "", "", ""], [9, "", "", "", ""], [10, "", "", "", ""], [11, "", "", "", ""], [12, "", "", "", ""], [13, "", "", "", ""], [14, 2, "", "", ""], [15, "", "", "", ""], [16, "", "", "", ""], [17, "", "", "", ""], [18, "", "", "", ""], [19, "", "", "", ""], [20, "", "", "", ""], [21, 3, "", "", ""], [22, "", "", "", ""], [23, "", "", "", ""], [24, "", "", "", ""], [25, "", "", "", ""], [26, "", "", "", ""], [27, "", "", "", ""], [28, 4, "", "
@geronimod
geronimod / atv_by_clip.rb
Created October 28, 2013 14:44
ATV by clip for Hellmans's campaign
# Campaign Detail Exports - CDE SA - Hellmann's - Best Foods - Social Ads
# CDE export:
# PROMOTED VIDEO 0
# SOCIAL GAMING -
# SKIPSTREAM -
# CHOICEROLL -
# ADD. TRACKED VIEWS 1562155
# OD Data export
@geronimod
geronimod / tasty_cakes.rb
Created October 23, 2013 00:37
Waragon Contest
class Ingredient
include Comparable
def ==(other)
self.class == other.class
end
def to_s
self.class.name.downcase
end
@geronimod
geronimod / rollup.yaml
Created September 26, 2013 19:59
Rollup
--- !ruby/object:ChartCampaignRollup
attributes:
folder_count: \"1\"
rollupable_id: \"1\"
updated_at: 2013-04-15 13:30:53
view_growth: \"148082\"
rating_count: \"143152\"
comment_count: \"29681\"
name: Asset
placement_growth: \"100\"
@geronimod
geronimod / charts_by_column.txt
Created September 23, 2013 19:49
charts grouped by column
"Weeks on Chart" => ["Creative Agency Chart"]
"Last Month's Rank" => ["Brand Chart"]
"Views" => ["Variety Top Movies Chart", "Mashable Web Series ", "Visible Measures 100 Million Views Club", "Film Trailer Collection", "Video Games", "Political Ads", "Automotive News Chart"]
"Demographic Pool Size" => ["Film Trailer Collection", "Video Games"]
"Total Views" => ["Viral Video Collection", "Film Trailer Collection", "Super Bowl Collection", "Video Games", "Brand Chart", "Creative Agency Chart"]
@geronimod
geronimod / csv_headers.txt
Created September 23, 2013 17:32
Chart Type headers
Ad Age Viral Video Chart
[Rank, Last Week's Rank, Brand, Campaign Name, Campaign ID, Agency, Placements, Current Week Views, Comments, Ratings, % Change in Views, Cumulative Views, Sparkline, Image, Video Url]
Variety Top Movies Chart
[Rank, Last Week's Rank, Campaign Name, Campaign ID, Studio, Genre, Placements, Views, Comments, Ratings, Weeks To Release, % Change in Views, Sparkline, Image, Video Url]
Mashable Web Series
[Rank, Last Week's Rank, Campaign Name, Campaign ID, Studio, Genre, Placements, Views, Comments, Ratings, % Change in Views, Sparkline, Image, Video Url]
Visible Measures 100 Million Views Club
@geronimod
geronimod / data_growth.sql
Created September 20, 2013 14:46
Data Growth
SELECT distinct_clips.campaign_id, arizona_fill_clip.pk as clipKey, distinct_clips.clip_cat_id as category_id, distinct_clips.folder_type_id as folder_type_id, day, viewDelta as views, commentDelta as comments, rateDelta as ratings
FROM arizona_fill_clip
JOIN (
SELECT DISTINCT campaign_id, pk, clip_cat_id, folder_type_id, unified_clip_id, data_source
FROM arizona
WHERE data_source = 'phx'
AND campaign_id in (249,989,1021,1626,1706,1726,1742,1746,1750,1754,1718,1634,1542,1546,1498,1494,1502,1530,1550,1758,1766,1770,1778,1774,1526,1738,1534,1630,1786,1794,1814,1818,1822,1826,1834,1838,1842,1846,1890,1566,1898,1902,1910,1922,1930,1934,1938,1942,1946,1950,1954,1958,1962,1966,1970,1974,1978,1982,1986,1990,1994,1998,2006,693,1894,2010,2014,1762,2018,2022,2026,2030,2034,2038,2042,2046,2050,2058,2062,2066,2070,2074,2082,2090,2094,2098,2106,2110,2114,2118,2122,2126,2130,2134,2154,2158,2162,2166,2170,2174,2178,2190,2194,2202,2206,2210,2214,2218,2222,2226,2230
@geronimod
geronimod / data_growth_profiling.log
Created September 19, 2013 18:36
Data growth profiling
Thread ID: 69894461524400
Total: 89.750827
Sort by: self_time
%self total self wait child calls name
14.51 13.018 13.018 0.000 0.000 1450780 String#unpack
10.56 35.807 9.480 0.000 26.327 131881 Integer#times
7.28 12.244 6.530 0.001 5.713 2389657 Vertica::BitHelper#readn
5.13 4.892 4.607 0.000 0.285 263778 Rational#initialize
4.40 29.836 3.947 0.000 25.889 923164 Proc#call
growth_data with 1 query with n campaigns
"load_folder_data(eligible_campaigns): 0.120000 0.020000 0.140000 ( 4.050519)\n"
"load_summary_data(eligible_campaigns): 5.820000 0.250000 6.070000 ( 11.876990)\n"
"load_growth_data(eligible_campaigns): 42.090000 0.450000 42.540000 ( 50.433330)\n"
"load_folder_data(eligible_campaigns): 0.200000 0.050000 0.250000 ( 3.153942)\n"
"load_summary_data(eligible_campaigns): 6.730000 0.160000 6.890000 ( 14.022160)\n"
"load_growth_data(eligible_campaigns): 37.800000 0.360000 38.160000 ( 62.451637)\n"