Skip to content

Instantly share code, notes, and snippets.

View mikeal's full-sized avatar
🏠
Working from home

Mikeal Rogers mikeal

🏠
Working from home
View GitHub Profile
for (var key in {one:'two'}) {
if (key === 'one') {
console.log(key)
}
}
@mikeal
mikeal / get-comments.js
Last active June 14, 2022 12:36
The easiest way to get comments out of any code file... seriously?!?
var highlight = require('highlight.js')
var cheerio = require('cheerio')
var strip = ['/', '#', ' ', '*', "<", ">", '-', '\\']
function getComments (str) {
var html = highlight.highlightAuto(str).value
var $ = cheerio.load(html)
var lines = $('span.hljs-comment').map(function(i, el) {return $(this).text();}).get()
return lines.map(function (l) {
@mikeal
mikeal / count-npm-dependencies.js
Created February 16, 2016 00:49
Calculate the average number of dependencies in all modules on npm.
var request = require('request')
, JSONStream = require('JSONStream')
, deps = []
request('https://skimdb.npmjs.com/registry/_all_docs?include_docs=true')
.pipe(JSONStream.parse('rows.*.doc'))
.on('data', function (obj) {
// project against outdated or broken package.json
if (!obj['dist-tags']) return
if (!obj['dist-tags'].latest) return
var mdeps = require('module-deps')
, builtins = require('builtins')
, lodash = require('lodash')
, used = []
;
function filter (id) {
if (builtins.indexOf(id) === -1) return true
used.push(id)
return false
var requestdb = require('requestdb')
, request = requestdb('./hacktoberfest')
, qs = require('querystring')
, noop = function () {}
, http = require('http')
, fs = require('fs')
, access_token = process.env.GHTOKEN
, _ = require('lodash')
, csv = require('csv-parser')
, lines = []
request (49)
underscore (36)
glob (20)
once (19)
lru-cache (15)
optimist (14)
async (14)
minimatch (14)
lodash (13)
node-uuid (13)
@mikeal
mikeal / gist:86920c314a9dd66db86b
Last active August 29, 2015 14:05
ONE-SHOT by NodeConf

ONE-SHOT is a "forkable conference" initially created by the organizer of NodeConf.

The main NodeConf events around the world are rather large productions and require a big commitment of time and financial risk. ONE-SHOT was created as a much simpler single day speaker series event that people around the world can pick up and run without a huge time commitment or considerable financial risk.

That first ONE-SHOT was run in London and events are now planned for Budapest, Brussels, and Oakland.

Ping @mikeal if you'd like to run an event, he'll give you instructions on how to fork the repository which includes the website, CFP instructions, and the Issue tracker can be used to accept talk proposals. Mikeal will also point "your city".nodeconf.com at the property gh-pages CNAME.

package deps maintainers
phpunit/phpunit 7319 sebastian
symfony/framework-bundle 2431 fabpot
illuminate/support 2361 taylorotwell
symfony/symfony 1414 fabpot
mockery/mockery 1386 padraicb
doctrine/orm 1208 beberlei
symfony/console 1127 fabpot
symfony/yaml 1117 fabpot
composer/installers 1115 Seldaek, shama
@mikeal
mikeal / install.bash
Last active January 28, 2020 03:39
Find and install latest node from source on Ubuntu.
#!/bin/bash
echo "Finding latest version."
VERSION=`curl -s http://nodejs.org/dist/latest/SHASUMS.txt | awk '/node-v/ {print $2}' | head -1 | sed s/node-v// | sed s/-/\ / | awk '{print $1}'`
echo "Preparing to install node-v$VERSION"
url="http://nodejs.org/dist/v"$VERSION"/node-v"$VERSION".tar.gz"
echo "GET" $url
curl $url | tar -zxf -
@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