Skip to content

Instantly share code, notes, and snippets.


Thanos Polychronakis thanpolas

View GitHub Profile
anonymous / gist:8730799
Created January 31, 2014 12:01
View gist:8730799
27ms Created RTCPeerConnnection with: config: '{"iceServers":[{"url":""}]}'; constraints: '{"mandatory":{"OfferToReceiveAudio":true,"OfferToReceiveVideo":true}}'.
85ms onSignalingStateChanged() ::, signalingstatechange
86ms Set session description success.
221ms ICE Candidate. Type:, HOST, Medium:, audio, Candidate:, a=candidate:505434299 1 udp 2113937151 61829 typ host generation 0
221ms ICE Candidate. Type:, HOST, Medium:, audio, Candidate:, a=candidate:505434299 2 udp 2113937151 61829 typ host generation 0
thanpolas / test.js
Created February 13, 2014 13:52
How to test a promise returning async method using Mocha
View test.js
test('test case', function(done) {
promise.method(function(result) {
assert.equal(, 'mocha');
}).then(done, done);
balupton /
Last active October 11, 2015 18:08
DocPad: Minify your assets with Grunt

DocPad: Minify your assets with Grunt

The following will minify your assets with grunt each time a generation write completes.


  1. Install Dependencies
cowboy / Gruntfile.js
Created March 18, 2013 17:21
Sample Gruntfile for gruntjs/grunt#721
View Gruntfile.js
'use strict';
module.exports = function(grunt) {
// Override process.stdout to log the name+args of the current task before
// every logged line.
var hooker = require('hooker');
var newline = true;
hooker.hook(process.stdout, 'write', function(str) {
var prefix = grunt.task.current.nameArgs;
if (newline && prefix && str !== '\n') {
briancavalier / settleAll.js
Created March 25, 2013 17:39
Wait for all promises to settle
View settleAll.js
function settleAll(array) {
return when(array, function(array) {
var i, len, results;
results = [];
for(i = 0, len = array.length; i < len; i++) {
if(i in array) {
results[i] = when(array[i], null, identity);
thanpolas / Gruntfie.js
Last active December 26, 2015 16:48
Grunt Config for node server + livereload
View Gruntfie.js
module.exports = function (grunt) {
express: {
options: {
// Override defaults here
web: {
options: {
thanpolas / test.js
Created April 11, 2013 22:00
Testing promises with mocha
View test.js
var assert = require('chai').assert;
var when = require('when');
var def1 = when.defer();
function getProm() {
return def1.promise;
mikeal / gist:8947417
Created February 12, 2014 00:27
NPM history.
View gist:8947417

[In reply to]

Here's the history, hope it helps.

I wrote the original version of the npm registry in a day or two on top of CouchDB. I built it quickly and didn't think much about scale.

Isaacs continued to improve and maintain that code. At one point he even wrote up an open standard for generic js package registries for CommonJS but they didn't seem to care (they were too busy arguing about promises).

At the time I wrote the initial code I was employed at CouchOne and we had a small CouchDB hosting platform operated by Jason Smith which is where we ran the registry free of charge. Later on, after CouchOne was aquired by Membase and became Couchbase, it decided to break off the hosting company and give/sell it to Jason Smith, which became IrisCouch.

thanpolas / singleton-class.js
Created September 16, 2016 09:45
ES6 Singleton Pattern
View singleton-class.js
* @fileOverview Singleton pattern on ES6.
import logger from './logger.midd';
* The class statement.
mikeal / gist:9242748
Last active June 23, 2020 05:17
Response to Nodejitsu NPM Trademark
View gist:9242748

I've known people at nodejitsu for years, since before the company even existed. I still consider many of them friends. That said, somebody over there has lost their mind.

Trademarks are an important part of open source. They protect the integrity of the trust that is built by any project. A classic example of why this is the case is Firefox. Suppose that a malware producer takes the Firefox codebase, which is free and open source, packages up their malware with it and then releases it as "Firefox". Then they buy search advertising and suddenly their bad and malicious version of Firefox is the first result on search engines across the web. This is clearly a bad thing for Firefox and open source everywhere, but what can Mozilla do to protect their community of users?

They can't enforce a software license since the use is permitted under the Mozilla Public License. They can, however, enforce on these hypothetical bad actors using their trademark on the word "Fi