Skip to content

Instantly share code, notes, and snippets.


Richard Cornish richardcornish

View GitHub Profile
richardcornish / Git notes
Last active Mar 4, 2020
Enough Git for your résumé in 100ish lines
View Git notes
1. Install Git
(But consider using Homebrew)
2. Make a GitHub account
3. Open Terminal
richardcornish / Typography cheat sheet
Last active Sep 13, 2017
These character sets are not exhaustive, but merely a quick reference for common characters.
View Typography cheat sheet
These character sets are not exhaustive, but merely a quick reference for common characters.
‘ ‘ \2018 Left single quotation mark
’ ’ \2019 Right single quotation mark/Apostrophe
“ “ \201C Left double quotation mark
” ” \201D Right double quotation mark
' ' \0027 Typewriter single quotation mark
" " \0022 Typewriter double quotation mark
′ ′ \2032 Prime (Feet / Minutes)
richardcornish / gist:ec833827a0612f1c311a02ec4b299612
Last active Jul 17, 2017
Create new Python package for PyPi
View gist:ec833827a0612f1c311a02ec4b299612
# Create environment
mkvirtualenv -p python3 mydjangopackage
pip install django sphinx sphinx-autobuild sphinx-rtd-theme
# Create demo environment
mkvirtualenv -p python3 mydjangopackagedemo
pip install django gunicorn psycopg2 whitenoise dj-database-url
# Create docs
mkdir docs
View gist:0533b67d85752a66f4e75a0357eda28a
git remote add upstream<user>/<repo>.git
git fetch upstream
git checkout master
git merge upstream/master
git push
richardcornish / Django install
Last active Aug 24, 2016
The absolute bare minimum to run Django (requires Python, SQLite, pip, and virtualenv)
View Django install
virtualenv myproject
source myproject/bin/activate
pip install django
cd myproject/
django-admin startproject myproject
cd myproject/
python migrate
python runserver
richardcornish / MySQLgenerator
Last active Apr 19, 2016
Bash script that quickly generates a MySQL database, user, and password
View MySQLgenerator
# Usage:
# $ brew install mysql
# $ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
# $ bash -c "$(curl -fsSL"
echo "Welcome to the MySQL generator!"
read -p "Database name: " dbname
read -p "Database user: " dbuser
richardcornish /
Last active Jan 19, 2016
Breaking Django's form wizard (GenderFormBasic) out across views by manually hacking HiddenInput and RadioSelect
from __future__ import absolute_import
from django import forms
from django.contrib.auth import get_user_model
from django.utils.safestring import mark_safe
from utils.mixins import NoLabelSuffixMixin
from .utils import HiddenInput, RadioSelect
User = get_user_model()
richardcornish / How to create and inherit objects in JavaScript
Last active Dec 17, 2015
Basic notes on how to create and inherit objects the crazy-ass JavaScript way.
View How to create and inherit objects in JavaScript
/* -------------------------------------------------------
Old-school way to create child objects from parent objects
var Person = function (name, age, sex) { = name;
this.age = age; = sex;
Person.prototype.sayGreeting = function () {
View HTML5 template
<!DOCTYPE html>
<html lang="en" dir="ltr">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
body { margin: 0; padding: 0; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
richardcornish / Quest mode in Google Maps
Created Apr 20, 2012
How to add the Quest mode in Google Maps from April Fools Day 2012
View Quest mode in Google Maps
// Set map options
var mapOptions = {
center: new google.maps.LatLng(41.917142, -87.673837), // Or whatever
zoom: 15,
mapTypeId: "quest",
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.SATELLITE, "quest"]
scrollwheel: false