Skip to content

Instantly share code, notes, and snippets.

View luozhihua's full-sized avatar

Colin Luo luozhihua

View GitHub Profile
@luozhihua
luozhihua / auto-restart-nodejs-process
Last active August 7, 2022 06:21
Auto restart nodejs process when program exit
var child_process = require('child_process');
start();
function start(nodefile) {
if (typeof start !== 'string') {
console.log('Has none file. like this: start("app.js")');
}
console.log('Master process is running.');
@luozhihua
luozhihua / Function-inherit.js
Created August 1, 2013 13:41
JavaScript inherit solution
;(function(){
function do_inherit(cls_1, parent_1, opt) {
var inherited = is_inherited.call(this, cls_1, parent_1),
parent = typeof parent_1 === 'function' ? new parent_1(opt) : parent_1;
if (!cls_1.supperclass || !inherited) {
cls_1.supperclass = parent_1;
cls_1.prototype = tbc.extend(parent, cls_1.prototype, {
/**