Skip to content

Instantly share code, notes, and snippets.

View johnathan-sewell's full-sized avatar

Johnathan Sewell johnathan-sewell

  • BLAST
  • Copenhagen
View GitHub Profile
https://googlechrome.github.io/lighthouse/treemap/?gzip=1#H4sIAAAAAAAAE+19e4/cOJLnVzH6j8MdMFkpUu8BBtt22W7XjO32uKq777ELQymxMuVSStmSssrVg/nuR0qZVQpFBJPl7sXt7RoY9NhpkaLIYLzjF//4rtq03/35H9+16te96npV/NRW3/35u03f77o/L5erKuv6s/52WZW3aqn24rs/fXdd1ll1+rFsX5R9Z+bu8rbc9Yu+VWqb7RZF1mfm57LQM1D/9qfv+rKvlP7Xy+Ffn12N//rs5fivhRpHlU2tn/mpU8Wz66Z9dpjjWbbb6Ye6vGn1FPW+qg5/eVl2uyq7f9cUZuqy1mO2Wa8XPEzZZ2U1rLa/35l/n62o1qP0P/+ff3xXZ1t14tNb1TX7Nlcv7nszKBSR/Oef0Ei1P9s1Xb9p1md5s112vV5MvszaNrs/+9zhadIgTII/fbev9/qLD7/5XpzKP32Xb8qqaFU9XeDZGZ4iSSOZuk/RtTkxh0zCGM0RxjE9R/Xbouvbsl6f9cQ3BaEfzuYKhEgmu5U39XVJD/aDyXP7Xp8f+ZjwvCiZvUQk3vQl2b5v8mzX71u14Cfyk9Cff3gIFqG+9KruNF1Sy5BJMF9GEIiE3rY2W6u8KvMbZiXRbCYZTb+nU51ZRas03Rd67y0fJaSUlpH0qfnJfCNEKiaz3KnVYqfa4YbVuSInkZqQ5pMEXjg9+qrZF+TY2Js81jdNtcpa+iVBOL8ywovgB9d9e78o616t28zwFHKiJJjTfOLDHV9v9Uwn54nC+UdHYfDPf5vO1Dfm8Jk9Q5ScCH8y+MBQzOZ3pWbn3Ob7qZzfu1gE9I1gSEB4cxKM43gyw7rYtTa6C9HJhCn9Kc2uohchonh+D4TvS2KSa5WZT7musjW9nCCW6Er5XjSZqlB5WTDH4sVyzhii6X1YZZ1aHETsQv93z2xqMF9DMr0PpyeQPmLvsZ9Or9SByW2V5sk5w+ai6UuNOKSfiw
@johnathan-sewell
johnathan-sewell / server.js
Created November 24, 2019 15:58
GraphQL server showing circular relationship
const { ApolloServer, gql } = require("apollo-server");
const authors = [
{ id: 1, name: "J.K. Rowling" },
{ id: 2, name: "Michael Crichton" }
];
const books = [
{
authorId: 1,
// nice technique for generating arrays for testing
const vintages = Array.from({ length: 15 }, (value, index) => ({
id: index,
year: 1998 + index,
}));
@johnathan-sewell
johnathan-sewell / branchifyBookmarklet.js
Last active October 20, 2017 12:37
branchify bookmarklet
javascript: (function() {
const SEPARATOR = "_";
const issueSubject = document
.querySelector(".subject h3")
.innerText.toLowerCase()
.trim()
.replace(":", "")
.split(" ")
.join(SEPARATOR);
@johnathan-sewell
johnathan-sewell / package.json
Created October 28, 2016 11:03
Example of using npm-run-all to keep NPM scripts neat
{
"name": "takeda.asagao.ui",
"version": "1.0.0",
"description": "UI libarary for Takeda websites",
"main": "index.js",
"scripts": {
"dev": "npm install && npm-run-all --parallel dev:*",
"dev:sass": "sass scss:css blocks:css --watch",
"dev:browser-sync": "browser-sync start --server --startPath /examples/index.html --files \"**/*.html\" \"**/*.razor\" \"**/*.css\" \"**/*.js\"",
"dev:browserify": "browserify examples/js/razor-block-loader.js -o examples/js/razor-block-loader.bundle.js",
{
"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme",
"font_size": 16,
"draw_white_space": "all",
"trim_trailing_white_space_on_save": true,
"ignored_packages":
[
"Vintage"
],
"theme": "Boxy Monokai.sublime-theme"
@johnathan-sewell
johnathan-sewell / tagging.txt
Last active June 9, 2016 09:48
Tagging notes
Make sure your git repository is up to date with master:
git fetch
git checkout master
git reset upstream/master --hard
Use "npm version":
npm version x.x.x
Push the new commit and tag:
git push upstream HEAD --follow-tags
@johnathan-sewell
johnathan-sewell / configLoader.js
Last active June 8, 2016 09:07
Webpack loader for generating configuration from script variables
// Config loader reads command line args (in a build script) and outputs a new config file
// this approach was used to build different versions of a Chrome extension
//configLoader
const replaceCommandLineArgs = require('./replaceCommandLineArgs');
const configTemplate = require('./appConfig');
module.exports = function() {
const config = replaceCommandLineArgs(configTemplate);
return `module.exports = ${JSON.stringify(config)};`;
@johnathan-sewell
johnathan-sewell / redis.conf
Created December 14, 2015 23:01
redis.conf
# A redis config file for development on OSX
# See full config example here: http://download.redis.io/redis-stable/redis.conf
# 1. save this file in /etc/redis.conf
# 2. use an alias to make sure it's always used:
# - in ~/.bashrc add: alias redis-server="redis-server /private/etc/redis.config"
# prevent access from other networks/internet
bind 127.0.0.1
kill -9 $(ps axo pid,command | grep node | awk '{print $1;}')