Skip to content

Instantly share code, notes, and snippets.

View mhseiden's full-sized avatar
🏗️

Max Seiden mhseiden

🏗️
View GitHub Profile
@mhseiden
mhseiden / gist:2654497
Created May 10, 2012 17:07
One-liner #1
loc.tid = loc.ns ? ((opts.tid === 0) ? 0 : (opts.tid || "*")) : null;
@mhseiden
mhseiden / HTTP-WS-Proxy.js
Created April 10, 2012 00:39
Lightweight "node-http-proxy" HTTP/WS Proxy Server
// Node Modules
////////////////////////////////////////////////////////////////////////////////
var http_m = require("http");
// 3rd Party Modules
////////////////////////////////////////////////////////////////////////////////
var http_proxy_m = require("http-proxy");
// Utilities
////////////////////////////////////////////////////////////////////////////////
@mhseiden
mhseiden / mdn_bind.js
Created February 9, 2012 18:54
Learning JavaScript's Bind | MDN's Implementation
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== "function") {
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function () {},
fBound = function () {
@mhseiden
mhseiden / NumberTemplate.cpp
Created February 5, 2012 04:09
Very Basic Number Template
template <typename T> class Number
{
public:
Number()
: data(0)
{ }
Number(const T& val)
: data(val)
{ }