Thursday, September 3, 2009

How to use irssi


# Connect to irc server
/connect irc.freenode.com

# Join a channel
/join #hackerspacesg

# List users in channel
/names

# Switch to next window
CTRL + n

# Switch to previous window
CTRL + p

Tips to use mobileterminal on iPhone

Tips

Hide the Keyboard

Tap twice quickly on the screen to hide the keyboard. Repeat to bring it back.

Control Characters

You can send a control-C by pressing the "bullet" key (First press ".?123", then "#+=", then the circle on the middle right), then press the C key. This can be useful when you want to escape out of a long running program such as ping. Control-C can also be accessed with a short Up-Right and Control is a short Down-Right swipe, after which the cursor will turn highlight red, from here press any character q, x, c, A to complete or the delete button to exit Control mode.

Escape is control-[ or a short Up-Left swip, which may come in handy with vi. Tab is control-I or a short Down-Left swip (yay tab completion).

Swipe Controls

Swipe Type Direction Action
Short Up-Right Control-C
Short Down-Right Control-
Short Up-Left Esc
Short Down-Left Tab
Short up/down/left/right arrow keys (respectively)
Long Up None (functions as up-arrow)
Long Down Enter
Long Left None
Long Right None
Two Finger Up Config
Two Finger Down Hide Keyboard
Two Finger Left Page-Up/Next
Two Finger Right Page-Down/PREV

None of the Two Finger Swipes seem to work right in 2.0 firmware

Multiple Terminals

Terminal comes with four terminal windows. Tap on the battery icon to go right, tap directally on the time to go left, and tap on the carrier name (AT&T or iPod) to crash Terminal (or do a really quick killall Terminal depending on how you look at it).

Wednesday, September 2, 2009

Cucumber feature template

Feature:title

In order to [Business Value]
As a [Role]
I want to [Some Action]

Tuesday, September 1, 2009

Do not use Ruby's Enumerable find() method in Rails

According to ruby doc.


find enumObj.find {| obj | block } -> anObject or nil

Synonym for Enumerable#detect .


However if you ever try to use Enumerable#find in Rails, you'll get a "cannot find object without object id" error.

Better to use Enumerable#detect

The problem with using Rail's try() method


@jasonong Try not to use Rail's try() method; makes debugging
difficult coz error not thrown.

Git: creating, pushing & deleting remote branches

I work on multiple machines. Need temporary remote branches that I can sync them with.

# create remote branch from a local branch
git push origin LOCAL_BRANCH:refs/heads/REMOTE_BRANCH

# push commits to remote branch
git push origin LOCAL_BRANCH:REMOTE_BRANCH

# pull commits from remote brance
git pull origin REMOTE_BRANCH

# delete remote branch
git push origin :REMOTE_BRANCH

Hidden features of Ruby

http://stackoverflow.com/questions/63998/hidden-features-of-ruby