Skip to content

Instantly share code, notes, and snippets.

Martin Sutherland sunpig

Block or report user

Report or block sunpig

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
View plate6.html
<!doctype html>
<h1>Plate 6</h1>
<canvas id="plate6" style="border:1px solid black"></canvas>
function setNewGrey (ctx) {
grey = Math.floor(150 + (Math.random() * 75));
ctx.strokeStyle = `rgba(${grey}, ${grey}, ${grey}, 1)`;
MAC=`python << EOF
import random
print ":".join("%02X"%x for x in (random.randint(0, 255) for _ in range(6)))
echo "resetting wifi on $IF, rotating mac $MAC"
scselect -n
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z
View REPL setup for sqlalchemy
from sqlalchemy import MetaData, create_engine, orm
from sqlalchemy.sql import select
engine = create_engine('postgresql+psycopg2://username:password@localhost:5432/dbname')
Session = orm.sessionmaker(bind=engine)
session = Session()
metadata = MetaData(bind=engine)
table_1 = metadata.tables['table_1']
table_1_column_1 = table_1.columns['column_1']
sunpig /
Created Sep 18, 2012
Notes from the PhoneGap EU Day 2012

PhoneGap EU Day 2012

Friday 14 Sep 2012, Compagnietheater Amsterdam

09:30 Opening remarks by Andre Charland (Adobe) @andrecharland

In the year since 1.0 was released, there have been 10,000,000+ visits to, and 1,000,000+ downloads of the phonegap software., the automated build service (so you don't have to compile all the different targets yourself) has 100,000 users, and is due for a formal release "soon."

Regarding naming confusion, "Cordova" is the Open Source project, owned by the Apache foundation, and "PhoneGap" is Adobe's distribution. (Just like "Linux" is the core Open Source project, and "Ubuntu" is a distribution of it.)

View gist:3240789

"There is this, about being the sparring partner of the best swordsman in Caribastos. I always lost. But if I ever meet the third best swordsman in Caribastos, he's going to be in very deep trouble." -Lois McMaster Bujold, Paladin of Souls

sunpig / gist:3236740
Created Aug 2, 2012
JS implementation of [DOMElement].dataset property
View gist:3236740
* Not all browsers support the .dataset property
* for DOM elements. This function performs the same
* function: it gathers all the data-* attributes of a
* DOM element, and returns them as a hash.
* Example: <p id="testP" data-monkey="fez" data-turtle="mine"></p>
* getDataset(p); // {'monkey':'fez', 'turtle':'mine'}
function getDataset(el) {
var dataset = {};
sunpig /
Last active Oct 7, 2015
Aleona Device Library

Aleona device library


  • iPad (3rd gen/retina)
  • iPhone 4


  • iPod Touch
  • iPad (1st gen)
sunpig / HTML language
Created Nov 22, 2011 — forked from nimbupani/HTML language
TextMate HTML language tweaked to support unquoted attributes
View HTML language
{ scopeName = 'text.html.basic';
firstLineMatch = '<!DOCTYPE|doctype<(?i:html)|<\?(?i:php)';
fileTypes = ( 'html', 'htm', 'shtml', 'xhtml', 'phtml', 'php', 'inc', 'tmpl', 'tpl', 'ctp' );
foldingStartMarker = '(?x)
|^<!--\ \#tminclude\ (?>.*?-->)$
You can’t perform that action at this time.