Skip to content

Instantly share code, notes, and snippets.

Stephen Stewart earnubs

Block or report user

Report or block earnubs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Find minimum in array of things:

$ cat gitlab.json | jq '.locationFactors | min_by(.locationFactor)'

Sort by value, reverse:

$ cat gitlab.json | jq '.locationFactors | sort_by(.locationFactor) | reverse

View bitwise-state-thing.js
//(0b001 << 0b010).toString(2)
const isBuilding = 0b001;
const hasFinished = 0b010;
const hasFailed = 0b100;
let combinedBuildState = 0b000;
combinedBuildState = combinedBuildState | isBuilding;
View trycatch.js
const callApi = () => {
const response = fetch(...);
// do stuff with response
return response;
try {
View gist:e59993102aaf52838a1c6347b12aa5cc
yarn list --json | jq '.data.trees[] | select(.name | contains("caniuse-lite"))'
cat charts.json | jq -r '.data[].attributes | [.name, .home, .description] | @csv' | sed 's/"//g' | awk -F, '{ printf "\n%s (%s)\n%s\n",$1,$2,$3}'
earnubs / index.js
Created Mar 29, 2019
date-fns, days of month
View index.js
const df = require('date-fns');
const today =;
const tomorrow = df.addDays(today, 1);
function getWorkDaysInMonth(day) {
return df.eachDay(df.startOfMonth(day), df.endOfMonth(day))
.filter(date => !df.isWeekend(date))
.map(date => df.format(date, 'ddd Do'));
earnubs / docker-ip.js
Created Feb 5, 2019
use dockerode to get container ip address
View docker-ip.js
const Docker = require('dockerode');
const fs = require('fs');
const socket = process.env.DOCKER_SOCKET || '/var/run/docker.sock';
const stats = fs.statSync(socket);
if (!stats.isSocket()) {
throw new Error('Are you sure the docker is running?');
earnubs / Brewfile
Last active May 20, 2019
Bitnami setup
View Brewfile
tap "bazelbuild/tap"
tap "codekitchen/dinghy"
tap "datawire/blackbird"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/cask-versions"
tap "homebrew/core"
cask "osxfuse"
brew "automake"

Keybase proof

I hereby claim:

  • I am earnubs on github.
  • I am earnubs ( on keybase.
  • I have a public key ASDf4O3J1rj_nt3Ct5n09bM6nNSpyguG6ikOmcymDAJ06wo

To claim this, I am signing this object:

earnubs / rg-to-trello.js
Created May 14, 2018
Send rg results to Trello lane
View rg-to-trello.js
#!/usr/bin/env node
const readline = require('readline');
const request = require('request');
const RateLimiter = require('limiter').RateLimiter;
const limiter = new RateLimiter(5, 'second');
const TRELLO_KEY = process.env.TRELLO_KEY;
const TRELLO_TOKEN = process.env.TRELLO_TOKEN;
View .vimrc
set expandtab
set shiftwidth=2
set softtabstop=2
set nu
set path+=**
set clipboard=unnamed
set wildignore+=.git,.DS_Store
set statusline+=%F
set backspace=indent,eol,start
You can’t perform that action at this time.