Skip to content

Instantly share code, notes, and snippets.

View jonathanhculver's full-sized avatar

Jon Culver jonathanhculver

View GitHub Profile
@jonathanhculver
jonathanhculver / index.html
Last active December 22, 2015 02:49
webrtc html for webcam
<video id="videoInput" width="640px" height="480px" autoplay></video>
<img id="img" src="" style="display: none" />
<canvas width="440px" height="580px" style="display:none;"></canvas>
@jonathanhculver
jonathanhculver / voice.rb
Created August 16, 2013 00:08
a simple voice menu
post '/voice.json' do
t = Tropo::Generator.new
t.ask :name => 'digit',
:timeout => 60,
:say => {:value => "Hello! What year were you born?"},
:choices => {:value => "[4 DIGITS]"}
t.on :event => 'continue', :next => '/continue.json'
@jonathanhculver
jonathanhculver / sms.rb
Created August 16, 2013 00:04
Send text messages to an array of phone numbers
toArray = []
$smsToken = ''
$phoneNumber = ''
get '/text' do
toArray.each do |element|
callSmsScript("Hi", element)
sleep(5)
end
@jonathanhculver
jonathanhculver / Default.sublime-theme
Created July 13, 2013 21:36
Dark theme (twilight) for sublime text folder sidebar. Click Browse Packages and add file named "Default.sublime-theme" to Packages/User
[
{
"class": "sidebar_container",
// right border
"layer0.tint": [84,84,84],
"layer0.opacity": 1.0,
"layer0.draw_center": false,
"layer0.inner_margin": [0, 0, 1, 0],
"content_margin": [0, 0, 1, 0]
},
@jonathanhculver
jonathanhculver / wifiJS.js
Created June 24, 2013 03:34
wifi lamp JS
window.onload = function() {
/* ip address of arduino */
var URL = "00.0.0.0";
var lightDiv = $('#lightbulbContainer');
/* find out current state of the light and adjust the UI accordingly */
$.ajax({
type: "GET",
url: URL+"/led=-1"
void printWebResponse(WiFiClient client, String lightStatus) {
Serial.println();
// so the http request has ended and we can send a reply
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Access-Control-Allow-Origin: *");
client.println("Content-Type: text/html");
client.println();
client.println("{\"status\":\""+lightStatus+"\"}");
}
@jonathanhculver
jonathanhculver / changeLight.ino
Created June 24, 2013 03:23
/* changes the light or reports its status */
/* changes the light or reports its status */
String changeLight(int val) {
/* turn light on */
if(val== 1) {
digitalWrite(pin, HIGH);
lightStatus = "on";
/* turn light off */
} else if(val==0) {
digitalWrite(pin, LOW);
lightStatus = "off";
@jonathanhculver
jonathanhculver / processing.ino
Created June 24, 2013 03:19
arduino web server processing input
while (client.connected()) {
if (client.available()) {
if(finder.find("GET /")) {
while(finder.findUntil("led", "\n\r")) {
char type = client.read();
int val = finder.getValue();
lightStatus = changeLight(val);
}
}
//pass a simple http response to the browser
@jonathanhculver
jonathanhculver / voteinflator.rb
Created May 13, 2013 02:11
Ruby app code for vote inflator
require 'rubygems'
require 'sinatra'
require 'haml'
require 'tropo-webapi-ruby'
require 'net/http'
set :public_folder, 'public'
tropoToken = ""
#phone numbers to send messages from
fromArray = ['9999999999','9999999999', '9999999999']
@jonathanhculver
jonathanhculver / callscreen.js
Created March 26, 2013 01:29
A call screener app
/* https://github.com/tropo/tropo-webapi-node */
var tropowebapi = require('tropo-webapi');
/* Express framwork http://expressjs.com */
var express = require('express');
/* http://mongoosejs.com/ */
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/track');
mongoose.connect(URI);
//connect to mongodb