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 / 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>
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
AdServer::Application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
get '/wrapper.swf' => 'application#wrapper'
get '/vast.xml' => 'application#vast'
@geronimod
geronimod / pseudo.rb
Created April 10, 2014 13:32
SWF thoughts
class FLVActivities
extend Activities
activities :generate_flv, :upload_flv
...
end
class ScreenshotActivies
extend Activities
@geronimod
geronimod / resque_web.rb
Created August 21, 2014 20:30
Example of ResqueWeb for RoR 2.3
class ResqueWeb
def initialize(app)
@app = app
end
def call(env)
if env['PATH_INFO'].include? '/resque'
resque_web = Rack::Builder.new {
map "/resque" do
@geronimod
geronimod / error.log
Created May 29, 2015 16:17
Fog bug in put_bucket_lifecycle
(byebug) rule['Transition']['Date'].is_a?(Time) ? time.utc.iso8601 : Time.parse(time).utc.iso8601
TypeError Exception: can't convert Nokogiri::XML::Builder::NodeBuilder to String (Nokogiri::XML::Builder::NodeBuilder#to_str gives Nokogiri::XML::Builder::NodeBuilder)
nil
(byebug) time
#<Nokogiri::XML::Builder::NodeBuilder:0x007fc0f1de5828 @node=#<Nokogiri::XML::Element:0x3fe078ef2ca0 name="time">, @doc_builder=#<Nokogiri::XML::Builder:0x007fc0f1dd3538 @doc=#<Nokogiri::XML::Document:0x3fe078ee977c name="document" children=[#<Nokogiri::XML::Element:0x3fe078ee9268 name="LifecycleConfiguration" children=[#<Nokogiri::XML::Element:0x3fe078ee8afc name="Rule" children=[#<Nokogiri::XML::Element:0x3fe078ee828c name="ID" children=[#<Nokogiri::XML::Text:0x3fe078ef9fc8 "Gaclierizer:1">]>, #<Nokogiri::XML::Element:0x3fe078ef1b34 name="Prefix" children=[#<Nokogiri::XML::Text:0x3fe078ef9b18 "1/videos">]>, #<Nokogiri::XML::Element:0x3fe078ef138c name="Status" children=[#<Nokogiri::XML::Text:0x3fe078ef9654 "Enabled">]>, #<Nokogi
Language family Language name Native name 639-1 639-2/T 639-2/B 639-3 Notes
Northwest Caucasian Abkhaz аҧсуа ab abk abk abk
Afro-Asiatic Afar Afaraf aa aar aar aar
Indo-European Afrikaans Afrikaans af afr afr afr
Niger-Congo Akan Akan ak aka aka aka + 2 macrolanguage, Twi is [tw/twi], Fanti is [fat]
Indo-European Albanian Shqip sq sqi alb sqi + 4 macrolanguage
Afro-Asiatic Amharic አማርኛ am amh amh amh
Afro-Asiatic Arabic العربية ar ara ara ara + 30 macrolanguage, Standard Arabic is [arb]
@geronimod
geronimod / deploy.rb
Created October 1, 2011 16:07
Capistrano example config
require "bundler/capistrano" # ejecuta el bundle luego del deployment
# set(var, value)
set :rails_env, "production"
set :application, "example"
set :domain, "www.example.com.ar"
# una mejor explicacion de como trabajan los roles la pueden encontrar en https://github.com/capistrano/capistrano/wiki/2.x-From-The-Beginning
role :app, domain
role :web, domain
def to_csv
header = Product.columns.map(&:name).join(',')
rows = Product.all.map do |record|
returning [] do |row|
Product.columns.each { |c| row << record.send(c) }
end.join(',')
end
[header, rows.join("\n")].join("\n")
end
csv_data = FasterCSV.generate do |csv|
# por ahora todas pero habra que dejar afuera la imagen y los templates html
# headers
csv << Product.columns.map(&:name)
Product.all.each do |record|
csv << Product.columns.map { |c| record.send(c.name) }
end
end