Instantly share code, notes, and snippets.

View LeapHandPosition.js
var handPos = { handId: '', normX: 0, normY: 0, normZ: 0, posX: 0, posY: 0, posZ: 0, rotX: 0, rotY: 0, rotZ: 0, set: false };
Leap.loop(function (frame) {
var handIds = {};
if (frame.hands === undefined) {
var handsLength = 0
} else {
var handsLength = frame.hands.length;
}
View UdpMessage.cs
using System.Net;
using System.Net.Sockets;
string hostName = "192.168.1.1";
int port = 5000;
string msg = "Hello";
UdpClient udpClient = new UdpClient(hostName, port);
Byte[] sendBytes = Encoding.ASCII.GetBytes(msg);
View CompassLocation.cs
using System;
using UnityEngine;
using UnityEngine.UI; //required for Input.compass
public float compassSmooth = 0.5f;
private float m_lastMagneticHeading = 0f;
public class CompassController : MonoBehaviour {
// Use this for initialization
void Start () {
View trail.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Trail</title>
</head>
<body>
<div class="parent">
<div class="container">
<canvas id="trailCanvas" width="800" height="600" style="margin:0;padding:0;z-index:500; border: 1px solid #000;"></canvas>
View location.js
var x = document.getElementById("demo");
var watchID = null;
var counter = 0;
function geo_success(position) {
counter += 1;
x.innerHTML = "Latitude: " + position.coords.latitude + ", Longitude: " + position.coords.longitude + ", Count: " + counter;
}
function geo_error() {
x.innerHTML = "Sorry, no position available.";
View headTracking.js
window.onload = function () {
var video = document.getElementById('video');
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var tracker = new tracking.ObjectTracker('face');
try{
tracker.setInitialScale(4);
tracker.setStepSize(2);
tracker.setEdgesDensity(0.1);
View comms.js
var piComms = function (userName, setGlobal, pingInterval) {
'use strict';
var user = userName;
var pingTimerId;
var pingTimerInterval = (pingInterval != undefined) ? pingInterval : 5000;
setGlobal = (setGlobal != undefined && setGlobal == false);
var pub = {
setUserName: function (userName) {
View gist:5106718
//npm install csv
//npm install mongodb
var csv = require('csv');
var fs = require('fs');
var start = Date.now();
// Retrieve
var mongoclient = require('mongodb').MongoClient;
View gist:5063652
var localizeReader = exports;
(function (localizeReader) {
localizeReader.get = function(obj, culture){
var c = (!culture) ? 'default': culture;
if(obj[c] !== undefined) return obj[c];
c = c.split('-')[0];
if(obj[c] !== undefined) return obj[c];
for (var prop in obj) {
return obj[prop];
}