Latest Entries »

Simple Thrift Tutorial

http://skorage.org/2009/03/08/simple-thrift-tutorial/

A pretty nifty tutorial for a server/client in Java.

WTF is a SuperColumn? An Intro to the Cassandra Data Model

From @stevej: http://arin.me/blog/wtf-is-a-supercolumn-cassandra-data-model

Ruby multiline comments

I had some simple Ruby code that I was trying to comment out:

def my_method(args)
    =begin
    args.each { |k, v| puts "#{k} : #{v}\n" }
    some other code here
    =end
end

syntax error, unexpected ‘=’
=begin
^
syntax error, unexpected ‘=’, expecting kEND
=end
^

After a few minutes, I realized that the =begin and =end should be at the beginning of their line (with absolutely no preceding whitespace):

def my_method(args)
=begin
    args.each { |k, v| puts "#{k} : #{v}\n" }
=end
end

Ruby QuickRef

Another gem from the ruby-talk mailing list: a fabulous Ruby QuickRef sheet!

Tuples in Scala

Very useful for returning multiple values from a function (which I happen to do fairly often).

var a  = (“hello”, 4, 3, true)

is a tuple, and its elements can be accessed through a._1, a._2 and a._3 (indexed at 1, not 0)

Pretty awesome!

Coconut Battery

Coconut Battery

I just found this app, and I love it! I’m always a little anal about whether my computer’s battery life is becoming shorter every day, but Coconut Battery also displays the maximum power of your macbook, and what it should be.

Understanding Ruby blocks, Procs and methods

Understanding Ruby blocks, Procs and methods

Wonderful post on blocks/procs in Ruby!

21 Ruby Tricks You Should Be Using In Your Own Code

21 Ruby Tricks You Should Be Using In Your Own Code

#13 is especially awesome! :-D

Changing process name

From the ruby-talk mailing list, a pretty nifty trick: to change the process/application name (whatever shows up in your Task Manager), all you need is:

$0=”Whatever you want\0”

More bash awesomeness.

I now have smiley/sad faces, depending on whether my previous command executed. :-)

My new bash shell :-)

PS1=”\n`if [ \$? = 0 ]; then echo \[\e[33m\]^_^\[\e[0m\]; else echo \[\e[31m\]O_O\[\e[0m\]; fi`[\[\033[36m\]\t\[\033[m\]] \[\033[32m\]\w\[\033[m\]\$ “

Powered by WordPress | Theme: Motion by 85ideas.