Author Archives: Javier Vidal

Resuming scp after an interruption

It is not possible to make scp resume copying after an interrupted transmission. The good news is you can use rsync over SSH: rsync –rsh=’ssh’ -av –progress –partial source destination

Posted in system administration | Leave a comment

How to change the disabled property in jQuery

If you are using jQuery 1.6 or greater, there is a simple way to change the disabled property in an input field: $("input").prop(’disabled’, true); $("input").prop(’disabled’, false);

Posted in javascript | Leave a comment

Files that have been modified between two git branches

Before merging two branches that have been separated for a while, it is useful to know which files have been modified: $ git diff –name-status branch1..branch2

Posted in git | Leave a comment

How to install PostgreSQL on Ubuntu 12.04

Update your system with this PPA (Personal Package Archives) so you can install an up-to-date version of PostgreSQL: $ sudo apt-get install python-software-properties $ sudo add-apt-repository ppa:pitti/postgresql $ sudo apt-get update And now install PostgreSQL and the dev packages: $ … Continue reading

Posted in system administration | Leave a comment

How to install express on Ubuntu 12.04

Express is a node.js web application framework. Before installing express we need to install node.js and npm (Node Packaged Modules). I recommend you to update your system with this PPA (Personal Package Archives) so you can install an up-to-date version … Continue reading

Posted in javascript | 2 Comments

Skipping asset precompilation in capistrano if the assets did not change

The default capistrano task for compiling the assets compiles them every time, regardless of whether any assets were changed in the set of commits that you are deploying. This is the code snippet I use to check if the assets … Continue reading

Posted in rails | Leave a comment

On-the-fly tar

If you want to copy a directory recursively and preserve exact file timestamps, ownerships, and permissions you can do an on-the-fly tar: cd source-directory tar cf – . | (cd destination-directory; tar xf -)

Posted in system administration | Leave a comment

New feed

I’m going to delete the FeedBurner RSS feed of this blog, so if you want to keep subscribed you will have to re-subscribe to the new feed http://javiervidal.net/feed. Sorry for the inconvenience.

Posted in personal | Leave a comment

Rake task with arguments and :environment

Just a quick tip: desc "Rake task with arguments and :environment" task :task_name, [:arg1, :arg2] => :environment do |t, args| args.with_defaults(:arg1 => "Foo", :arg2 => "Bar") puts "Hello, #{args.arg1}. Bye, #{args.arg2}." end Notes: You may omit the #with_defaults call. You … Continue reading

Posted in rails | 1 Comment

Timestamps with Paperclip and S3

I’m using Paperclip (2.3.11) to upload images to S3 and, as some other people have pointed out, if the content of a file changes but its name remains the same (for example, if you recrop the image), the timestamp added … Continue reading

Posted in ruby | Leave a comment