Skip to content

Instantly share code, notes, and snippets.

View jdillick's full-sized avatar

John Dillick jdillick

View GitHub Profile
@jdillick
jdillick / find_closest_sha1.py
Created January 17, 2013 16:06
Found this little gem of python for comparing a git repo to an un-versioned copy of the code. I returns the closest commit hash from the git repository corresponding to your code. This works great when you don't know what version of the code you have running.
#!/usr/bin/env python
import subprocess
import shlex
import sys
import os
import operator
gitdir,workdir=map(os.path.realpath,sys.argv[1:3])
os.chdir(gitdir)
proc=subprocess.Popen(shlex.split('git rev-list --all'),stdout=subprocess.PIPE)
@Rich-Harris
Rich-Harris / service-workers.md
Last active March 28, 2024 15:08
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.