Archive for the ‘Ruby’

LA Ruby Meetup 6/1906.19.08

LA Ruby Meetup was very cool. So I was the first to be at the scene. I helped bring the food to the room since I was in the lobby and greeted by Jody. I meet and greeted all of the LA Times people. Also meet some guy from Yahoo!, sorry I forgot your name already, and one from heroku, BizQuest another from PGP, and another from Experian. As-well as more but I sorta forgot everyones name already… or at least I can’t remember them, yet.

If you’re in the Los Angeles Area check it out.
Yellowpages.com will be hosting LA Ruby Meetup #2 on July 17 2008, so mark that in your calendar. Join the Yahoo Group, LARuby

Posted in Me, Meetup, Programming, Ruby, Ruby On Railswith 1 Comment →

Something in Ruby05.30.08

#!/usr/bin/env ruby

String.class_eval {
  define_method(:translate_to) do |lang|
    text = case lang
           when :spanish
           Buenos Dias, Como estas hoy?
           when :english
           Good Morning, How are you today?
           else
           I don’t speak any other language.
           end
  end
}

puts Sentence“.translate_to :spanish
# => Prints out “Buenos Dias, Como estas hoy?”

puts Sentence“.translate_to :english
# => Prints out “Good Morning, How are you today?”

puts Setenece“.translate_to :portuguese
# => Prints out “I don’t speak any other language.”

puts Sentence
# => Prints out “Sentence”

So while messing round I made this in Ruby… I’m not sure if it is considered meta programming? Well, it’s just adding a method to the String class. I get confused when to consider things to be meta programming.. Maybe I over think about it.

Posted in Programming, Rubywith 1 Comment →

Heroku Invites05.25.08

Ruby On Rails Heroku Beta Invites

So I received an invite for heroku a while ago. I never really used it. Want an invite to check out heroku.com? I have many invites to give away. Want one? just leave your email and I will send you one your way!

Posted in Ruby, Ruby On Railswith 10 Comments →

Rails on Dreamhost05.21.08

Dreamhost now supports mod_rails Passanger.

Posted in Ruby, Ruby On Railswith No Comments →

Passenger - mod_rails for Apache04.11.08

So even if you have never set-upped a Rails Application to Production server there is still hope for you. Introducing Passenger a mod_rails for Apache… Make it super simple to deploy apps just like PHP. Check it out over at modrails.com 

Posted in Ruby, Ruby On Railswith 2 Comments →

Ruby Technique: Meta Programming03.02.08

Meta Programming is code that writes code. See the code sample below.
I have made a screencast of this process. View it here

#!/usr/bin/env ruby

class Product
  def initialize(items)
    items.each {|item| Product.product(item) }
  end

  def self.product(item)
    code = %Q{
      def add_#{item}(item)
        @#{item} = [] unless @#{item}
        @#{item} << item
      end

      def display_#{item}s
        @#{item}.each {|item| puts item }
      end
    }
    class_eval(code)
  end
end

class Item < Product
  def initialize(*items)
    super(items)
  end
end

cart = Item.new(:book, :computer, :music)
cart.add_book(:Ruby) # => Add a book to our cart items

cart.display_books # => We want to display All books we have added
puts "\n"

cart.add_computer(:Apple)
cart.add_computer(:Dell)
cart.add_computer(:Sony)
cart.display_computers # => Display All Computers
puts "\n"

cart.add_music(’Modest Mouse‘)
cart.add_music(’Northstar‘)
cart.display_musics # => Display All Music Items

Posted in Programming, Rubywith No Comments →

Ruby Code Snippet01.13.08

In Ruby a switch statement looks like this

say = "Hello"

case say
when "Hello" then
	puts "Say Hello"
when "Bye" then
	puts "Say Bye"
end

In PHP a switch statement looks like this


Posted in Programming, Rubywith No Comments →

Ruby MySpace Status Updater01.05.08

I have written a MySpace Status Updater class in Ruby. So if you want it take it, download it, use it.Download Here Or Download the RubyGem 

How do you use it?

credentials = {:username => ”, :password => ”, :status => %q(Okay Now I am really Done!…)}

@status = MySpace.update_status(credentials) 

Posted in Rubywith 2 Comments →


  • I am Fernando Barajas. Mostly known has FernyB.

  • Recent Comments

    • wat: hey fernyb i was just informed that the new pwnage tool is releasing tomrow with installer 4 and the updated...
    • Gaisce1: Fernando, Would it be possible to have the ‘current track’ title displayed in LastBridge as well...
    • Pip: Even after using TextWrangler and inputting my last.fm username there VLC gives me this error message: main: no...
    • Pip: I can give you a call from my phone, if you don’t mind providing some live help. I have copied the file as...
    • Pip: Thanks Fernando for your prompt reply! I am glad you are also a Mac user, but I have to confess that your blog...

    Recent Listened to Tracks

    Loading...

Bad Behavior has blocked 246 access attempts in the last 7 days.

eastern-avalanche
eastern-avalanche
eastern-avalanche
eastern-avalanche