Skip to content

Instantly share code, notes, and snippets.

View mitchellbusby's full-sized avatar

Mitchell Busby mitchellbusby

View GitHub Profile
class Solution:
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
value_to_index = {}
idx = 0
for num in nums:
<div class=”grid-container”>
<nav>
<ul>
<li>Menu item 1</li>
</ul>
</nav>
<main>
<h1>Hello world!</h1>
</main>
</div>
@mitchellbusby
mitchellbusby / main.js
Created June 11, 2018 10:37
Neat sine graph in isomer
const prisms = [...Array(512)].map((_, i) => {
const dz = Math.sin((Number(i) * (Math.PI / 128)));
const startingPoint = Point(0, i / 64, 0);
return new Shape.Prism(startingPoint, 0.5, 0.0625, dz);
}).reverse();
iso.add(prisms, new Color([160, 60, 50]));
machine = {
'field_1': 5,
'field_2': 10
}
def func_1(machine):
"""
Does something to the machine
"""
machine['field_1'] = 10
@mitchellbusby
mitchellbusby / main.py
Last active November 21, 2016 21:38
go self yourself
import csv # for reading data from CSV files
homeGoalsRecord = 0
awayGoalsRecord = []
"""
Team class
Example usage:
#Create a new team
homeTeam = new Team("home")
#Record a win
@mitchellbusby
mitchellbusby / build.gradle
Created September 19, 2016 22:44
Gradle build to ignore duplicate meta infs and prevent dex errors in Android
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
<html>
<head>
<title>Water</title>
</head>
<body>
<canvas id="canvas" width="800" height="1400">
</canvas>
<script type="text/javascript">
@mitchellbusby
mitchellbusby / logging.conf
Created August 2, 2016 10:30 — forked from wrunk/logging.conf
Getting setup with proper python logging
# ---------------------------------------------------------------------------- #
# Standard setup stuff. In general you will want to alter the formatters
#
[formatters]
keys: detailed,simple
[handlers]
keys: console
[formatter_simple]

We love political banter, and we wanted to visualise how political debate occurs over time. Our app, Question Time, visualises mentions of various suburbs around NSW in the NSW Parliament's Hansard records, and how often they occur.

Naturally, Sydney is the most mentioned, so our heatmap is normalised and standardised by the mean to get unique mention data for a particular day of parliamentary sitting.

We also analyse the top five location mentions in NSW on a particular day and plot them on the same map. Clicking one of these locations will open up data in the sidebar about why it was interesting on that day. We're going to start out with snippets of mentions in Hansard, but plan to include more interesting record information via NLP.

We made extensive use of Python's Flask and also the OpenLayers 3 mapping library that gives us heatmaps overlaid onto regular maps for free.

@mitchellbusby
mitchellbusby / views.py
Created July 31, 2016 00:09
Heroku + Flask + LetsEncrypt Verification Step
#Vaguely follows this guide but with python http://collectiveidea.com/blog/archives/2016/01/12/lets-encrypt-with-a-rails-app-on-heroku/
@app.route('/.well-known/acme-challenge/<id>')
def acme_challenge(id):
return "%s.%s" % (id, os.environ.get('ACME_CHALLENGE', 'ACME CHALLENGE VARIABLE IS NOT SET'))