Skip to content

Instantly share code, notes, and snippets.

View joshbeckman's full-sized avatar
👍

Josh Beckman joshbeckman

👍
View GitHub Profile
var fs = require('fs');
var child_process = require('child_process');
var main = () => {
var excludedFileNames = /\| Hacker News/;
var journal = 'worklog';
fs.readdirSync('.')
.filter(f => f.match(/\.md$/))
.map(f => {
return Object.assign(fs.statSync(f), {
var readline = require('readline');
var jumpEmpty = '▖▘▝'.split('');
var block = '\x1b[31m▖\x1b[0m';
var space = ' ';
var Game = function(options){
if(!(this instanceof Game)) return new Game(options)
options = options || {};
this.width = options.width || 50;
# Let's output to a jpeg file
set terminal jpeg size 500,500
# This sets the aspect ratio of the graph
set size 1, 1
# The file we'll write to
set output "timeseries-narro-10.jpg"
# The graph title
set title "Benchmark testing 1000(10c)"
# Where to place the legend/key
set key left top
import perf from '../lib/perf.js';
const THRESHOLD = 83; // ~ 5 animation frames
const slowLog = (action, duration) => {
(requestAnimationFrame || setTimeout)(() => {
console.warn(`[perf] action ${action.type} took ${duration.toFixed(2)}ms`, {
mean: perf.mean(action.type),
sdev: perf.sdev(action.type),
samples: perf.getEntriesByName(action.type).length,
});
import perf from '../lib/perf.js';
const THRESHOLD = 83; // ~ 5 animation frames
const perfMiddleware = store => next => action => {
perf.start(action.type);
let result = next(action);
perf.end(action.type);
if (perf.duration(action.type) > THRESHOLD) {
console.warn(`[perf] action ${action.type} took ${perf.duration(action.type).toFixed(2)}ms`, {
import log from './log.js';
import __ from './console.sparkline.js';
const debug = log('[perf]');
export const hasPerf = typeof self !== 'undefined' && self.performance;
export const hasPerfNow = hasPerf && self.performance.now;
export const hasPerfMark = hasPerf && self.performance.mark;
let marks = {};
let measures = {};

Keybase proof

I hereby claim:

  • I am andjosh on github.
  • I am jbckmn (https://keybase.io/jbckmn) on keybase.
  • I have a public key ASCqc2nZ1MIOYr3iys0lhzIORv0-z_vq-zEsdnWK52W4rQo

To claim this, I am signing this object:

https://jvns.ca/atom.xml
http://sonniesedge.co.uk/feed.xml
https://eev.ee/feeds/blog.atom.xml
http://feeds.feedburner.com/turkeltaub
https://marco.org/rss2
https://daringfireball.net/feeds/main
http://www.evanmiller.org/news.xml
http://feeds.feedburner.com/codinghorror
http://feeds.feedburner.com/HighScalability
http://www.overcomingbias.com/feed
@joshbeckman
joshbeckman / heroku_multi
Last active July 24, 2017 16:05
Run the same command on multiple Heroku apps via heroku cli
#!/bin/bash
#
# A command to run a heroku CLI command for multiple apps
#
# USAGE
# $ heroku_multi config:set FOO=bar -a app-1 two-app three-apps
#
i=0
position=0
@joshbeckman
joshbeckman / mocha.test.js
Last active October 15, 2016 15:22
Here are some initial tests
var assert = require('chai').assert
var request = require('supertest')
var async = require('async')
var defaults = require('../defaults')
require('../example/app.js')
describe('Mongo-Throttle', function () {
// app.use('/api/', throttle())
describe('With no configs,', function () {
it('should set headers', function (done) {