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
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
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
<?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 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
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
davidnormo / npm-global-export-import.md
Last active Mar 31, 2016
npm global export import
View npm-global-export-import.md

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
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
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
keighl / foooont.sh
Last active Oct 11, 2018
Rename a font to have the same Family/Fullname/Postscript name. This prevents IE from choking in @font-face
View foooont.sh
# FontForge command
fontforge -script 2ttf.pe ProprietaryFontCondensedBold.otf
# 2ttf.pe
# FontForge Script
# http://fontforge.org/scripting.html
#
# * Opens the font file
# * Sets the family/fullname/postscript name be the same as the filename (without ext)
@mndrix
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
// https://gist.github.com/mndrix/7947009178e4a18c247b4bd25821661f
//
// 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
<?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.