Software Developer since 1990, Full time Ruby and Ruby on Rails developer, enthusiast, and contributor.
Contact InfoCategories
- GEdit (1)
- git (3)
- Howtos (3)
- Networking (3)
- Programming (4)
- Ruby (2)
- Ruby on Rails (3)
- Servers (1)
- Ubuntu (6)
- Uncategorized (3)
Popular Tags
2wire accents apache bridge click dynamic dns dyndns gems git gnome gutsy Hardy howto humor install internet ip keyring manager la blogotheque linux live mixins music Networking numerical password rails repository routing ruby Ruby on Rails seahorse sed sms source code source management system spanish static ip take-away shows texinfo touchpad ubuntu video wireless youtubeArchive
- August 2009 (7)
- September 2008 (1)
- July 2008 (1)
- June 2008 (1)
- February 2008 (5)
- January 2008 (3)
Author Archives: Ivan Torres
Ubuntu (Hardy): Install Apache 2 Server
August 8, 2009 – 18:04
Setting up Apache 2 server on Ubuntu Hardy is pretty easy.
sudo aptitude install apache2 apache2.2-common apache2-mpm-prefork apache2-utils libexpat1 ssl-cert
Note:
I choose apache2-mpm-prefork (single thread) over apache2-mpm-worker (multi-threaded requests). This is because mod_rails may work with apache2-mpm-worker, but is only currently tested to work with apache2-mpm-prefork.
ServerName
Edit your apache configuration file:
$ vim /etc/apache2/apache2.conf
At the end of the [...]
Ruby: Mixin Template
August 8, 2009 – 07:39
This is the basic structure I use to create a mixin in Ruby:
# = Mixin Template
# == Usage
# ActionController::Base.send :include, MixinModuleName
module MixinModuleName
def self.included(recipient)
recipient.extend(ClassMethods)
recipient.class_eval do
include InstanceMethods
end
end
module InstanceMethods
end
module ClassMethods
[...]
Git: Creating a Remote Branch (and track it locally)
August 8, 2009 – 07:34
Required steps to create and track locally a remote branch with git:
# Create new remote branch
git push origin origin:refs/heads/new_branch_name
# Make sure everything is updated
git fetch origin
# Check your branch has been created
git branch -r
# Track a remote branch
git branch –track new_branch_name origin/new_branch_name
# Checkout remote branch
git checkout new_branch_name
Git: Undo commit
August 8, 2009 – 07:29
Sometimes, when the caffeine no longer works, you can make a mistake on a commit. Either you have second thoughts about your commit message, you just forgot to track new project files, or whatever the reasons are you can always undo your last commit (as long you don’t push it to origin repository):
$ git reset [...]
Gem: Simple Navigation (Navigation menu builder for Ruby on Rails)
August 8, 2009 – 05:57
I’ve just released my new gem simple_navigation. This gem help’s you to create a navigation menu for your Ruby on Rails application.
Installation
Edit your config/environment.rb to setup simple_navigation gem:
config.gem "mexpolk-simple_navigation",
:lib => "simple_navigation",
:source => "http://gems.github.com"
And from the command line, install the plugin:
rake gems:install
Usage
To create your menus create a new [...]
Ruby: Convert Number to Words (Numerical)
August 8, 2009 – 05:07
Recently I’ve published my new gem NumberToWords. This plugin/gem will override Ruby’s Numeric class adding a new method called to_words. For now, it only works for Spanish.
Sample usage:
require ‘rubygems’
require ‘number_to_words’
5678.to_words
=> “cinco mil seiscientos setenta y ocho”
Another common usage is for describing currency quantities:
number = 4567.90
=> 4567.9
number.to_words.capitalize << ‘ pesos ‘ << (number.to_s.split(‘.’)[1] || 0).rjust(2,’0′)
=> "Cuatro [...]
GEdit: Snippets for Ruby on Rails
September 23, 2008 – 01:40
I’ve just created a new GitHub repo with GEdit snippets for Ruby on Rails. Any suggestions and comments are welcome. To install them simply copy the xml files to your ~/.gnome2/gedit/snippets directory.
Refs:
GEdit
GEdit Snippets Plugin
Ubuntu: Disable That Annoying Touchpad Click
July 21, 2008 – 16:01
In my opinion, one of the worse inventions since “PC”, is the annoying (and I’m been respectful) Touchpad. Not only it takes you out of your home row (keyboard), or the fact that you need like two passes for reaching corners. But because it really &*^#$%^*$ annoys me when typing accidentally make a click.
Lucky me… [...]
Git: Adding a Ruby on Rails Project to Git
June 10, 2008 – 19:32
Here’s how to add a recently created Ruby on Rails project to git:
1. Create your new project:
$ rails -d mysql project_name
2. Create some .gitignore empty files so you save the entire structure of your project (git doesn’t include empty folders):
$ touch db/.gitignore lib/.gitignore log/.gitignore tmp/.gitignore vendor/.gitignore
3. Create a new .gitignore file in the root directory [...]