Skip to content

Instantly share code, notes, and snippets.

@johnschimmel
johnschimmel / gist:814485
Created February 7, 2011 14:59
Titanium Facebook Graph Session
Titanium.Facebook.sessionForAccessToken = function(callback) {
var app_id = '<APP_ID>';
var app_secret = '<APP_SECRET>';
xhr.onerror = function(e)
{
Ti.API.info('Unable to exchange session for OAuth access_token ' + e.error);
callback(false);
};
xhr.setTimeout(10000);
@johnschimmel
johnschimmel / nodeDualTcp.js
Created June 8, 2011 20:18
nodejs dual tcp server to pass data between ports
var net = require('net');
var guestsA = [];
var guestsB = [];
var serverA = net.createServer(function (socket) {
//socket.write("Echo server\r\n");
//socket.pipe(socket);
});
@johnschimmel
johnschimmel / accessorySwitch.pde
Created July 28, 2011 12:25
Arduino accessory switch for Steven/PS3
/*
Button
Turns on and off a light emitting diode(LED) connected to digital
pin 13, when pressing a pushbutton attached to pin 2.
The circuit:
* LED attached from pin 13 to ground
* pushbutton attached to pin 2 from +5V
@johnschimmel
johnschimmel / arduino_basic_switch.pde
Created September 6, 2011 18:11
Switch into Arduino
// Detect a Switch
// Example to detect a switch press
// Developed for the Developing Assistive Technology class
int switchPin = 2;
int switchValue = 0;
int ledPin = 13;
int counter = 0;
@johnschimmel
johnschimmel / hand.pde
Created October 5, 2011 13:40
Hand with Red Dot
/* --------------------------------------------------------------------------
* SimpleOpenNI Hands3d Test
* --------------------------------------------------------------------------
* Processing Wrapper for the OpenNI/Kinect library
* http://code.google.com/p/simple-openni
* --------------------------------------------------------------------------
* prog: Max Rheiner / Interaction Design / zhdk / http://iad.zhdk.ch/
* date: 02/27/2011 (m/d/y)
* ----------------------------------------------------------------------------
* This demos shows how to use the gesture/hand generator.
@johnschimmel
johnschimmel / inTheLifeMediaSearch.php
Created November 7, 2011 18:52
PHP SOAP request using CURL to retrieve In The Life Station listings
<?php
function getListingsViaSoap($zipcode) {
$url = "http://www.tracmedia.com/lol/LOLService.asmx";
$soap_request = '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<InTheLife xmlns="http://tracmedia.org/">
@johnschimmel
johnschimmel / pubnub-chat.html
Created November 16, 2011 01:48
Telepresence Change color annoy your friends
<html>
<head></head>
<body>
<div><input id=input placeholder=you-chat-here /></div>
<div id="box"></div>
<!--
UPDATE pub-key and sub-key with your info from pubnub
-->
@johnschimmel
johnschimmel / googleDocsAPI
Created December 22, 2011 16:40
Google Docs API + PHP + ClientLogin example
<?php
// Example of how to log into Google API with ClientLogin, good to use when you're not making a webapp.
// code taken and minimally updated from http://kovshenin.com/2009/10/google-docs-api-client-login-with-php-and-curl-1494/
// Construct an HTTP POST request
$clientlogin_url = "https://www.google.com/accounts/ClientLogin";
$clientlogin_post = array(
"accountType" => "HOSTED_OR_GOOGLE",
"Email" => "your@gmail.com",
@johnschimmel
johnschimmel / server_simple.js
Created February 7, 2012 12:28
Simple NodeJS web server example
/************************************************
FILENAME
server_simple.js
DESCRIPTION
creates a simple web server that
display "Hello Dynamic World Wide Web"
HOW TO START SERVER:
1) from terminal run 'node simple_server.js'
@johnschimmel
johnschimmel / server_querystring.js
Created February 7, 2012 14:11
NodeJS web server that accepts a querystring variable in the URL and stores the new name in local variable
/************************************************
FILENAME
server_querystring.js
DESCRIPTION
creates a web server that
display "Hello Dynamic World Wide Web"
it includes a web form to accept a new name from the user via the querystring and displays it.
the new name will be stored in a local variable 'defaultName'.