Tiago Scolari

bits for fun

Speed up your bundler = personal rubygems proxy with cloudfront

2013-10-25
If you think your bundle install takes too long, or have a distributed team around the globe, this may help you. It’s possible to have a cloudfront server pointing to rubygems, and using it as your gems source server. (If you are not aware of what cloudfront is give a look at it) On this configuration, cloudfront will fetch requests from rubygems.org, and keep them cached on the CDN, so you should expect the first bundle install to take very close time of using rubygems. Continue reading

Keeping track of your deploys with capistrano and git

2012-02-19
I’ve created a simple capistrano task to keep track of my deploys. When I deploy to a server, it will create a git tag and push it to origin. This way I can keep track of each deploy revision. after 'deploy:update_code', 'git:create_deploy_tag' namespace :git task :create_deploy_tag do puts "[git] creating new deploy tag" tag_name = "deploy--#{Time.now.strftime("%Y-%m-%d-%H-%M-%S")}" `git tag -a '#{tag_name}' -m 'Deploy: #{Time.now}' origin/production && git push origin --tags` end end p. Continue reading

JQuery-Mobile for Rails 3.1 Gem

2011-09-14
I’ve created a very simple gem that includes the jquery mobile files to Rails’ assets pipeline. To install, just add to your Gemfile: gem 'jquery_mobile_rails' And require the javascript/css files in your manifests: //= require jquery.mobile.min *= require jquery.mobile.min That’s it. No helpers, no methods, only the files in your application assets pipeline. For more information check the github repo.

Mobylette: Mobile Requests Handling (GEM)

2011-09-03
In the last few days have been working on this gem. It’s named Mobylette and it works by identifying mobile requests in your app, and handling them with a new .mobile format. Mobylette’s Github project Mobylette’s Documentation Mobylette on RubyGems.org Once you have it installed on your application, adding respond_to_mobile_requests to your controller will enable it to deal with mobile requests. It will automatically look for a .mobile.erb (.haml, or whatever) when a request comes from a mobile device. Continue reading

Uploadify on Rails, without rack middleware (using devise)

2011-03-31
You can avoid the middleware hack when using flash in rails with logged in users. As you should know, the browser doesn’t share the session with flash. Before using devise, I was using a rack middleware to hack into user session. But there is a much cleaner way if you use devise, you can use the built in feature :authentication_token. More details on how are here.