Skip to content

Instantly share code, notes, and snippets.

Josh Johnston joshwnj

Block or report user

Report or block joshwnj

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
View countries-and-timezones.js
const ct = require('countries-and-timezones')
const countries = ct.getAllCountries()
const flatten = (a) => a.reduce((acc, val) => acc.concat(val), [])
const unique = (a) => [...new Set(a)]
const combinations = Object.values(countries).map(country => {
const { id, name } = country
View reason.md

Let me start out by saying that I have zero intention of trying to convince you that my views are right and yours are wrong. Even if that were possible, I don't see how it could possibly be helpful or worthwhile for either of us. I've got no interest in that at all.

What I am interested in doing is answering your question, which relates to my comment that I have good reason for believing what I do. My belief can be summarised in one sentence: that Jesus is who he said he is. Following on from that, I find him the most worthy of admiration of any person I've ever heard about, and so naturally want to know him better, and learn to see the world the way he sees it.

As I said: I don't expect you to accept this as airtight proof that something in history definitely happened (what would

View component.js
// @flow
import React, { PureComponent } from 'react'
import cmz from 'cmz'
import elem from '../utils/elem'
import type { Element } from 'react'
type Props = {
title?: string,
View twitterify.js
document.querySelectorAll('*').forEach(function (a) { a.style['border-radius'] = '50%' })
@joshwnj
joshwnj / write.sh
Created Apr 21, 2017
very simple bash script to write a new blog post
View write.sh
#!/bin/bash
YYYY=$(date +%Y)
MM=$(date +%m)
DD=$(date +%d)
DIR=posts/$YYYY/$MM/$DD
FILE="$DIR/$1.md"
mkdir -p $DIR
echo "# $1" > $FILE
View zkeleton.js
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.zkeleton = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
const upsertCss = require('./lib/upsert-css')
const createName = require('./lib/create-name')
function isName (val) {
if (!val) { return false }
return /^[a-zA-Z][a-zA-Z0
@joshwnj
joshwnj / init.lua
Created Oct 4, 2016
hammerspoon config for window resizing / moving in a grid
View init.lua
local hotkey = require "hs.hotkey"
local grid = require "hs.grid"
grid.MARGINX = 10
grid.MARGINY = 10
grid.GRIDHEIGHT = 3
grid.GRIDWIDTH = 7
local mash = {"cmd", "alt", "ctrl"}
local mashshift = {"cmd", "alt", "ctrl", "shift"}
@joshwnj
joshwnj / example.html
Created Oct 9, 2015
css modules + scoped styles?
View example.html
<div>
<style scoped>
& {
background: #00F;
}
span {
color #FFF;
}
@joshwnj
joshwnj / a.js
Last active Aug 29, 2015
circular dependency
View a.js
var b = require('./b')
console.log('B', b);
module.exports = {
doThingA: function () {
console.log('thing A');
b.doThingB();
}
}
View a.js
var b = require('./b')
console.log('B', b);
module.exports = {
doThingA: function () {
console.log('thing A');
b.doThingB();
}
}
You can’t perform that action at this time.