Tuesday, September 1, 2009
Monday, August 31, 2009
Open previously closed tabs in Firefox
@cheeaun Hmm.. how do I undo close window on Firefox?
@chuyeow @cheeaun Look in your History menu or hit Cmd-Shift-N.
@sengming @cheeaun on windows and linux its control-shift T. Just
one finger away from add new tab.
Using Mutt to manage your Gmail
sudo apt-get install openssl mutt
# ~/.muttrc
set imap_user = "username@gmail.com"
set imap_pass = "password"
set smtp_url = "smtp://username@smtp.gmail.com:587/"
set smtp_pass = "password"
set from = "username@gmail.com"
set realname = "Your Real Name"
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set postponed="+[Gmail]/Drafts"
set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates
set move = no
# Keymaps
j = next message
k = prev message
/ = search emails
c = change mail folder
Thursday, August 27, 2009
Create & serve a Sinatra app on your iPhone
Taking tips from this article on "Building a iPhone web app in under 50 lines with Sinatra and iUI", I've toyed around with building and serving one right from my iPhone.
Question: So far I've got the V & C in MVC. What's the best way to build the M using Sinatra on iPhone? ActiveRecord?
ssh root@IPHONE_IP_ADDRESS
gem install sinatra -v 0.9.1.1 --no-ri --no-rdoc
# Latest gem needs fcgi gem which cannot be compiled properly
BUILD YOUR sinatra_app.rb
ruby -rubygems sinatra_app.rb
Question: So far I've got the V & C in MVC. What's the best way to build the M using Sinatra on iPhone? ActiveRecord?
Tuesday, August 18, 2009
Search and Replace in VIM
Syntax
Examples
More awesome search and replace tips at http://linux.com/learn/tutorials/8255-vim-tips-the-basics-of-search-and-replace
:s/search/replace/
:[range]s/search/replace/
Examples
# Search & replace in current line
:s/entry/interview
# Search & replace in lines 8 to 10
:8,10 s/search/replace/
# Global search & replace
:%s/entry/interview/g
# Global search & replace with prompt
:%s/entry/interview/gc
More awesome search and replace tips at http://linux.com/learn/tutorials/8255-vim-tips-the-basics-of-search-and-replace
Breaking Cucumber feature tests into separate smaller files
Previous I had the following Cucumber feature tests in a single file
Pretty massive. Why not split them up into manageable bits?
So here's what I think the advantages are:
- Cleaner code in a single file. Well, at least not so chunky!
- Running small number of tests is much FASTER,
- Can still run full quite with proper tagging. ie. @edit_enrollment_details
# features/webrat/edit_enrollment_table
@edit_enrollment_details
Feature: Editing of enrollment details from enrollment table
In order to edit enrollment details easily
As an admin
I want to edit enrollment details from enrollment table
Scenario: Admin should be able to enter entry test date
....
Scenario: Admin should be able to edit entry test date
...
Scenario: Admin should be able to enter entry test status
...
Scenario: Admin should be able to edit entry test status
...
Scenario: Admin should be able to enter interview test date
...
Scenario: Admin should be able to edit interview test date
...
Scenario: Admin should be able to enter interview test status
...
Scenario: Admin should be able to edit interview test status
...
Pretty massive. Why not split them up into manageable bits?
# features/webrat/edit_entry_test_details
@edit_enrollment_details
@edit_entry_test_details
Feature: Editing of entry test details from enrollment table
In order to edit entry test details easily
As an admin
I want to edit entry test details from enrollment table
Scenario: Admin should be able to enter entry test date
...
Scenario: Admin should be able to edit entry test date
...
Scenario: Admin should be able to enter entry test status
...
Scenario: Admin should be able to edit entry test status
...
# features/webrat/edit_interview_test_details
@edit_enrollment_details
@edit_interview_test_details
Feature: Editing of interview test details from enrollment table
In order to edit interview test details easily
As an admin
I want to edit interview test details from enrollment table
Scenario: Admin should be able to enter interview test date
...
Scenario: Admin should be able to edit interview test date
...
Scenario: Admin should be able to enter interview test status
...
Scenario: Admin should be able to edit interview test status
...
So here's what I think the advantages are:
- Cleaner code in a single file. Well, at least not so chunky!
- Running small number of tests is much FASTER,
- Can still run full quite with proper tagging. ie. @edit_enrollment_details
Calendar Date Select gem for Rails
sudo gem install "calendar_date_select"
# config/environment.rb
config.gem "calendar_date_select"
# app/views/layouts/application.erb
<%= calendar_date_select_includes 'silver' %>
# app/views/assessments/_form.html.erb
<%= calendar_date_select_tag 'assessment[schedule]', Time.now, :time => true, :id => 'assessment_schedule' %>
Project homepage: http://code.google.com/p/calendardateselect/
Demos: http://electronicholas.com/calendar
Subscribe to:
Posts (Atom)