Skip to content

Instantly share code, notes, and snippets.

View cwaring's full-sized avatar

Chris Waring cwaring

View GitHub Profile

Keybase proof

I hereby claim:

  • I am cwaring on github.
  • I am cwaring (https://keybase.io/cwaring) on keybase.
  • I have a public key whose fingerprint is 7DC0 9C46 37E8 16A4 FD00 B9C6 BB51 8294 0748 8886

To claim this, I am signing this object:

#!/bin/bash
# A bash script to create a time machine disk image suitable for
# backups with OS X 10.6 (Snow Leopard)
# This script probably only works for me, so try it at your own peril!
# Use, distribute, and modify as you see fit but leave this header intact.
# (R) sunkid - September 5, 2009
usage ()
{
echo ${errmsg}"\n"
@cwaring
cwaring / thanks.js
Created September 22, 2014 09:12
Set the thank you emails on after an invoice has been sent
$.ajax({
type: "POST",
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
url: 'toggle_thank_you_emails',
data: '_method=put',
});
@cwaring
cwaring / bipngif_dl.js
Last active August 29, 2015 14:06
Grab all the gif urls from the twitter web stream and create a wget formatted download script
var gifs = [];
$('a[data-expanded-url]').each(function() {
var url = this.getAttribute('data-expanded-url');
if (url.indexOf('.gif') > -1) {
var bipper = $(this).closest('p').find('.twitter-atreply').text();
gifs.push('wget -c ' + url + ' -O "' + (bipper ? bipper + ' - ' : '') + url.replace(/^.*[\\\/]/, '') + '";\n')
}
});
@cwaring
cwaring / git-pull-all.sh
Created September 1, 2014 16:52
Update all repos in a directory
#!/bin/sh
for dir in *
do
echo $dir
(cd $dir && git pull)
done

LXJS and DRIIFT

We can't wait for LXJS. It's a perfect blend of ideas and people, inspiration and collaboration.

It gives you the chance to choose your own adventure and this year DRIIFT is going to be your electronic sidekick.

We'll greet you at the door, put your name in lights and give you a heat map of the bright sparks: the people, places, workshops and parties.

We're using the latest NFC tech to power-up your lanyards. Awarding digital badges, creating connections and giving you a fast pass to freebies.

@cwaring
cwaring / pr
Created December 12, 2013 16:06
Simple command line tool to open up a pull request (into the dev branch) from your current local branch.
#!/bin/bash
open=$(which xdg-open 2> /dev/null)
if [[ ! $open ]]; then
open='open'
fi
repo=$(git remote -v | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/")
branch=$(git name-rev --name-only HEAD)
echo "... creating pull request for branch \"$branch\" in \"$repo\""
$open "https://github.com/$repo/compare/dev...$branch?expand=1"
@cwaring
cwaring / server.js
Last active December 19, 2015 08:49
Meteor basic auth
Meteor.startup(function() {
var connect = Meteor.require('connect');
WebApp.connectHandlers.use(connect.basicAuth('un', 'pw'));
// move auth to the top of the stack
var basicAuth = WebApp.connectHandlers.stack.pop();
WebApp.connectHandlers.stack.unshift(basicAuth);
});
@cwaring
cwaring / gmail_to_omnifocus.js
Created February 20, 2012 15:32
Gmail > Omnifocus bookmarklet
javascript:(function(){
if(top.document == document) {
var msg = document.getElementById("canvas_frame");
if(msg){
subjectEl = msg.contentDocument.getElementsByClassName("hP");
subject = subjectEl[0].innerText;
bodyEl = msg.contentDocument.getElementsByClassName("adP");
body = bodyEl[0].innerText;
@cwaring
cwaring / index.html
Created November 21, 2011 16:46 — forked from ilyabo/index.html
D3 tooltip using jQuery tipsy
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="jquery.tipsy.js"></script>
<link href="tipsy.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="chart"></div>