January 2012
1 post
Command-Line Javascript (CLI) On Mac OS-X →
December 2011
1 post
6 tags
Configurar el Huawei E1756 de Movistar en Mac OS X...
Movistar no da soporte para el uso de su Internet Móvil en Mac OS X 10.7 (Lion), solamente soportan desde 10.4 hasta 10.6. Sin embargo, si funciona, he aquí lo que yo hice para configurarlo:
De la página de Movistar sigues las instrucciones para descargar e instalar el Escritorio Movistar.
Cuando lo instales es muy probable que te de un error como me ocurrió a mi
No te preocupes, hazle un...
November 2011
3 posts
5 tags
Rails 3 :: Not abandon sending mail within...
In ActionMailer (Rails 3) you can’t decide not to send an email. For instance, you have the following mailer:
class FooMailer < ActionMailer::Base
def bar_email
if some_condition
mail(...)
else
# Can I do nothing? No :-(
end
end
end
If you invoke FooMailer.bar_email.deliver!, when same_condition is false you will get the following error:
ArgumentError: A...
How to link your git project with an existing...
To add your Heroku application as a remote in your git repository, use the following command:
git remote add heroku-remote git@heroku.com:project.git
Where project.git is your heroku application, and heroku-remote the name you want for the remote, in my case I usually have several remotes, one for production, staging and dev
3 tags
Introduccion a NoSQL
Esta es la presentacion que di en el BogotaConf (@bogotaconf) sobre NoSQL
October 2011
3 posts
3 tags
SublimeText2 - Check ruby syntax after save
Edit the file: /path/to/SublimeText2/Packages/Ruby/Ruby.sublime-build to contain this:
{
"cmd": ["/path/to/ruby/bin/ruby", "-cw", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.ruby"
}
Then create the following file /path/to/SublimeText2/Packages/User/ruby_check.py:
import sublime, sublime_plugin
class rubyCheck(sublime_plugin.EventListener):
def...
I’m still a work in progress
– from: me
to: my future me
All things in the universe start from a point and return to a point. One point...
– Lee Ufan
September 2011
10 posts
1 tag
Git pull from a wrong branch?
If you’re working in your feature-branch:
git checkout feature-branch
and by mistake you pull from a wrong branch (usually master or develop):
git pull origin different-branch
You can fix it with this:
git reset --hard origin/feature-branch
3 tags
How to return a real empty response in Rails
I’m building a JSON API using rails. In several places I only need to send a 200 http code, without response body.
So, I used the head method:
head :ok
But this returns a response body with one blank character, this single space body causes the mobile client to fail (parse error). Below the response (notice the Content-Length):
HTTP/1.1 200 OK
Server: nginx/0.7.67
Date: Tue, 06 Sep 2011...
2 tags
Evolution of Piictu
2 tags
Piictu is Twitter for pictures, no typing allowed →
With Noah (left) at Techstars
Article by Business Insider
3 tags
Drop a database in MongoDB
If you want to delete a database named ‘dummy_db’ just do this:
$ mongo
> use dummy_db
switched to db dummy_db
> db.dropDatabase()
{ "dropped" : "dummy_db", "ok" : 1 }
4 tags
Developing Apps for iOS (free Stanford course) →
3 tags
Using github compare view to generate change log...
Github’s ‘compare views’ feature is owosome! I use a lot, in particular to generate change log for releases.
The Compare View URL structure is:
http://github.com/edgar/<repository>/compare/<start branch>...<end branch>
More info in:
https://github.com/blog/612-introducing-github-compare-view
5 tags
How to configure you Google App account in Empathy...
Recently I try to added mi Google App account to Empathy (chat client for linux), but wasn’t works at the first try, so I tried different settings and the trick is just “Ignore SSL certificate errors”
Now my setup is:
Login ID: [my full e-mail address]
Advanced
Encryption required (TLS/SSL): checked
Ignore SSL certificate errors: checked
Override server settings
Server:...
4 tags
"Building mobile applications" free course from... →
August 2011
2 posts
3 tags
How compare versions strings in ruby
There is a lot of way to compare versions strings in ruby, for instance you turn each version string in to an array of integers and then use the array comparison operator. But I prefer this one:
Gem::Version.new('0.3.2') < Gem::Version.new('0.10.1')
Any fool can write code that a computers can understand. Good programmers write...
– Martin Fowler
July 2011
4 posts
5 tags
MongoDB how to compare two IDs fields on same...
To compare two fields on same document in MongoDB you can use a $where (just be aware it will be fairly slow, has to execute Javascript code on every record) :
db.my_collection.find( "this.fieldA > this.fieldB" } );
(check this thread on StackOverflow)
In my case I want to find all the documents where a field id_A is equal to field id_B, so I tried this:
db.my_collection.find(...
5 tags
Rails 3 tip: how to reload libs in development... →
How is it that you do not?
Dialog from Kung Fu (TV serie 1972-1975) first chapter
“Master Po: Close your eyes. What do you hear?
Kwai Chang Caine: I hear the water, I hear the birds.
Master Po: Do you hear your own heartbeat?
Kwai Chang Caine: No.
Master Po: Do you hear the grasshopper that is at your feet?
Kwai Chang Caine: Old man, how is it that you hear these things?
Master Po: Young man, how is it that...
U2 in Sun Life Stadium, Miami (29/06) – Setlist
Space Oddity (David Bowie song) (Intro music)
Even Better Than The Real Thing
The Fly
Mysterious Ways
Until The End Of The World
I Will Follow
Get On Your Boots
I Still Haven’t Found What I’m Looking For (with “The Promised Land” snippet)
North Star (first time played in North America)
Beautiful Day (with “Space Oddity” snippet)
Elevation
...
June 2011
2 posts
1 tag
6 tags
Resque :: How to clear old workers from Redis
In a Rails 3 application we’re using resque for background jobs. Because we’re running on heroku, with new deploys sometimes appears “phantom” resque workers in resque-web, this “phantom” workers are old workers that running on a previous EC2 instance that currently is terminated, so the phantom workers really don’t exist but the keys are still in Redis.
...
May 2011
7 posts
3 tags
How to change the urls used by RVM to install...
Recently @zeitan and @betacar ask me about how to change the urls used by Ruby Version Manager (RVM) to install the different rubies and rubygems
They need this because their organization’s firewall avoid RVM install rubies and rubygems direct from internet, so they will store locally in their organization the different versions of ruby and rubygems, and need to configure RVM install to use...
6 tags
rake aborted! undefined method `task' in rails...
If you are getting this error when you run any rake task in rails 3.0.7:
$ rake
rake aborted!
undefined method `task' for #MyApp::Application:0x92113b6c
The problem is rake 0.9.0. The simple fix is temporarily downgrade rake in order to avoid it:
$ gem uninstall rake -v 0.9
$ gem install rake -v 0.8.7
Then, edit the Gemfile and add the line:
gem 'rake', '0.8.7'
And run the command:
$ bundle...
3 tags
Find errors in your iOS app before your users do! →
3 tags
A few MongoDB ObjectId tricks →
Piictu to pitch at The Founder Conference
piictu:
Exciting news! Piictu is going to be pitching at The Founder Conference tomorrow in Mountain View. It’s going to be Piictu’s premiere. At 2.15pm we will be on stage for a 1-minute pitch.
To signal this event, we will give away a limited number of invitations for Piictu’s private beta.
Look for us if you are attending The Founder Conference. We will be happy to demo the app for you, and...
March 2011
1 post
February 2011
12 posts
5 tags
RMagick install on Ubuntu 10.10
This works on Maverick (10.10):
$ sudo apt-get install imagemagick graphicsmagick
$ sudo apt-get install libmagickcore-dev libmagickwand-dev
$ gem install rmagick
6 tags
How to install MongoDB in Ubuntu 10.10
10gen publishes apt-gettable packages for MongoDB, those packages are generally fresher than those in Ubuntu.
So, to install MongoDB from 10gen packages do this:
Add MongoDB repository into Ubuntu
Add the following line to /etc/apt/source.list file:
deb http://downloads.mongodb.org/distros/ubuntu 10.10 10gen
Create PGP key and Install MongoDB
We need to generate key to gain access into...
4 tags
How to made rvm install rubygems 1.5.2 from...
I’m experiencing some troubles when rvm try to install rubygems 1.5.2
The problem is because rvm try to install rubygems from rubyforge.org and I’m facing timeouts trying to reach the file.
If you run rvm debug you will see the current settings rvm is using, in my case:
$ rvm...
7 tags
Replacing fixture generation on Rails 3
Because I don’t like fixtures (I use factory_girl), I change my Rails generators to generate factories instead of fixtures
To do this, just add this to your config/application.rb:
config.generators do |g|
g.test_framework :test_unit, :fixture_replacement => :factory_girl
end
But in my case, because I prefer rspec instead of test_unit, I use this:
config.generators do |g|
...
5 tags
A very nice RSpec formatter →
Fuubar is an RSpec formatter that uses a progress bar instead of a string of letters and dots
10 tags
RSpec with Mongoid
If you are using Mongoid as ORM and RSpec for testing maybe you are interested in use the mongoid-rspec gem.
mongoid-rspec provide several RSpec matchers and macros for Mongoid.
If you are using the new master branch of Mongoid (which is my case), probably you are facing this error when try to run your specs (rake spec):
no such file to load -- mongoid/associations (LoadError)
This is because...
5 tags
Disable start of a service on boot in Ubuntu
For instance, I don’t want that MongoDB automatically starts on boot:
$ sudo update-rc.d -f mongodb remove
Removing any system startup links for /etc/init.d/mongodb ...
/etc/rc0.d/K20mongodb
/etc/rc1.d/K20mongodb
/etc/rc2.d/K20mongodb
/etc/rc3.d/K20mongodb
/etc/rc4.d/K20mongodb
/etc/rc5.d/K20mongodb
/etc/rc6.d/K20mongodb
3 tags
Don't see the Call phone feature in Gmail ?
@JessyCarrillo trying to use the Call Phone feature in her Gmail, discover this:
Don’t see the Call phone feature? At this time it’s only available for use in the United States. Please ensure that your Gmail interface language is set to English (US).
So, she change her Gmail interface language from Spanish to English(US), and now she can call from Gmail
5 tags
Ranking of Best PSD To HTML Companies →
5 tags
Why rails bundler doesn't install gems inside a...
As usual I have several gems in bundler groups called :development and :test.
My Gemfile looks like this.
source 'http://rubygems.org'
gem 'rails', '3.0.3'
gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'paperclip'
gem 'aws-s3'
gem 'rack-cors', :require => 'rack/cors'
gem 'will_paginate', '~> 3.0.beta', :require => 'will_paginate'
group :test, :development do
gem "rack-test",...
7 tags
Errors uploading images from ASIHTTPRequest in...
We just went through a painful debug session related to erratic timeouts and "Bad content body" errors when we try to upload images from an iPhone application to Rails 3 application hosted on Heroku.
The iPhone application uses ASIHTTPRequest, checking the Google Groups we found that the issues are related to Persistent Connections, the solution that worked for us was:
[request...
January 2011
5 posts
3 tags
A setup script to get Ruby and Rails running on... →
How I test a file upload in Rails 3
In previous version of Rails I used ActionController::TestUploadedFile.new to test file uploads, but in Rails 3 you have to use Rack::Test::UploadedFile.new
The file object that is created can then be used as a parameter in Rspec, TestUnit or Cucumber
Below a Test example:
test "avatar upload" do
avatar_filename = path-to-fixtures-image + "/avatar.jpg"
file =...
7 tags
REST API v01 for piictu mobile applications
This was a great week at work, we delivered the REST API v01 for piictu mobile applications in one week =)
Builded in Rails, hosted on Heroku and using Amazon S3 for picture storage
4 tags
Efficient Rails Test-Driven Development
There are six videos that teaches you how to test in Rails, by Wolfram Arnold:
Class 1 of 6
Class 2 of 6
Class 3 of 6
Class 4 of 6
Class 5 of 6
Class 6 of 6