Skip to content

Instantly share code, notes, and snippets.

View sushiljainam's full-sized avatar
💻
Working from home

Sushil Jain sushiljainam

💻
Working from home
View GitHub Profile
@sushiljainam
sushiljainam / arrayFilters.min.js
Last active December 27, 2016 11:08
object as filter to filter array of objects returning array of lesser objects: minified
Array.prototype.pushUnique=function(t){-1==this.indexOf(t)&&this.push(t)},Array.prototype.filterAny=function(t,n){var r=[];return this.forEach(function(n){for(var i in t)n[i]==t[i]&&r.pushUnique(n)}),"function"!=typeof n?r:void n(r)},Array.prototype.filterAll=function(t,n){var r=[];return this.forEach(function(n){var i=0;for(var o in t)n[o]==t[o]&&i++,i==Object.keys(t).length&&r.pushUnique(n)}),"function"!=typeof n?r:void n(r)};
@creationix
creationix / chatServer.js
Created November 19, 2010 20:47
A simple TCP based chat server written in node.js
// Load the TCP Library
net = require('net');
// Keep track of the chat clients
var clients = [];
// Start a TCP Server
net.createServer(function (socket) {
// Identify this client