Skip to content

Instantly share code, notes, and snippets.

View jonathanconway's full-sized avatar
⌨️
Typing

Jonathan Conway jonathanconway

⌨️
Typing
View GitHub Profile
@jonathanconway
jonathanconway / .prettierrc
Created March 18, 2024 10:12
Handy sensible defaults for prettier including import ordering and grouping
{
"tabWidth": 2,
"useTabs": false,
"singleQuote": false,
"importOrder": ["^[@]?[a-zA-Z]", "^[@/a-zA-Z]", "^../", "^./"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"plugins": ["@trivago/prettier-plugin-sort-imports"]
}
alias subl='open -a "Sublime Text"'
alias l="ls -la"
/**
* Enum which supports attached methods.
* Each method's `this` is the enum object.
*/
class Enum {
/**
* @param items {Object} Enum keys and values as a plain object
* @param methods {Object} Enum methods as a plain object
* (names are keys, values are methods)
*/
@jonathanconway
jonathanconway / create-react-app-minimal.sh
Last active May 13, 2018 13:47
Minimalist create-react-app. Just enough to write a failing unit-test. 🔴 ✅
################################################################################
#
# 1. Save this file to /usr/local/bin
#
# 2. To make it executable: chmod u+x /usr/local/bin/create-react-app-minimal.sh
#
# 3. To create your app: create-react-app-minimal {app-name}
#
# 4. In your package.json, change this line:
# "test": ...

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@jonathanconway
jonathanconway / docker-nuke
Last active June 16, 2022 19:59
Nuke all docker images and containers ☢️
#!/bin/bash
docker rm --force $(docker ps --all -q)
docker rmi --force $(docker images --all -q)
@jonathanconway
jonathanconway / genbash
Created May 17, 2017 05:32
Generate an executable bash script
#!/bin/bash
echo #!/bin/bash > $0
chmod u+x $0 # set permissions so that it's to be executable
@jonathanconway
jonathanconway / Timer.js
Created April 5, 2017 07:45
React wrapper for setTimeout ⏲
import React, { PureComponent, PropTypes } from 'react';
export default class Timer extends PureComponent {
static propTypes = {
interval: PropTypes.number,
onExpiry: PropTypes.func
};
constructor(props) {
super(props);
@jonathanconway
jonathanconway / mov2gif
Last active August 11, 2023 08:20
Convert QuickTime screencasts to animated GIFs using ffmpeg
#!/bin/bash
# Inspired by solution by StackOverflow user #18664.
# [See: https://apple.stackexchange.com/a/211219/97498]
#
# Usage:
# gif [filename]
#
# filename - name of a .mov file to convert, excluding .mov extension
@jonathanconway
jonathanconway / midi
Created November 29, 2016 05:23
Plays a midi file. Bash script that calls FluidSynth with SoftSynth sound-bank on a midi file, to play it through the system audio.
#!/bin/bash
exec fluidsynth -i /Library/Audio/Sounds/Banks/GeneralUser\ GS\ v1.47.sf2 $1