Skip to content

Instantly share code, notes, and snippets.

View ianjosephwilson's full-sized avatar

Ian Wilson ianjosephwilson

View GitHub Profile

Keybase proof

I hereby claim:

  • I am ianjosephwilson on github.
  • I am ianjosephwilson (https://keybase.io/ianjosephwilson) on keybase.
  • I have a public key ASBfYmsRZsAxCQF09dG8pb9nupyVl8WQFbuje2U2eY3cwwo

To claim this, I am signing this object:

import sys
def main(argv):
print (argv)
if __name__ == '__main__':
# The first argument is how we were called.
called_as = sys.argv[0]
# Pass actual arguments to our main function.
main(sys.argv[1:])
@ianjosephwilson
ianjosephwilson / page1.html
Last active August 29, 2017 23:48
polymer2 MPA -- 99% of this code is copied from the polymer webpack loader demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page 1</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>Page 1</h1>
@ianjosephwilson
ianjosephwilson / runlint.py
Created August 2, 2016 21:15
Testing out the mini racer v8 interface with Douglas Crockford's jslint.js from http://www.jslint.com/.
"""
Testing out the py mini racer v8 interface with Douglas Crockford's jslint.js from http://www.jslint.com/.
"""
import sys
from py_mini_racer import py_mini_racer
HTML_PAGE_FORMAT = """<!DOCTYPE html>
<head>
<meta charset="utf-8">
import logging
from collections import namedtuple
#tryton_jsonrpc is a softlink to tryton.jsonrpc.
from tryton_jsonrpc import ServerProxy, Fault
from pyramid.httpexceptions import HTTPUnauthorized
log = logging.getLogger(__name__)
@ianjosephwilson
ianjosephwilson / app.ts
Last active August 29, 2015 14:22
angularjs2 5 minute quickstart
/// <reference path="typings/angular2/angular2.d.ts" />
import {Component, View, bootstrap} from 'angular2/angular2';
// Annotation section
@Component({
selector: 'my-app'
})
@View({
class BatchIterator(object):
"""
Return batches of items of batch size or less from the given source.
Each batch is another iterator.
"""
def __init__(self, source, batch_size=900):
self.source_iter = iter(source)
self.batch_size = batch_size
self.stop_iteration = False
function startWatchingTagSettings() {
var request = null, timeout = null, temp = null, rate = 300;
$scope.$watch('tagSettings', function (val, oldVal) {
if (val === oldVal) {
// Special case where we are called durining initialization.
return;
}
temp = val;
if (timeout) {
$timeout.cancel(timeout);
def _render(template, **kwargs):
kwargs['constants'] = constants
return template.render(**kwargs)
//a data pin
//b clock pin
//r result
//w poll timeout
// @TODO: Improvements
// If ack fails reboot scout with scout.boot.
// If polling fails reboot scout with scout.boot.
function sht.temp.report {