Skip to content

Instantly share code, notes, and snippets.

View tschoffelen's full-sized avatar

Thomas Schoffelen tschoffelen

View GitHub Profile
@SleeplessByte
SleeplessByte / rfc4122-uuid.js
Created April 29, 2014 19:12
RFC4122 compliant UUID in Javascript (by broofa)
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
@bminer
bminer / ebs-backup.php
Created March 8, 2012 15:48
Simple PHP script to backup EC2 EBS volumes. Nice to include as a daily Cron job.
#! /usr/bin/env php
<?php
//Don't forget to setup credentials for the AWS API.
require_once('/usr/lib/aws-php-sdk-1.3.1/sdk.class.php');
$ec2 = new AmazonEC2();
$volumes = array(
'vol-xxxxxxxx' => '-- Your snapshot description here --',
'vol-xxxxxxxx' => '-- Your snapshot description here --',
'vol-xxxxxxxx' => '-- Your snapshot description here --'
@inversion
inversion / gist:60a96ea3294e4ce35615
Last active November 30, 2015 21:18
TfL Hex Line Colours JSON
{
"Bakerloo": "#B36305",
"Central": "#E32017",
"Circle": "#FFD300",
"District": "#00782A",
"DLR": "#00A4A7",
"Hammersmith and City": "#F3A9BB",
"Jubilee": "#A0A5A9",
"Metropolitan": "#9B0056",
"Northern": "#000000",
@leovandriel
leovandriel / gist:3794804
Created September 27, 2012 15:59
NWURLConnection - an NSURLConnectionDelegate based on blocks with cancel
// NWURLConnection - an NSURLConnectionDelegate based on blocks with cancel.
// Similar to the `sendAsynchronousRequest:` method of NSURLConnection, but
// with `cancel` method. Requires ARC on iOS 6 or Mac OS X 10.8.
// License: BSD
// Author: Leonard van Driel, 2012
@interface NWURLConnection : NSObject<NSURLConnectionDelegate>
@property (nonatomic, strong) NSURLRequest *request;
@property (nonatomic, strong) NSOperationQueue *queue;
@bminer
bminer / changeTypeAttr.js
Created August 31, 2012 21:30
Cross-browser solution for changing the 'type' attribute of an `<input/>` tag.
/* x is the <input/> element
type is the type you want to change it to.
jQuery is required and assumed to be the "$" variable */
function changeType(x, type) {
if(x.prop('type') == type)
return x; //That was easy.
try {
return x.prop('type', type); //Stupid IE security will not allow this
} catch(e) {
//Try re-creating the element (yep... this sucks)
@JoshOrndorff
JoshOrndorff / pi.k
Last active June 5, 2018 20:44
My work-in-progress pi-calculus in k framework
module PI-SYNTAX
imports DOMAINS
// Processes
syntax Proc ::= Norm // Normal processes are still processes
| Proc "|" Proc // Parallel
| "!" Proc // Replication
| "(" "v" Id ")" Proc // New name
| "(" Proc ")" // Allow parens for grouping
@oobrien
oobrien / README.md
Last active January 22, 2019 13:54
TfL lines and stations. Includes, Tube, DLR, Overground, Tramlink, Emirates Air Line and Crossrail. All as currently running/aligned, except Crossrail. Original data source: OpenStreetMap, which is Copyright OpenStreetMap contributors and available under the Open Database Licence.
@mike3k
mike3k / gist:6125852
Created July 31, 2013 20:30
Use this as a custom action in SourceTree to view the selected commit on Github. In the custom action editor, specify the parameters $REPO $SHA
#!/bin/sh
cd $1
URL=`git remote -v |grep "fetch)" |awk '{print $2;}'|sed -e's#git@github.com:#http://github.com/#'|sed -e's|\.git||'`
open ${URL}/commit/$2
@kwylez
kwylez / gist:5337918
Last active March 2, 2020 06:09
Example implementation of listening for iTunes/Spotify track changes and displaying information in the NotificationCenter. Article reference: http://blog.corywiles.com/now-playing-with-spotify-and-itunes
//
// AppDelegate.m
//
//
// Created by Cory D. Wiles on 10/8/12.
// Copyright (c) 2013 Cory D. Wiles. All rights reserved.
//
#import "AppDelegate.h"
#import "iTunes.h"
@DavidWells
DavidWells / user-feedback.md
Created February 15, 2020 22:47
Don Norman quote from The Invisible Computer

Don Norman quote from The Invisible Computer:

"Don’t ask people what they want. Watch them and figure out their needs. If you ask, people usually focus on what they have and ask for it to be better: cheaper, faster, smaller. A good observer might discover that the task is unnecessary, that it is possible to restructure things or provide a new technology that eliminates the painstaking parts of their procedures. If you just follow what people ask for, you could end up making their lives even more complicated."