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 / polling_queue.js.coffee
Last active February 17, 2017 16:05
Polling Queue
class @PollingQueue
constructor: (opts) ->
opts || (opts = {})
@queue = {}
@frequency = opts.frequency || 3000 # 3 seconds
@interval = undefined
add: (url, options = {}) ->
return unless url
@geronimod
geronimod / status_polling_queue.js.coffee
Created January 20, 2017 19:46
Status Polling Queue
class @StatusPollingQueue
constructor: () ->
@queue = []
@frequency = 3 * 1000 # 3 seconds
@interval = undefined
@failureLimit = 50
add: (url, options = {}) ->
return unless url
class @PollingQueue
constructor: () ->
@queue = []
@frequency = 3000 # 3 seconds
@interval = undefined
@failureLimit = 50
add: (url, options = {}) ->
return unless url
@geronimod
geronimod / tools.rake
Created August 4, 2016 18:31
Move s3 assets
bucket = 'intergi-phoenix'
files = S3Util.storage.directories.get(bucket, prefix: '12917/videos/').files
files.each do |file|
path = file.key
video_id = path[/videos\/(\d+)\//, 1].to_i
if video_id < 3270839
puts "skip #{video_id}"
next
@geronimod
geronimod / untitled
Created May 4, 2016 14:36
bash branch info
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/"
}
export BRANCH_INFO='$(parse_git_branch)'
export CURRENT_BRANCH='$BRANCH_INFO'
export PS1="\[\033[00;32m\]\u\[\033[01m\]@\[\033[00;36m\]\h\[\033[01m\] \! \[\033[00;35m\]\w\[\033[00m\]\[\033[00m\] ($BRANCH_INFO)\$ "
@geronimod
geronimod / untitled
Last active April 13, 2016 19:22
redirect.pl
use CGI;
my $q = CGI->new;
$to_host = 'https://www1.udel.edu';
$url = $ENV{'REDIRECT_URL'};
$url =~ s/^https?:\/\/[^\/]+//g;
print $q->redirect($to_host . $url);
@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
@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 / pseudo.rb
Created April 10, 2014 13:32
SWF thoughts
class FLVActivities
extend Activities
activities :generate_flv, :upload_flv
...
end
class ScreenshotActivies
extend Activities
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'