Skip to content

Instantly share code, notes, and snippets.

View rdmurphy's full-sized avatar
🔴
Red pandas are the best.

Ryan Murphy rdmurphy

🔴
Red pandas are the best.
View GitHub Profile
#!/bin/bash
cd $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
blue=$(tput setaf 4)
green=$(tput setaf 2)
normal=$(tput sgr0)
while ./update.sh
do
printf "\n${blue}>>> sleeping a little bit before running again... ${normal}\n"
@samthor
samthor / safari-nomodule.js
Last active April 26, 2025 20:41
Safari 10.1 `nomodule` support
// UPDATE: In 2023, you should probably stop using this! The narrow version of Safari that
// does not support `nomodule` is probably not being used anywhere. The code below is left
// for posterity.
/**
* Safari 10.1 supports modules, but does not support the `nomodule` attribute - it will
* load <script nomodule> anyway. This snippet solve this problem, but only for script
* tags that load external code, e.g.: <script nomodule src="nomodule.js"></script>
*
* Again: this will **not** prevent inline script, e.g.:
@onyxfish
onyxfish / README.md
Created March 30, 2017 14:06
Import the entire Bureau of Labor Statistics (BLS) Quarterly Census of Wages (QCEW) dataset into a PostgreSQL database

QCEW Data Loader

These scripts import the entire Bureau of Labor Statistics Quarterly Census of Employement and Wages (from 1990 to latest) into one giant PostgreSQL database.

The database created by this process will use about 100GB of disk space. Make sure you have enough space available before you start!

Configuration

Database name, table name, and more can be configured via config.sh.

@tmcw
tmcw / language-families.md
Created March 14, 2017 19:42
Language families gist post

I've been implementing more and more of my free-time hacks in Elm. Elm is, in many ways, a much better language that JavaScript. Experienced Elm hackers claim major productivity improvements and with a grain of salt, I believe them. Elm's documentation is great, its tooling is excellent, and there are plenty of examples.

It takes me about 10 times longer to implement anything in Elm than in JavaScript.

Sometimes I think that would be a good, honest tagline for any sufficiently new

@tmcw
tmcw / ticks.js
Created September 26, 2016 18:59
import * as d3 from 'd3';
import React from 'react';
const top = 1;
const right = 2;
const bottom = 3;
const left = 4;
const epsilon = 1e-6;
function translateX(scale0, scale1, d) {
@nolanlawson
nolanlawson / rollup_with_all_the_trimmings.js
Created August 29, 2016 22:28
Rollup with all the trimmings
const rollup = require('rollup')
const nodeResolve = require('rollup-plugin-node-resolve')
const commonjs = require('rollup-plugin-commonjs')
const json = require('rollup-plugin-json')
rollup.rollup({
entry: 'index.js',
plugins: [
json(),
nodeResolve({
@armollica
armollica / .block
Last active May 2, 2019 08:22
HTML Annotation
height: 960
@Rich-Harris
Rich-Harris / service-workers.md
Last active May 3, 2025 12:49
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@joshdover
joshdover / README.md
Last active September 28, 2023 21:38
Idiomatic React Testing Patterns

Idiomatic React Testing Patterns

Testing React components seems simple at first. Then you need to test something that isn't a pure interaction and things seem to break down. These 4 patterns should help you write readable, flexible tests for the type of component you are testing.

Setup

I recommend doing all setup in the most functional way possible. If you can avoid it, don't set variables in a beforeEach. This will help ensure tests are isolated and make things a bit easier to reason about. I use a pattern that gives great defaults for each test example but allows every example to override props when needed:

// - yes, this is the entire implementation
// - no, it doesn't actually depend on preact
export class Provider {
getChildContext () {
let { children, ...context } = this.props;
return context;
}
render ({ children }) {
return children && children[0] || null
}