Skip to content

Instantly share code, notes, and snippets.

View liangzan's full-sized avatar

Wong Liang Zan liangzan

View GitHub Profile
@liangzan
liangzan / .gitconfig
Created April 27, 2011 04:44
git configuration
[giggle]
compact-mode = false
main-window-geometry = 700x562+8+50
[user]
name = Wong Liang Zan
email = [email protected]
[color]
ui = auto
[color "branch"]
current = yellow reverse
@liangzan
liangzan / violate_each.rb
Created May 13, 2011 03:13
violating the each block
foo.items.each do |i|
i.do_whatever
break; # he really placed a semi colon
end
@liangzan
liangzan / .xmobarrc
Created January 19, 2012 23:17
Xmobar configuration
Config { font = "xft:inconsolata:size=10:antialias=true"
, bgColor = "#002b36"
, fgColor = "#657b83"
, position = Top
, lowerOnStart = True
, commands = [ Run Network "wlan0" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: <usedratio>%"] 10
, Run Date "<fc=#93a1a1>%a %b %_d %Y %H:%M</fc>" "date" 10
, Run DiskIO [("/", "IO: <total>"), ("sda4", "<total>")] [] 10
@liangzan
liangzan / gmail_checker.rb
Created January 19, 2012 23:20
Gmail checker for Xmobar
# Gmail checker for Xmobar
#
# Install the ruby-gmail and mime gem to system
# Put the script under ~/path/to/gmail_checker.rb
# Make sure it is executable
require 'gmail'
gmail = Gmail.new('[email protected]', 'password')
mail_count = gmail.inbox.count(:unread)
@liangzan
liangzan / .Xresources
Created January 19, 2012 23:26
Xresources for configuring urxvt
! urxvt
URxvt*buffered: true
URxvt*cursorBlink: true
URxvt*underlineColor: yellow
URxvt*font: xft:inconsolata:size=10:antialias=true
URxvt*depth: 32
URxvt*borderless: 1
URxvt*scrollBar: false
URxvt*loginShell: true
Urxvt*secondaryScroll: true # Enable Shift-PageUp/Down in screen
require 'securerandom'
class User < ActiveRecord::Base
has_many :inquiries
has_many :host_inquiries, :class_name => 'Inquiry', :foreign_key => 'host_id'
validates_presence_of :password
before_save :create_new_password
after_save :certify_if_needed
INQUIRY_LIMIT = 3
@liangzan
liangzan / twitter-bootstrap-responsive-max-width.css
Created March 28, 2012 09:30
sets the max width of twitter bootstrap's responsive layout to 980
.container-fluid {
max-width: 980px;
margin: 0 auto;
}
@liangzan
liangzan / gist:2390523
Created April 15, 2012 06:43
npm install command
npm install notifymode-client socket.io
@liangzan
liangzan / gist:2390665
Created April 15, 2012 07:09
registering an app through command line
notifymode register
@liangzan
liangzan / app.js
Created April 15, 2012 07:10
example socket.io app with notifymode profiler
var app = require('http').createServer(handler)
, io = require('socket.io').listen(app)
, fs = require('fs');
var profiler = require('notifymode-client').Profiler;
app.listen(3000);
function handler (req, res) {
fs.readFile(__dirname + '/index.htm',