Skip to content

Instantly share code, notes, and snippets.

@bwhite
bwhite / glass.html
Created April 4, 2014 14:09
[wearscript] Camera tests
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!-- You can include external scripts here like so... -->
<!--<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 main() {
@bwhite
bwhite / glass.html
Created March 30, 2014 17:06
[wearscript] Picarus image registration
<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.cameraOn(.1, 360, 640);
WS.cvInit(function () {
WS.gestureCallback('onGestureTAP', function () {
WS.sound('SUCCESS');
WS.displayWarpView();
@bwhite
bwhite / glass.html
Created March 30, 2014 04:29
[wearscript] Picarus samples
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!-- You can include external scripts here like so... -->
<!--<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 armarkers() {
@bwhite
bwhite / glass.html
Created March 29, 2014 23:48
[wearscript] Pebble + Myo control
<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.subscribe("gesture:pebble:singleClick:UP", function () {
WS.control('SWIPE_LEFT');
});
WS.subscribe("gesture:pebble:singleClick:DOWN", function () {
WS.control('SWIPE_RIGHT');
@bwhite
bwhite / glass.html
Created March 27, 2014 21:14
[wearscript] Local storage 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;
var key = 'test';
if (localStorage[key]) {
WS.log('Stored Value: ' + localStorage[key]);
} else {
WS.log('New value');
@bwhite
bwhite / glass.html
Created March 27, 2014 20:38
[wearscript] Bug: Proof of concept for BT swipe, if you use Ctrl+Enter to run this it won't go right, but if you ALT+Enter after it does
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function server() {
WS.control('SWIPE_RIGHT', false);
}
function main() {
if (WS.scriptVersion(1)) return;
WS.serverConnect('{{WSUrl}}', server);
}
#!/usr/bin/env python
import shutil
import urllib2
import platform
import tempfile
import urllib
import os
import subprocess
import webbrowser
import stat
@bwhite
bwhite / glass.html
Created March 24, 2014 04:21
[wearscript] Phone + Glass
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!-- You can include external scripts here like so... -->
<!--<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 server() {
@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);
@bwhite
bwhite / cpu.js
Last active August 29, 2015 13:57
[wearscript] Mario (nes)
/*
JSNES, based on Jamie Sanders' vNES
Copyright (C) 2010 Ben Firshman
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,