Skip to content

Instantly share code, notes, and snippets.

Thomas Schoffelen tschoffelen

Block or report user

Report or block tschoffelen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
SleeplessByte / rfc4122-uuid.js
Created Apr 29, 2014
RFC4122 compliant UUID in Javascript (by broofa)
View rfc4122-uuid.js
'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 / ebs-backup.php
Created Mar 8, 2012
Simple PHP script to backup EC2 EBS volumes. Nice to include as a daily Cron job.
View ebs-backup.php
#! /usr/bin/env php
//Don't forget to setup credentials for the AWS API.
$ec2 = new AmazonEC2();
$volumes = array(
'vol-xxxxxxxx' => '-- Your snapshot description here --',
'vol-xxxxxxxx' => '-- Your snapshot description here --',
'vol-xxxxxxxx' => '-- Your snapshot description here --'
inversion / gist:60a96ea3294e4ce35615
Last active Nov 30, 2015
TfL Hex Line Colours JSON
View gist:60a96ea3294e4ce35615
"Bakerloo": "#B36305",
"Central": "#E32017",
"Circle": "#FFD300",
"District": "#00782A",
"DLR": "#00A4A7",
"Hammersmith and City": "#F3A9BB",
"Jubilee": "#A0A5A9",
"Metropolitan": "#9B0056",
"Northern": "#000000",
leonardvandriel / gist:3794804
Created Sep 27, 2012
NWURLConnection - an NSURLConnectionDelegate based on blocks with cancel
View gist:3794804
// 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;
davidnormo /
Last active Mar 31, 2016
npm global export import

The following command will give you a string of all the npm packages and their versions that are currenctly globally installed.
Note: that this ignores packages installed from directories and picks only those installed via the npm registry.

$ npm ls -g --depth 0 | sed -e '1d' -e 's/└── //g' -e 's/├── //g' -e '/^.*->.*$/d' -e '/^$/d' | tr '\n' ' '

If you copy this string, you can then append it to the end of npm install -g to install all of the packages.

bminer / changeTypeAttr.js
Created Aug 31, 2012
Cross-browser solution for changing the 'type' attribute of an `<input/>` tag.
View changeTypeAttr.js
/* 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 / pi.k
Last active Jun 5, 2018
My work-in-progress pi-calculus in k framework
View pi.k
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
keighl /
Last active Oct 11, 2018
Rename a font to have the same Family/Fullname/Postscript name. This prevents IE from choking in @font-face
# FontForge command
fontforge -script ProprietaryFontCondensedBold.otf
# FontForge Script
# * Opens the font file
# * Sets the family/fullname/postscript name be the same as the filename (without ext)
mndrix / sms.go
Last active Nov 5, 2018
SMS over IRC
View sms.go
// A proxy for sending/receiving SMS via IRC
// This code is part of our family IRC server whose code is available at
// This file won't compile by itself because it's only one file from
// my larger family server (movie hosting, Asterisk dialplan, Git
// hosting, personal assistant, etc).
// Copyright 2018 Michael Hendricks
View static-templates.php
* Plugin Name: Static Templates
* If most of your site content is in .php template files, and you're tired of
* creating new pages, assigning them page templates, creating page templates
* then doing it all over again on production, this plugin is for you.
* Examples:
You can’t perform that action at this time.