This file contains 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 Ingredient | |
include Comparable | |
def ==(other) | |
self.class == other.class | |
end | |
def to_s | |
self.class.name.downcase | |
end |
This file contains 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
# 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 |
This file contains 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
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, "", " |
This file contains 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 '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' |
This file contains 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 '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 |
This file contains 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 '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. |
This file contains 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 '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) |
This file contains 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
<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> |
This file contains 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
<?xml version="1.0"?> | |
<!-- http://jwplatform.com/crossdomain.xml --> | |
<cross-domain-policy> | |
<allow-access-from domain="*" /> | |
</cross-domain-policy> |
This file contains 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 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 |