Skip to content

Instantly share code, notes, and snippets.

Jonathan Church jonchurch

Block or report user

Report or block jonchurch

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 ec2DevSetup.sh
#!/bin/bash
# Basic user preference setup
sudo yum update -y
sudo yum install -y git zsh tmux util-linux-user
cd /home/ec2-user || exit
# oh-my-zsh
@jonchurch
jonchurch / v3.2.0.txt
Created Feb 28, 2020
path-to-regexp pack size
View v3.2.0.txt
npm notice
npm notice 📦 path-to-regexp@3.2.0
npm notice === Tarball Contents ===
npm notice 1.1kB LICENSE
npm notice 10.5kB index.js
npm notice 1.1kB package.json
npm notice 5.5kB History.md
npm notice 9.0kB Readme.md
npm notice 3.7kB index.d.ts
npm notice === Tarball Details ===
@jonchurch
jonchurch / timeoutTest.js
Created Feb 19, 2020
Thinking through timeouts
View timeoutTest.js
const https = require('https');
const options = {
host: 'exoplanetarchive.ipac.caltech.edu',
path: '/cgi-bin/nstedAPI/nph-nstedAPI?table=exoplanets&select=*&format=json',
// apply an initial timeout which will apply to the connect event
timeout: 2000,
};
const beforeRequest = Date.now();
@jonchurch
jonchurch / gqlScratch.js
Created Jan 29, 2020
Scratch for getting Github Issues from a list of orgs
View gqlScratch.js
require('dotenv').config()
const fetch = require('node-fetch')
const GITHUB_GRAPHQL_URL = 'https://api.github.com/graphql'
const headers = { Authorization: `bearer ${process.env.GITHUB_TOKEN}`, 'Content-Type': 'application/json' }
async function getRepoCountForOrg (org) {
const query = `query($org: String!){
organization(login: $org) {
repositories{
totalCount
@jonchurch
jonchurch / 404.txt
Created Jan 23, 2020
404'd links on expressjs.com
View 404.txt
404 - http://nodesecurity.io/advisories/send-directory-traversal
found on:
expressjs.com/ko/advanced/security-updates.html
expressjs.com/de/advanced/security-updates.html
expressjs.com/th/advanced/security-updates.html
expressjs.com/zh-tw/advanced/security-updates.html
expressjs.com/fr/advanced/security-updates.html
expressjs.com/ru/advanced/security-updates.html
expressjs.com/tr/advanced/security-updates.html
expressjs.com/en/advanced/security-updates.html
@jonchurch
jonchurch / faveTalks.md
Last active Oct 11, 2019
My Fave JavaScript Talks
View faveTalks.md

My Fave JavaScript Talks

Ashley Williams - Node Together (2016)

To make NodeJS successful, we need everyone's help. And everyone isn't here.

This talk had a huge impact on me when I was still working in restaurants, listening to podcasts and talks during my shifts, and learning to code at night. Although I'm more privileged than many, I have no college degree and come from a background and industry completely different than most folks in tech. I never dreamt that I could be able to work with the Node.js collaborators. Watching this talk gave me hope that not only could I one day be welcome in the Node community, but that I could be valuable to it. Seeing that people were fighting to create a community that I could participate in moved me so much, and planted a seed in my head which is now bearing fruit after years of hard work. Thank you, Ashley!

Rewatching this talk now is crazy for me, because I see faces in it that I have met and had lovely conv

@jonchurch
jonchurch / instanceOfArrow.js
Created Aug 19, 2019
Using instanceof without throwing on arrow functions
View instanceOfArrow.js
const arrow = () => true;
class ExampleClass {}
const classInst = new ExampleClass();
// this throws
try {
classInst instanceof arrow;
} catch (err) {
console.log("arrow has no prototype", err);
}
@jonchurch
jonchurch / chonkArray.js
Created Jul 23, 2019
Array Chonk (Array chunking)
View chonkArray.js
function chonkArray(array, chonkSize) {
let arrayOfChonks = [];
for (let i = 0; i < array.length; i += chonkSize) {
const chonk = array.slice(i, i + chonkSize);
arrayOfChonks.push(chonk);
}
return arrayOfChonks;
}
const chonkable = ["🍕","🐡","🍝","🐙","✨"]
@jonchurch
jonchurch / for_of.js
Last active Dec 29, 2019
Experimenting with sequential iteration using async/await
View for_of.js
const array = [1, 2, 3];
function sleep(nSeconds) {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(nSeconds), nSeconds * 1000);
});
}
async function run() {
for (const interval of array) {
@jonchurch
jonchurch / yoda.js
Last active Jul 19, 2019
Yoda style eslint rule example code
View yoda.js
/*eslint yoda: "error"*/
const youveBecome = "powerful";
if ("powerful" === youveBecome) {
// yoda style
// value comes before variable
}
if (youveBecome === "powerful") {
// non-yoda
You can’t perform that action at this time.