Skip to content

Instantly share code, notes, and snippets.

View normanzb's full-sized avatar
🛵
stay safe

Norman X normanzb

🛵
stay safe
  • Somewhere decentralised
  • London
View GitHub Profile
/*
** Modification by Norman Xu
** Based on :
** Peteris Krumins (peter@catonmat.net)
** http://www.catonmat.net -- good coders code, great reuse
**
** A simple proxy server written in node.js.
**
*/
{
objective: 'Seeking for a job as \
Tester or Web Developer',
name: 'Norman Xu',
birthday: '1984-06-16',
isMale: true,
mail: 'i@qusi.org',
cellphone: '18653139979'
}
@normanzb
normanzb / yield.js
Created April 28, 2011 03:53
the C# 'yield' implementation in javascript
// the C# 'yield' implementation in javascript
!function(){
window.yield = function(func){
this._bodyFunc=null;
};
var p = yield.prototype;
p.body = function(func){
this._bodyFunc = func;
@normanzb
normanzb / chainit.js
Created April 28, 2011 03:55
chain-style all
!function(undef){
"use strict";
var noConflict = null;
var chn = function(obj){
return new wrapperCtor(obj);
};
chn.noConflict = function(){
if (noConflict){
@normanzb
normanzb / gist:1278677
Created October 11, 2011 16:59
transcirpt
transcript for http://v.youku.com/v_show/id_XMTczMDI1MTAw.html
biology before becoming a comedian
pls welcome very funny joe wong
[applauds]
hi everybody
@normanzb
normanzb / gist:1332642
Created November 2, 2011 01:54
Memory Usage Comparison - OO
var ObjectContainer = [];
var HOW_MANY_OBJ = 100000;
var memoryHolder;
function Heavy (){
this.load = function(){
var str =
'gabagesgabagesgabagesgabagesgabages';
for(var i = 0; i < 9999; i++){
str+=str;
@normanzb
normanzb / gist:1332776
Created November 2, 2011 03:29
Memory Usage Comparison -- OO (Knockout Style)
var ObjectContainer = [];
var HOW_MANY_OBJ = 100000;
var memoryHolder;
function Heavy (){
var ret=function(){};
ret.load = function(){
var str =
'gabagesgabagesgabagesgabagesgabages';
for(var i = 0; i < 9999; i++){
@normanzb
normanzb / gist:1580772
Created January 9, 2012 02:51
auto order
var foobar2 = jQuery('#main')[0].contentWindow;
var hack = {};
hack.config = {
today: '2012-01-08',
date: '2012-01-20',
from: 'SMS',
fromText: '三明',
toText: '上海南',
to: 'SNH',
@normanzb
normanzb / gist:1625280
Created January 17, 2012 06:51
javascript that doesn't suck
// run it on http://css3.bradshawenterprises.com/demos/speed.php?rows=100
var wrapper = jQuery('#jquery').appendTo(document.body),
divset=jQuery('#jquery div').toArray();
var astop = false, render=false , hex=0;
!function () {
if (astop) return;
if (render) render();
setTimeout(arguments.callee, 0)
}();
@normanzb
normanzb / server.js
Created April 9, 2012 10:00
streaming server on ubuntu
// Original article http://delog.wordpress.com/2011/04/26/stream-live-webm-video-to-browser-using-node-js-and-gstreamer/
var express = require('express'),
net = require('net'),
child = require('child_process');
var app = express.createServer(), socket, header = [];
var server = net.createServer( function(s){
socket = s;