Skip to content

Instantly share code, notes, and snippets.

View cwaring's full-sized avatar

Chris Waring cwaring

View GitHub Profile
ctags --langmap=php:.engine.inc.module.theme.php --php-kinds=cdfi --languages=php --recurse \
--exclude="\.git" \
--totals=yes \
--tag-relative=yes \
--regex-PHP='/abstract\s+class\s+([^ ]+)/\1/c/' \
--regex-PHP='/interface\s+([^ ]+)/\1/c/' \
--regex-PHP='/(public\s+|static\s+|abstract\s+|protected\s+|private\s+)function\s+\&?\s*([^ (]+)/\2/f/'
@cwaring
cwaring / gist:974262
Created May 16, 2011 11:20
Stylus color mixing mixin
/**
* Colour mixer: mix source with a target colour by a % value
*/
mix(source, target, ammount)
ammount = unit(ammount, '%')
unless source is a 'rgba' and target is a 'rgba'
error('mix() expects rgb colour values')
@cwaring
cwaring / gist:1002359
Created June 1, 2011 14:11
jQuery TOC from .section > h2
var items = new Array;
var ul = $('<ul />');
$('.section h2:first-child').each(function(e) {
items.push(this);
});
$.each(items, function(i, item) {
var $item = $(this),
@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>
@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 / 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 / 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"

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 / 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
@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')
}
});