Skip to content

Instantly share code, notes, and snippets.

View swmcc's full-sized avatar
👷‍♂️
Building things

Stephen McCullough swmcc

👷‍♂️
Building things
View GitHub Profile
window.snowplow = function() { console.log(arguments); }
@swmcc
swmcc / show_branches
Created December 2, 2015 14:23
Hacky script to display all the remote branches of a git repo
#!/usr/bin/env bash
for branch in `git branch -r | grep -v HEAD`;do
echo -e `git show --format="%Cred%ai,%Creset,%an,%Cgreen(%ar),%C(yellow)" $branch --date=short --date=relative |
head -n 1 ` $branch; done | sort -r | head -n 55 | column -ts','
namespace :import_data do
desc "Import Data"
task :client => :environment do
require 'csv'
mappings = {
'cliClientID' => 'old_client_id',
'cliClientFirstName' => 'first_name',
#!/bin/sh
BASE=`pwd`
PROJECT='xxxxx'
tmux start-server
# new-session creates first window named 'console'
tmux new-session -d -s $PROJECT -n console
@swmcc
swmcc / buses
Last active August 29, 2015 14:07
Handy place to hold bus time table info that is relevant to me
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json, sys, urllib2
URL = "https://gist.githubusercontent.com/swmcc/6e3f79ac59511da7b123/raw/4a56499cd71b8ac810e5b78ae8d1a2a2733886e8/translinktimes.json"
json = json.load(urllib2.urlopen(URL))
route = sys.argv[1]
@swmcc
swmcc / nestoria.py
Created August 10, 2014 21:39
Initial API wrapper for Nestoria
#!/usr/bin/env python
import urllib2
import json
from collections import namedtuple
NESTORIA_API_URL = "http://api.nestoria.co.uk/api?country=uk&action=search_listings&place_name=glenavy&encoding=json&listing_type=buy&number_of_results='50'"
response = urllib2.urlopen(NESTORIA_API_URL)
@swmcc
swmcc / xmltv_parse.py
Created July 18, 2014 23:32
Quick XMLTV (http://wiki.xmltv.org) Parser written in python. Does nothing fancy and just outputs the basic info to the screen.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime, xmltv
from operator import itemgetter
from collections import namedtuple
filename = "tv.xml"
@swmcc
swmcc / Gemfile
Last active August 29, 2015 14:04
Gemfile - seketon
source 'https://rubygems.org'
@swmcc
swmcc / TODO .aliases
Last active August 29, 2015 14:04
Simple wrapper to a todo application I have.
# my todo thingie
alias tdm='todos | grep MIQ' # work
alias sdm='todos | grep SG' # startup
alias pdm='todos | grep swmcc' # personal
@swmcc
swmcc / gaclickhandler.js
Created June 11, 2014 10:26
GA Click Handler
// attach GA click handler
// note: the GA code is stored in a 'data-ga' element
// instead of inserting onclicks directly into the markup.
// <a data-ga="Event, Action, Label"
// id="mode-switch-devices"
// class="ajax"
// title=""
// href=""></a>