Skip to content

Instantly share code, notes, and snippets.

View earnubs's full-sized avatar

Stephen Stewart earnubs

View GitHub Profile
@earnubs
earnubs / index.js
Created February 10, 2017 21:40
HMR with reach-hot-loader3 and webpack 2
import { AppContainer } from 'react-hot-loader';
import React from 'react';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import { render } from 'react-dom';
import App from './containers/app';
import reducers from './reducers';
// Grab the state from a global variable injected into the server-generated HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script>delete window.fetch;</script>
<script src="https://cdn.rawgit.com/zloirock/core-js/master/client/shim.min.js"></script>
@earnubs
earnubs / rg-to-trello.js
Created May 14, 2018 09:10
Send rg results to Trello lane
#!/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;

Keybase proof

I hereby claim:

  • I am earnubs on github.
  • I am earnubs (https://keybase.io/earnubs) on keybase.
  • I have a public key ASDf4O3J1rj_nt3Ct5n09bM6nNSpyguG6ikOmcymDAJ06wo

To claim this, I am signing this object:

@earnubs
earnubs / snappy-osx-vmware-fusion-howto.md
Last active August 13, 2018 21:09
How to setup Ubuntu Core 16 for developers on OS X with VMWare Fusion

Creating an Ubuntu Core Series 16 image

On VMWare fusion, running an Ubuntu Xenial VM, which has a copy of your OS X public SSH key -- the script to build the image will add it to the generated image -- grab the script at https://github.com/zyga/devtools/blob/master/ubuntu-image to create a new image:

./ubuntu-image.sh --developer-mode pc

Convert .img to .vmdk

qemu-img convert pc-devel.img -O vmdk snappy.vmdk

@earnubs
earnubs / docker-ip.js
Created February 5, 2019 10:18
use dockerode to get container ip address
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
earnubs / .vimrc
Last active February 5, 2019 14:49
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
@earnubs
earnubs / index.js
Created March 29, 2019 20:31
date-fns, days of month
const df = require('date-fns');
const today = Date.now();
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'));
}
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
earnubs / Brewfile
Last active May 20, 2019 11:29
Bitnami setup
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"