Skip to content

Instantly share code, notes, and snippets.

@bwhite
bwhite / glass.html
Last active November 7, 2018 22:14 — forked from amiller/glass.html
[wearscript] AR Tag Warping
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="offscreen" width="640" height="360" style="display:hidden"></canvas>
<script>
HEIGHT = 360;
WIDTH = 640;
function drawCircle(x, y,tag) {
var width = WIDTH;
var height = HEIGHT;
@bwhite
bwhite / glass.html
Created March 24, 2014 02:02 — forked from connerbrooks/glass.html
[wearscript] Pebble Example
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function main() {
if (WS.scriptVersion(1)) return;
WS.pebbleSetBody('connected!', false);
WS.sensorOn(WS.sensor("pebbleAccelerometer"), .25, function (data) {
WS.log('x: ' + data['values'][0] + ' y: ' + data['values'][1] + ' z: ' + data['values'][2]);
WS.pebbleSetBody('x: ' + data['values'][0] + ' y: '+ data['values'][1] + ' z: ' + data['values'][2], false);
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function main() {
if (WSRAW.scriptVersion(1)) return;
WS.gestureCallback('onPebbleClick', function (name) {
switch (name) {
case 'UP':
WS.say('up');
break;
@bwhite
bwhite / glass.html
Created March 2, 2014 02:05 — forked from amiller/glass.html
[wearscript] Big to Glass Calibration
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
function cb(data) {
// Changes canvas color with head rotation
@bwhite
bwhite / server.py
Last active December 27, 2015 21:49 — forked from colegleason/server.py
import gevent.monkey
gevent.monkey.patch_all()
import msgpack
from gevent import pywsgi
from geventwebsocket.handler import WebSocketHandler
def websocket_app(environ, start_response):
print('Connected')
if environ["PATH_INFO"] == '/':
ws = environ["wsgi.websocket"]
import json
def filter_by_completed(users, results, num_tasks=100):
new_users = {}
for user_id, user_data in users.items():
assert user_data.get('tasks_finished', 0) <= num_tasks
if user_data.get('tasks_finished', 0) == num_tasks:
new_users[user_id] = user_data
new_results = dict((result_id, result_data)
We couldn’t find that file to show.