Skip to content

Instantly share code, notes, and snippets.

View kaid's full-sized avatar
🚀
Vibe coding

Kaid Wong kaid

🚀
Vibe coding
  • Beijing, PRC
  • 17:02 (UTC +08:00)
View GitHub Profile
@kaid
kaid / capture_stdout.js
Created February 8, 2012 10:38
capture stdout
var exec = require('child_process').exec;
var capture_stdout = function(cmd, callback) {
exec(cmd, function(err, stdout, stderr) {
callback(err, stdout, stderr);
});
}
module.exports = capture_stdout;
@kaid
kaid / hostel_list_china.rb
Created September 14, 2011 10:59
a script for fetching and parsing hostel list from yhachina.com then process it into a serialized json file
require 'nokogiri'
require 'open-uri'
base = 'http://www.yhachina.com/3g/'
def nopen(page)
Nokogiri::HTML(open(page))
end
doc = nopen(base + 'allthehostel.html')
@kaid
kaid / method_visibility.rb
Created March 25, 2011 05:08
illustrating ruby method visibility machanism
class Bla
def a
"a"
end
def b
self.a
end
def c