Skip to content

Instantly share code, notes, and snippets.

View davidjb's full-sized avatar

David Beitey davidjb

View GitHub Profile
@davidjb
davidjb / melody.c
Created May 16, 2016 22:58
Arduino random tone player
#include "Arduino.h"
#include "tones.h"
const int LED_PIN = 13;
const int BUTTON_PIN = 2;
const int PIEZO_PIN = 8;
int current_tone;
boolean playing = false;
@davidjb
davidjb / food-rescue-documentation.md
Last active June 15, 2016 12:29
Documentation for the Food Rescue project

Background

From the main BFR Robot Google Doc for administrators:

From the volunteer’s perspective, the robot is a fairly simple tool that magically understands which shift they’ve decided to do, and sends them email (or text message) reminders to do it and to subsequently enter data for it. It also shows cool statistics about how much food has been rescued, gives bike friendly directions between donors and recipients, keeps track of contact

@davidjb
davidjb / nbsp-bug.html
Created August 2, 2016 00:52
Squiz Matrix Viper   bug
<!-- When the following snippet is pasted into the source code editor, this code
including the whitespace indentation (which fits into a well-formatted HTML document):
-->
<p class="card-text">
With temperatures near 30&deg;C and 600mm of rain a year, Fletcherview has a dry
season of 6 to 9 months.
</p>
<!-- turns into this. Note the &nbsp; chars break the layout: -->
<p class="card-text">
@davidjb
davidjb / webhook.py
Created February 3, 2016 23:42
Simple webhook endpoint for accepting requests to trigger a git update
from bottle import route, run, response, request, redirect
import os
import subprocess
@route('/', method="POST")
@route('/')
def main():
os.chdir('/opt/example-org-pages')
return_code = subprocess.check_call('git pull', shell=True)
if return_code == 0:

Keybase proof

I hereby claim:

  • I am davidjb on github.
  • I am davidjb (https://keybase.io/davidjb) on keybase.
  • I have a public key ASAZEqpWhpC67z2LE3_yK1mVIwTsB2AZXX22I_r7STi1rAo

To claim this, I am signing this object:

@davidjb
davidjb / inject.js
Created January 5, 2017 05:21
Adding JS/CSS into a live page
// These could be anything
var js = 'https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js'
var css = 'https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.css'
$.getScript(js)
$('body').append('<link href="' + css + '" rel="stylesheet">')
@davidjb
davidjb / snippets.css
Last active August 13, 2017 08:29
CSS Snippets
/* Large ol numbering in the background */
.trip-steps {
counter-reset: step-counter;
margin-left: 3.5rem;
position: relative;
margin-top: 3rem;
margin-bottom: 3rem;
}
.trip-step {
position: relative;
@davidjb
davidjb / reference-tooltips.js
Last active August 13, 2017 08:32
Replace HTML paragraphs with incremental identifiers, and create custom tooltips via JavaScript with jQuery Tools.
jQuery(function($) {
$(window).ready(function() {
var reference_url = '//terrestrialclimatechange.org.au/references';
var storage_key = 'references.data';
var ref_link_structure = function(reference) {
return '<a href="' + reference_url + '#ref-' + reference + '">' + reference + '</a>';
};
var tooltip_structure = function(content) {
return $('<div class="tooltip" />').append(content);
@davidjb
davidjb / ago2.py
Created January 9, 2013 01:59
Improved humanisation for Ago
from datetime import datetime, timedelta
import ago
def human(date,
precision=2,
past_fmt="{} ago",
present_fmt="right now",
future_fmt="in {}",
present_tolerance=timedelta(0)):
@davidjb
davidjb / jpype.cfg
Created July 5, 2012 23:44
Buildout for JPype (for Plone)
#Notes about JPype
#------------------------------------
#You need to install default-jre / openjdk-6-jre (Debian/Ubuntu), or
#java-1.6.0-openjdk (RHEL/CentOS) *and* associated development packages.
#The JAVA_HOME variable should be
#set as an environmental variable prior to using the following.
#You might want to use the following to set this:
#Ubuntu: export JAVA_HOME="/usr/lib/jvm/java-6-openjdk"
#RHEL: export JAVA_HOME="/etc/alternatives/java_sdk"
#and include these in your profile (eg ~/.bash_profile) to load them on