Skip to content

Instantly share code, notes, and snippets.

Avatar
🇦🇷
Working from home

Geronimo Diaz geronimod

🇦🇷
Working from home
View GitHub Profile
View polling_queue.js.coffee
class @PollingQueue
constructor: (opts) ->
opts || (opts = {})
@queue = {}
@frequency = opts.frequency || 3000 # 3 seconds
@interval = undefined
add: (url, options = {}) ->
return unless url
View status_polling_queue.js.coffee
class @StatusPollingQueue
constructor: () ->
@queue = []
@frequency = 3 * 1000 # 3 seconds
@interval = undefined
@failureLimit = 50
add: (url, options = {}) ->
return unless url
View polling_queue.js.coffee
class @PollingQueue
constructor: () ->
@queue = []
@frequency = 3000 # 3 seconds
@interval = undefined
@failureLimit = 50
add: (url, options = {}) ->
return unless url
View tools.rake
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
bash branch info
View untitled
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 Apr 13, 2016
redirect.pl
View untitled
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
Fog bug in put_bucket_lifecycle
View error.log
(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 Aug 21, 2014
Example of ResqueWeb for RoR 2.3
View resque_web.rb
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
View pseudo.rb
class FLVActivities
extend Activities
activities :generate_flv, :upload_flv
...
end
class ScreenshotActivies
extend Activities
View routes.rb
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'