Skip to content

Instantly share code, notes, and snippets.

View mikeal's full-sized avatar

Mikeal Rogers mikeal

View GitHub Profile
@mikeal
mikeal / bread.md
Created February 7, 2017 04:29
My Bread

| Ingredient | Measure | Baker's Percentage | | Sifted White Flour (Red Fife) | 500g | 100% | | Water | | 70% | | Active Levain | 100g | 20% | | Salt | 11g | | |

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 -