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
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
after_action :cors
layout false
def cors
@geronimod
geronimod / crossdomain.xml
Created March 18, 2014 18:37
crossdomain.xml
<?xml version="1.0"?>
<!-- http://jwplatform.com/crossdomain.xml -->
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
@geronimod
geronimod / vast.xml
Created March 18, 2014 18:37
vast.xml
<VAST version="2.0">
<Ad id="YuMe">
<InLine>
<AdTitle><![CDATA[ Static YuMe VAST Tag]]></AdTitle>
<AdSystem>VPAID 1.0</AdSystem>
<Creatives>
<Creative>
<Linear>
<Duration>00:00:13</Duration>
<AdParameters>
@geronimod
geronimod / berlin-clock.rb
Created November 22, 2013 19:33
Kata Berlin Clock
require 'minitest/autorun'
class BerlinClock
def self.seconds(seconds)
seconds.even? ? 'Y' : 'O'
end
def self.minutes(minutes)
row1 = Array.new(11, 'O').unshift(['Y'] * (minutes / 5)).flatten.first(11)
@geronimod
geronimod / roman-numbers.rb
Created November 22, 2013 15:53
Kata Roman Numbers
require 'minitest/autorun'
class Integer
# rules:
# - Si a la derecha de una cifra romana de escribe otra igual o menor, el valor de ésta se suma a la anterior.
# - La cifra "I" colocada delante de la "V" o la "X", les resta una unidad; la "X", precediendo a la "L" o a la "C", les resta diez unidades y la "C", delante de la "D" o la "M", les resta cien unidades.
# - En ningún número se puede poner una misma letra más de tres veces seguidas. En la antigüedad se ve a veces la "I" o la "X" hasta cuatro veces seguidas.
# - La "V", la "L" y la "D" no pueden duplicarse porque otras letras ("X", "C", "M") representan su valor duplicado.
# - Si entre dos cifras cualesquiera existe otra menor, ésta restará su valor a la siguiente.
@geronimod
geronimod / prime-factors.rb
Last active December 28, 2015 22:09
Kata Prime Factors
require 'minitest/autorun'
def primes(input)
out, curr_div = [], 2
begin
div, mod = input.divmod(curr_div)
if mod.zero?
out << curr_div
input = div
else
@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