Skip to content

Instantly share code, notes, and snippets.

View thanpolas's full-sized avatar

Thanos Polychronakis thanpolas

View GitHub Profile
@mikeal
mikeal / gist:9242748
Last active June 23, 2020 05:17
Response to Nodejitsu NPM Trademark

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

@thanpolas
thanpolas / singleton-class.js
Created September 16, 2016 09:45
ES6 Singleton Pattern
/**
* @fileOverview Singleton pattern on ES6.
*/
import logger from './logger.midd';
/**
* The class statement.
*
*/
@mikeal
mikeal / gist:8947417
Created February 12, 2014 00:27
NPM history.

[In reply to https://news.ycombinator.com/item?id=7219005]

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
thanpolas / test.js
Created April 11, 2013 22:00
Testing promises with mocha
var assert = require('chai').assert;
var when = require('when');
var def1 = when.defer();
function getProm() {
return def1.promise;
}
@thanpolas
thanpolas / Gruntfie.js
Last active December 26, 2015 16:48
Grunt Config for node server + livereload
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
express: {
options: {
// Override defaults here
},
web: {
options: {
@briancavalier
briancavalier / settleAll.js
Created March 25, 2013 17:39
Wait for all promises to settle
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);
}
@cowboy
cowboy / Gruntfile.js
Created March 18, 2013 17:21
Sample Gruntfile for gruntjs/grunt#721
'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') {
@balupton
balupton / README.md
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.

Installation

  1. Install Dependencies
@thanpolas
thanpolas / test.js
Created February 13, 2014 13:52
How to test a promise returning async method using Mocha
test('test case', function(done) {
promise.method(function(result) {
assert.equal(result.name, 'mocha');
}).then(done, done);
});
anonymous
anonymous / gist:8730799
Created January 31, 2014 12:01
27ms Created RTCPeerConnnection with: config: '{"iceServers":[{"url":"stun:stun.l.google.com:19302"}]}'; 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 192.168.1.6 61829 typ host generation 0
221ms ICE Candidate. Type:, HOST, Medium:, audio, Candidate:, a=candidate:505434299 2 udp 2113937151 192.168.1.6 61829 typ host generation 0