Skip to content

Instantly share code, notes, and snippets.

View etagwerker's full-sized avatar
🏠
Working from home

Ernesto Tagwerker etagwerker

🏠
Working from home
View GitHub Profile
#!/usr/bin/env ruby
require 'logger'
$LOAD_PATH.unshift ::File.expand_path(::File.dirname(__FILE__) + '/lib')
require 'resque/server'
# Set the RESQUECONFIG env variable if you've a `resque.rb` or similar
# config file you want loaded on boot.
if ENV['RESQUECONFIG'] && ::File.exists?(::File.expand_path(ENV['RESQUECONFIG']))
load ::File.expand_path(ENV['RESQUECONFIG'])
@etagwerker
etagwerker / unicorn.rb
Created June 27, 2011 05:25
resque-web unicorn.rb configuration
worker_processes 2
working_directory "/u/apps/www.etagwerker.com/current/config/resque-web"
listen "/tmp/resque.etagwerker.com.sock", :backlog => 64
listen 9292, :tcp_nopush => true
timeout 15
user 'deployer', 'deployer'
shared_path = "/u/apps/www.etagwerker.com/shared"
@etagwerker
etagwerker / resqueweb.conf
Created June 27, 2011 06:23
example nginx.conf for a resque-web
upstream resqueweb {
server unix:/tmp/resque.etagwerker.com.sock fail_timeout=0;
}
server {
listen 80;
server_name resque.etagwerker.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
@etagwerker
etagwerker / assets.rb
Created July 8, 2011 12:31 — forked from juggy/assets.rb
env["REQUEST_PATH"] may be nil
ActionController::Base.asset_host = Proc.new { |source, request|
if request.env["REQUEST_PATH"] && request.env["REQUEST_PATH"].include?(".pdf")
"file://#{Rails.root.join('public')}"
else
"#{request.protocol}#{request.host_with_port}"
end
}
@etagwerker
etagwerker / search-and-replace-many-files-mac-os-x
Created July 13, 2011 13:23
search and replace with sed and find for cucumber feature files
find features/*.feature -type f -print0 | xargs -0 sed -i -f 's/And I press "Actualizar"/And I press "Guardar"/g'
@etagwerker
etagwerker / gem-list-for-taps-issue
Created October 10, 2011 23:45
list of gems for issue with taps gem, with heroku db:push
[etagwerker@gesell censo2010]$ gem list
*** LOCAL GEMS ***
addressable (2.2.6)
archive-tar-minitar (0.5.2)
bcrypt-ruby (2.1.4)
capybara (0.4.1.2)
celerity (0.8.9)
childprocess (0.1.9)
@etagwerker
etagwerker / friendly_id_plus_acts_as_nested_set
Created November 22, 2011 20:28
Trying to use friendly_id with acts_as_nested_set
class Category < ActiveRecord::Base
include Liquid::Category
extend FriendlyId
friendly_id :name, :use => :slugged, :slug_column => 'permalink',:slug_generator_class => CategorySlugGenerator
acts_as_nested_set :dependent => :destroy
...
@etagwerker
etagwerker / gist:2417029
Created April 18, 2012 22:21
`rake test` errors on thoughtbot/paperclip
1) Error:
test: A multipage PDF being thumbnailed at 100x100 with cropping should create the thumbnail when sent #make. (ThumbnailTest):
Paperclip::NotIdentifiedByImageMagickError: /Users/etagwerker/Projects/paperclip/test/fixtures/twopage.pdf is not recognized by the 'identify' command.
/Users/etagwerker/Projects/paperclip/lib/paperclip/geometry.rb:29:in `from_file'
/Users/etagwerker/Projects/paperclip/lib/paperclip/thumbnail.rb:35:in `initialize'
/Users/etagwerker/Projects/paperclip/test/thumbnail_test.rb:290:in `new'
/Users/etagwerker/Projects/paperclip/test/thumbnail_test.rb:290:in `block (3 levels) in <class:ThumbnailTest>'
/Users/etagwerker/.rvm/gems/ruby-1.9.2-p290@paperclip/gems/shoulda-2.11.3/lib/shoulda/context.rb:400:in `call'
/Users/etagwerker/.rvm/gems/ruby-1.9.2-p290@paperclip/gems/shoulda-2.11.3/lib/shoulda/context.rb:400:in `block in run_current_setup_blocks'
/Users/etagwerker/.rvm/gems/ruby-1.9.2-p290@paperclip/gems/shoulda-2.11.3/lib/shoulda/context.rb:399:in `ea
@etagwerker
etagwerker / gist:2417037
Created April 18, 2012 22:23
bundle exec cucumber features fails on thoughtbot/paperclip
Failing Scenarios:
cucumber features/basic_integration.feature:11 # Scenario: Filesystem integration test
cucumber features/rake_tasks.feature:14 # Scenario: Paperclip refresh thumbnails task
Because of this:
Feature: Rake tasks
Background: # features/rake_tasks.feature:3
Given I generate a new rails application # features/step_definitions/rails_steps.rb:1
@etagwerker
etagwerker / gist:2420319
Created April 19, 2012 11:15
An in-memory database for a gem for ISO standards
# I'd like an in-memory database to do this
ISO4217.create(:code => 'BBD', :num => '052', :separator_digits => '2', :currency => 'Barbados dollar', :locations => ['Barbados'])
ISO4217.find(:locations => 'Barbados')
=> #<ISO4217:0x007ff62a989b80 @code="BBD" @currency="Barbados dollar">