Skip to content

Instantly share code, notes, and snippets.

@mjumbewu
mjumbewu / index.html
Last active September 24, 2015 18:08
Mapbox GL test
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.11.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.11.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@mjumbewu
mjumbewu / bullet-voting.json
Created October 8, 2015 18:33
Bullet Voting
{
"version": "1",
"header": {
"title": "Business Licenses in Chicago",
"description": "Business licenses issued by the Department of Business Affairs and Consumer Protection in the City of Chicago from 2002 to the present. January 1, 2006 to present. Data is updated daily.",
"navigation": [
{
"label": "Download",
"url": "https://data.cityofchicago.org/api/views/r5kz-chrr/rows.csv?accessType=DOWNLOAD&bom=true"
}
@mjumbewu
mjumbewu / index.html
Created April 7, 2016 20:36
JS Sentry Config in a Django template
{% if settings.SENTRY_DSN %}
<script src="https://cdn.ravenjs.com/2.2.0/raven.min.js"></script>
<script>Raven.config('{{ settings.SENTRY_DSN }}').install()</script>
<script>
$(document).ajaxError(function(event, jqXHR, ajaxSettings, thrownError) {
Raven.captureMessage('Ajax: (' + jqXHR.status + ') "' + thrownError || jqXHR.statusText + '" at ' + ajaxSettings.url, {
extra: {
type: ajaxSettings.type,
url: ajaxSettings.url,
data: ajaxSettings.data,
<html>
<head>
<style>
#checker-board {
width: 400px;
height: 400px;
background-color: #ffbc00;
border: 10px solid rgba(0,0,0,0.65);
border-radius: 10px;
position: relative;
<html>
<head>
<style>
html,body {
padding: 0;
margin: 0;
}
#left-paddle {
background-color: green;
# =============================================================================
# ON THE SERVER...
# Check the amount of disk space available on root (/) partition
df -h
# See where space is being consumed
cd /; sudo du -h --max-depth=1
# In this case, most was in /emergence; further digging and du-ing
@mjumbewu
mjumbewu / deploy.sh
Created May 20, 2016 15:31
Sample contents of a .travis folder for Phila deployments on AWS
#!/usr/bin/env bash
set -e
SCRIPTS_DIR=$(dirname $0)
KEYFILE=deploy.pem
INSTANCE_USER=ubuntu
ENCRYPTION_KEY='encrypted_${ENCRYPTION_ID}_key'
ENCRYPTION_IV='encrypted_${ENCRYPTION_ID}_iv'
@mjumbewu
mjumbewu / nginx.conf
Created June 2, 2016 01:27
Simple SSL-enabled nginx config to serve static files
server {
listen 80;
return 301 https://\$host\$request_uri;
}
server {
listen 443 ssl;
ssl_certificate [PATH_TO_SSL_CERT];
ssl_certificate_key [PATH_TO_SSL_CERT_KEY];

Starting a new project

Rather than trying to plan the precise steps and concepts to cover as you build the project, it may be easier to work backwards, building the project as you would if it weren't for class first, and then breaking it down for instruction.

  1. Build the project out completely as quickly and simply as possible.
  2. Break down the project into conceptual pieces.
  • Use the CbK skill levels to map and order the skills you used to create
@mjumbewu
mjumbewu / gunicorn.conf.py
Created June 9, 2016 21:13
Patching psycopg2 for nonblocking use with gunicorn's gevent workers using psycogreen
from psycogreen.gevent import patch_psycopg
def post_fork(server, worker):
patch_psycopg()