Skip to content

Instantly share code, notes, and snippets.

View sunpig's full-sized avatar

Martin Sutherland sunpig

View GitHub Profile

Keybase proof

I hereby claim:

  • I am sunpig on github.
  • I am msuthfanduel (https://keybase.io/msuthfanduel) on keybase.
  • I have a public key ASABAEI3kAOuI7JYDLTJFxYZcPR4U9fl1w_pebDK6chWwAo

To claim this, I am signing this object:

<!doctype html>
<html>
<body>
<h1>Plate 6</h1>
<canvas id="plate6" style="border:1px solid black"></canvas>
<script>
(function(){
function setNewGrey (ctx) {
grey = Math.floor(150 + (Math.random() * 75));
ctx.strokeStyle = `rgba(${grey}, ${grey}, ${grey}, 1)`;
#!/bin/bash
IF=en0
MAC=`python << EOF
import random
print ":".join("%02X"%x for x in (random.randint(0, 255) for _ in range(6)))
EOF
`
echo "resetting wifi on $IF, rotating mac $MAC"
scselect -n
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z
@sunpig
sunpig / pg-eu-2012.md
Created September 18, 2012 09:01
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 phonegap.com, and 1,000,000+ downloads of the phonegap software. build.phonegap.com, 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.)

@sunpig
sunpig / gist:3240789
Created August 2, 2012 21:24
Second best

"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
sunpig / gist:3236740
Created August 2, 2012 12:35
JS implementation of [DOMElement].dataset property
/**
* 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
sunpig / aleona-device-library.md
Last active October 7, 2015 12:08
Aleona Device Library

Aleona device library

IOS6

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

IOS5

  • iPod Touch
  • iPad (1st gen)
@sunpig
sunpig / HTML language
Created November 22, 2011 17:06 — forked from nimbupani/HTML language
TextMate HTML language tweaked to support unquoted attributes
{ scopeName = 'text.html.basic';
firstLineMatch = '<!DOCTYPE|doctype<(?i:html)|<\?(?i:php)';
fileTypes = ( 'html', 'htm', 'shtml', 'xhtml', 'phtml', 'php', 'inc', 'tmpl', 'tpl', 'ctp' );
foldingStartMarker = '(?x)
(<(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|li|form|dl|section|article|header|footer|nav|aside)\b.*?>
|<!--(?!.*--\s*>)
|^<!--\ \#tminclude\ (?>.*?-->)$
|<\?(?:php)?.*\b(if|for(each)?|while)\b.+:
|\{\{?(if|foreach|capture|literal|foreach|php|section|strip)
|\{\s*($|\?>\s*$|//|/\*(.*\*/\s*$|(?!.*?\*/)))
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)
metadata.reflect()
table_1 = metadata.tables['table_1']
table_1_column_1 = table_1.columns['column_1']