Skip to content

Instantly share code, notes, and snippets.

Avatar

David Crawford davidcrawford

View GitHub Profile
View Electron Helper_2015-10-22-231255_Davids-MacBook-Pro-2.crash
Process: Electron Helper [4391]
Path: /Users/USER/*/Electron.app/Contents/Frameworks/Electron Helper.app/Contents/MacOS/Electron Helper
Identifier: com.github.electron.helper
Version: 0
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Terminal [808]
User ID: 501
Date/Time: 2015-10-22 23:12:54.780 -0700
@davidcrawford
davidcrawford / crawler.go
Created Feb 22, 2015
Golang Tour of Go: Web Crawler
View crawler.go
package main
import (
"fmt"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
Fetch(url string) (body string, urls []string, err error)
@davidcrawford
davidcrawford / unzip.py
Created Oct 1, 2013
Python UnzipStream — A file-like wrapper around a gzipped stream that uncompresses as it reads.
View unzip.py
import os
import zlib
from StringIO import StringIO
ESTIMATED_COMPRESSION_FACTOR = 2
class UnzipStream(object):
'''
View 1-example_query_1.sql
SELECT * FROM purchases ORDER BY created_at DESC;
@davidcrawford
davidcrawford / 01-signed_up_users.sql
Last active Dec 14, 2015
Rolling cohort retention SQL
View 01-signed_up_users.sql
SELECT count(1) as signed_up_users
FROM users
WHERE users.sign_up_time >= date_trunc('day', now() - interval '2 days')
AND users.sign_up_time < date_trunc('day', now() - interval '1 day');
View auditor-bookmarklet.html
<html>
<head>
<style>
body {
font-family: 'Helvetica', sans-serif;
width: 950px;
margin: auto;
}
</style>
</head>
@davidcrawford
davidcrawford / gist:1180363
Created Aug 30, 2011
Base62 encoder/decoder
View gist:1180363
var Base62 = (function() {
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
var base = chars.length;
var decoder = chars.split('').reduce(function(memo, c, i) {
memo[c] = i;
return memo;
}, {});
var encode = function(value) {