Skip to content

Instantly share code, notes, and snippets.

View wildlyinaccurate's full-sized avatar
🐕‍🦺

Joseph Wynn wildlyinaccurate

🐕‍🦺
View GitHub Profile
@tomhicks
tomhicks / plink-plonk.js
Last active March 18, 2024 02:23
Listen to your web pages
@wildlyinaccurate
wildlyinaccurate / ubuntu-setup.sh
Last active February 16, 2024 09:05
Setting up a new Ubuntu machine
#!/usr/bin/env bash
# Generate an ED25519 key and display the public key
ssh-keygen -o -a 100 -t ed25519
cat ~/.ssh/id_ed25519.pub
read -p 'You should add your public key to GitHub now. Press any key to continue...'
read -p 'Now you will generate a GPG key. Please use RSA/RSA with a keysize of 4096 bits. Press any key to continue...'
gpg --default-new-key-algo rsa4096 --gen-key

Refactoring with type classes and optics

Often when writing programs and functions, one starts off with concrete types that solve the problem at hand. At some later time, due to emerging requirements or observed patterns, or just to improve code readability and reusability, we refactor to make our code more polymorphic. The importance of not breaking your API typically ranges from nice to have (e.g. minimises rework but not essential) to paramount (e.g. in a popular, foundational library).

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@Rich-Harris
Rich-Harris / service-workers.md
Last active April 9, 2024 08:18
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.

@shaunbent
shaunbent / 12-col-1008.js
Last active January 27, 2017 11:54
GEL Grid Bookmarklets
// Save the following as bookmark in your browser
javascript:(function(){if(document.getElementsByClassName("gel-grid-overlay").length){document.getElementsByClassName("gel-grid-overlay")[0].remove()}var e="<div class=\"gel-grid-overlay__grid\"><div class=\"gel-grid-overlay__margin\" style=\"left: 0;\"></div>";for(i=0;i<12;i++){e+="<div class=\"gel-grid-overlay__column\"><div class=\"gel-grid-overlay__column-fill\"></div></div>"}e+="<div class=\"gel-grid-overlay__margin\" style=\"right: 0;\"></div>";e+="</div>";var t=document.createElement("div");t.className="gel-grid-overlay";t.innerHTML=e;var n=document.createElement("style");n.innerHTML=".gel-grid-overlay * {-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;);}.gel-grid-overlay {z-index: 2147483647; position: fixed; height: 100%; width: 100%; left: 0; top: 0;}.gel-grid-overlay__grid {position: relative; width: 100%; height: 100%; max-width: 1008px; margin: 0 auto; padding: 0 4px;}.gel-grid-overlay__column {display: inline-
//: Playground - noun: a place where people can play
//: http://webyrd.net/scheme-2013/papers/HemannMuKanren2013.pdf
typealias Var = Int
typealias Subst = [(Var, Term)]
typealias State = (Subst, Int)
typealias Goal = State -> Stream
indirect enum Stream {
case Nil, Cons(State, Stream), Lazy(() -> Stream)
@iconara
iconara / queries.sql
Last active November 13, 2023 22:26
Low level Redshift cheat sheet
-- Table information like sortkeys, unsorted percentage
-- see http://docs.aws.amazon.com/redshift/latest/dg/r_SVV_TABLE_INFO.html
SELECT * FROM svv_table_info;
-- Table sizes in GB
SELECT t.name, COUNT(tbl) / 1000.0 AS gb
FROM (
SELECT DISTINCT datname, id, name
FROM stv_tbl_perm
JOIN pg_database ON pg_database.oid = db_id
@ohanhi
ohanhi / frp.md
Last active December 23, 2022 13:06
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

@alicebartlett
alicebartlett / Hiring-links.md
Last active November 26, 2018 03:41
A while ago I asked twitter for resources on hiring, here are some links: