Skip to content

Instantly share code, notes, and snippets.

View liangzan's full-sized avatar

Wong Liang Zan liangzan

View GitHub Profile
@liangzan
liangzan / readdir_recursive.js
Created August 10, 2012 09:34
Read directories recursively with Node.js
var fs = require('fs')
, async = require('async')
, _ = require('underscore');
/**
* Utility - for functions that do not belong anywhere
*
* @namespace - utility
*/
var utility = exports;
require 'oauth'
require 'httparty'
require 'etsy'
url = "http://openapi.etsy.com/v2/users/__SELF__"
access_token = "ae84c7ab4ad4b970b1c7ec9ae13fe5"
access_secret = "54116787c5"
etsy_api_key = "akymywrst9yajht2a81756vd"
etsy_shared_secret = "fmj4dgt1lw"
user_id = "18053491"
@liangzan
liangzan / org-mode-line-wrap.el
Created June 16, 2012 03:33
emacs org mode line wrapping
;; add this to your emacs.d
;; wraps the lines in org-mode
(setq org-startup-truncated nil)
@liangzan
liangzan / gist:2390682
Created April 15, 2012 07:12
profile line
var pio = profiler.profile(io);
@liangzan
liangzan / gist:2390681
Created April 15, 2012 07:11
require profiler line
var profiler = require('notifymode-client').Profiler;
@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',
@liangzan
liangzan / gist:2390665
Created April 15, 2012 07:09
registering an app through command line
notifymode register
@liangzan
liangzan / gist:2390523
Created April 15, 2012 06:43
npm install command
npm install notifymode-client socket.io
@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;
}
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