Skip to content

Instantly share code, notes, and snippets.

View krhoyt's full-sized avatar

Kevin Hoyt krhoyt

View GitHub Profile
@krhoyt
krhoyt / tessel-climate-parse.js
Created November 20, 2014 15:50
First Steps with Tessel
// Libraries
var climate = require( 'climate-si7020' );
var parse = require( 'parse' ).Parse;
var tessel = require( 'tessel' );
var wifi = require( 'wifi-cc3000' );
// Constants
var PARSE_APP = '_YOUR_APP_KEY_';
var PARSE_KEY = '_YOUR_JAVASCRIPT_KEY_';
@krhoyt
krhoyt / proxy.html
Created November 20, 2014 16:20
Personal data proxy.
<html>
<head>
<title>Proxy Test</title>
<script>
// Echo
var echo = {
action: "ECHO",
whatever: {
@krhoyt
krhoyt / pubnub.ino
Created December 2, 2014 21:31
Spark Core to PubNub
// Libraries
#include <math.h>
// Literals
#define THERMISTOR A0
// Constants
// Thermistor computation
const float ANALOG_STEPS = 4095.0;
const float B_THERM = 3977.0;
@krhoyt
krhoyt / spinning-color-wheel.html
Created December 5, 2014 17:00
Spinning color wheel ... Mostly just because the idea popped into my head.
<html>
<head>
<title>Spinning Color</title>
<!-- Styles -->
<style type="text/css">
@-webkit-keyframes spin {
from {
transform: rotate( 0deg );
@krhoyt
krhoyt / basic-pubnub.php
Created December 5, 2014 18:13
Basic example of publishing to PubNub from PHP. Really distilled down to just the REST calls.
<?php
$CHANNEL = "iot";
$PUB_KEY = "_YOUR_PUBLISH_KEY_";
$SUB_KEY = "_YOUR_SUBSCRIBE_KEY_";
$SECRET_KEY = "_YOUR_SECRET_KEY_";
$PUBNUB = "http://pubsub.pubnub.com";
$data = array(
"count" => 3
@krhoyt
krhoyt / amqp-boilerplate.html
Created December 5, 2014 19:19
Boilerplate for Kaazing Gateway AMQP JavaScript client.
<html>
<head>
<title>AMQP Boilerplate</title>
<script src="http://localhost:8001/demo/amqp/javascript/WebSocket.js" type="text/javascript"></script>
<script src="http://localhost:8001/demo/amqp/javascript/AmqpClient.js" type="text/javascript"></script>
<script>
// Constants
@krhoyt
krhoyt / firebase.php
Created December 6, 2014 19:29
Interact with Firebase from PHP.
<?php
// Constants
$FIREBASE = "_YOUR_FIREBASE_URL_";
$NODE_DELETE = "temperature.json";
$NODE_GET = "temperature.json";
$NODE_PATCH = ".json";
$NODE_PUT = "temperature.json";
// Data for PUT
@krhoyt
krhoyt / yun-firebase.ino
Last active May 22, 2017 11:10
From Arduino Yun to Firebase (DHT22 temperature and humidity).
// Arduino libraries
#include <Bridge.h>
#include <Console.h>
#include <Process.h>
// Third-party library
// https://github.com/RobTillaart/Arduino
#include <dht.h>
// Literals
@krhoyt
krhoyt / oop-javascript.js
Created December 24, 2014 19:57
Basic OOP template for JavaScript libraries.
// Originally
// http://phrogz.net/js/classes/OOPinJS.html
function Proxy()
{
// Private variables and methods
// Only priveleged
var MY_PRIVATE = "PRIVATE";
var moar_private = null;
@krhoyt
krhoyt / parse-cookie.js
Created February 10, 2015 20:40
Parse a cookie value containing JSON (sent from Node/Express).