Posts tagged programming
Posts tagged programming
0 notes &
A simple way for adding attribute accessors to a class dynamically:
class MyClass
def add_attr(name, value)
self.class.send(:attr_accessor, name)
instance_variable_set("@#{name}", value)
end
end
1 note &
I’m trying to finish the Go Tour and one of the exercises was to write a Fibonnaci closure, that is, a closure that generates the Fibonnaci sequence.
It was a cool exercise to learn on closure works in Go, so to remind myself of this later, I’ll share it here:
0 notes &
One of the best plugins I’ve found for vim is CommandT. It lets you open files in a very speedy and intuitive way, making it very simple to search files and open them in tabs, splits or vertical splits. Or so it should be. On OS X, opening a file on a new split doesn’t really work. You should be able to do it using the Ctrl-S shorcut but it just doesn’t work.
Today I decided to go after this problem. Looking around the net, I found an article explaining the reason:
I found a related tip indicating that by default, Terminal.app reserves Ctrl-S for old-fashioned XON/XOFF flow control.
Ok, so the Terminal app doesn’t allow us to use Ctrl-S because it’s a reserved shortcut. What to do?
Simple, just add the lines below in your ~/.bashrc
stty -ixon -ixoff
It will disable the above behavior and free Ctrl-S and Ctrl-Q for use in terminal apps!
Reminder: Just adding that to your bashrc won’t change the settings in the currently open terminal windows. Type the command above on the terminal so you can have the benefits right now, or reopen all your sessions.
4 notes &
Ruby, the language created by Yuhikiro “Matz” Matsumoto in 1993 has been accepted as and International by the International Standards Organization (ISO) as the ISO/IEC 30170 standard.
The Information technology Promotion Agency (IPA) has developed the draft standard specification document of Ruby and it was registered as the JIS (Japanese Industrial Standard) X 3017 on 2011.
Since 2008 a working group lead by Ikuo Nakata, professor emeritus of University of Tsukuba, has been working on an international standard for Ruby.
Ruby’s acceptance marks also the first time a language developed in Japan is accepted as an international standard.
Ruby was created in 1993 by Yuhikiro “Matz” Matsumoto with the goal of making programming fun[1]:
“I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy. That is the primary purpose of Ruby language.”
My first contact with Ruby was almost 3 years ago, during my Master’s, where many of the students would prefer programming in Ruby, rather than the more well-known perl or python. The reason most fo them gave me is the abundance of documentation in Japanese, as it’s a made in Japan language. (I live in Japan) Under their influence I played a bit with it but nothing really deep. It’ wasn’t until 2010 when I decided to try Rails that I first started to study Ruby more properly. It’s expressiveness and ease of use really stand out. The flexibility given by the fact that everything is an object and the meta-programming features make Ruby a great language for fast prototyping.
This announcement comes together with Matz receiving the FSF’s 2011 Free Software Award.
Congratulations Ruby, congratulations Matz!
Here’s the original announcement, from the IPA (in Japanese):