Skip to content

Instantly share code, notes, and snippets.

/*-- Enrolment view page - Start --*/
/* The frame */
table.enrolmentTableFrame
{
/* The colour of the frame */
background-color:#336699;
/* Margin from the frame to the text inside it */
padding:20;
/* Margin round the frame */
@possan
possan / radio1.pde
Created February 20, 2013 15:10
hackday radio hardware code
int LED = 11;
int SWITCH = 10;
// int VOLUME = A1;
int KNOB0 = 9;
int KNOB1 = 8;
// 00 -> 10 -> 11 -> 00
int knobstate = 0;
@possan
possan / node-tts-mp3.js
Created February 15, 2013 17:30
Simple rest-y osx text-to-speech service returning mp3's
var restify = require('restify');
var crypto = require('crypto');
var spawn = require('child_process').spawn;
var fs = require('fs');
function voiceRespond(req, res, next) {
var voice = req.params.voice;
var text = req.query.text;
var key = voice+'___'+text;
var hash = crypto.createHash('md5').update(key).digest("hex");
@possan
possan / robot.js
Created December 5, 2012 11:26
ASDF1
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
this.t = 9;
this.d = 1;
};
Robot.prototype.onWallCollision = function(ev) {
var robot = ev.robot;
@possan
possan / loopback.js
Created October 26, 2012 13:42
Simple loopback queue thing in node, post messages back and forth between the two queues.
var http = require('http');
var qs = require('querystring');
var frontport = 10000;
var backport = 10001;
var Queue = function() {
this.data = [];
};
@possan
possan / cufonhacketyhack.html
Created September 27, 2012 15:54
Using Cufon fonts inside a <canvas> in Spotify
<html>
<head>
<script src="cufon-yui.js" type="text/javascript"></script>
<script src="Raleway_Dots_400.font.js"></script>
</head>
<body>
<h1 id="h1">HELLO CUFON CANVAS!</h1>
<canvas id="a" width="200" height="200" style="background-color:#ccc;"></canvas>
<script type="text/javascript">
Cufon.set('engine', 'canvas');
@possan
possan / gist:3090607
Created July 11, 2012 14:13
Asynchronous mapper in javascript with timeout
Array.prototype.mapAsync = function(mapper, finalcallback, timeout) {
var mappertimeout = timeout || 10000;
var waiting = 0;
var that = this;
var newlist = [];
var _donecallback = function() {
waiting --;
console.log('after async mapper done');
if (waiting === 0) {
@possan
possan / gist:3083478
Created July 10, 2012 14:08
Simple asynchronous mapper in javascript
Array.prototype.mapAsync = function(mapper, finalcallback) {
var waiting = 0;
var that = this;
var newlist = [];
this.forEach(function(item) {
// console.log('starting async mapper', item);
waiting ++;
setTimeout(function() {
mapper(item, function(newitem) {
@possan
possan / gist:2975870
Created June 23, 2012 00:00
Arduino RFID Ethernet junk
#include <SPI.h>
#include <Ethernet.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(8, 9);
byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x88 };
IPAddress server(91,123,198,230); // Google
int port = 80;
EthernetClient client;
int sent = 0;
<html>
<head>
<link rel="stylesheet" href="sp://import/css/eve.css" />
<script src="jquery.min.js"></script>
<script>
$(document).ready(function() {
sp = getSpotifyApi(1);
var m = sp.require("sp://import/scripts/api/models");