This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |