Skip to content

Instantly share code, notes, and snippets.

View scottgwald's full-sized avatar

Scott W. Greenwald scottgwald

View GitHub Profile
@scottgwald
scottgwald / glass.html
Last active January 2, 2016 13:49
[wearscript] Two ways to take a photo and show *on canvas*
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="myCanvas" width="640" height="360"></canvas>
<script>
function photoPath(data) {
WS.say("I got your photo");
var img = new Image();
img.src = data;
img.onload = function() {
context.drawImage(img, 0, 0, canvas.width, canvas.height);
@scottgwald
scottgwald / glass.html
Created February 7, 2014 21:21 — forked from bwhite/glass.html
[wearscript] All gestures get logged to the console and the onGesture results are spoken aloud
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
function show(msg) {
WS.log(msg)
WS.cardModify(0, WS.cardFactory(msg, ''));
}
function onGesture(gesture) {
@scottgwald
scottgwald / glass.html
Last active August 29, 2015 13:56
[wearscript] periodically record a video
<!--
App with multiple modes that are driven by sensor callbacks
TODO: think about what to do in order to support drawing
triggered in different ways, such as animation
-->
<html style="width:100%; height:100%; overflow:hidden">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<!--
@scottgwald
scottgwald / glass.html
Last active August 29, 2015 13:56 — forked from bwhite/glass.html
[wearscript] Eye tracker calibration
<html style="width:100%; height:100%; overflow:hidden">
<head><script src="https://api.picar.us/wearscriptdev/bower_components/msgpack-javascript/msgpack.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 publish() {
var data = msgpack.pack(Array.prototype.slice.call(arguments));
WS.publish(arguments[0], btoa(data.map(function (x) {return String.fromCharCode(x)}).join('')));
}
@scottgwald
scottgwald / glass.html
Last active August 29, 2015 13:56
[wearscript] sensor explorer
<!--
App with multiple modes that are driven by sensor callbacks
TODO: think about what to do in order to support drawing
triggered in different ways, such as animation
-->
<html style="width:100%; height:100%; overflow:hidden">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<!--
@scottgwald
scottgwald / glass.html
Last active August 29, 2015 13:56
[wearscript] EyeTracker cal v1
<!--
App with multiple modes that are driven by sensor callbacks
TODO: think about what to do in order to support drawing
triggered in different ways, such as animation
-->
<html style="width:100%; height:100%; overflow:hidden">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<!--
@scottgwald
scottgwald / glass.html
Created March 1, 2014 02:45 — forked from bwhite/glass.html
[wearscript] card tree example
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function server() {
WS.displayCardTree();
var select = function () {WS.say('select')};
var tap = function () {};
var select = function (n) {return function () {WS.say('select ' + n);WS.log('select ' + n)}};
var log = function (n) {return function () {WS.log('log ' + n)}};
var tap = function (n) {return function () {WS.say('tap ' + n);WS.log('tap ' + n)}};
@scottgwald
scottgwald / gist:9337603
Created March 4, 2014 00:18
publish head rotation
<!--
App with multiple modes that are driven by sensor callbacks
TODO: think about what to do in order to support drawing
triggered in different ways, such as animation
-->
<html style="width:100%; height:100%; overflow:hidden">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<!--
@scottgwald
scottgwald / glass.html
Last active August 29, 2015 13:57 — forked from suryabhupa/glass.html
[wearscript] space ship
<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 showImage(imageDataArray) {
WS.say("Got your image");
@scottgwald
scottgwald / glass.html
Last active August 29, 2015 13:57
[wearscript] WearDiary2
<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>
var videoLength = 10;
var videoInterval = 300;