Skip to content

Instantly share code, notes, and snippets.

View thedaniel's full-sized avatar

Daniel Hengeveld thedaniel

View GitHub Profile
@thedaniel
thedaniel / gist:1721108
Created February 2, 2012 02:52
expressapp.js
var app = express.createServer(
express.static(__dirname + '/public')
);
app.get(
'/discover',
function(req, res){
var description = {
channel: clientPublishableChannelData,
subscription: clientSubscriptionData
@thedaniel
thedaniel / gist:1721093
Created February 2, 2012 02:50
subscribe
// ... callback continued from last gist
spire.subscribe(
'client-publishable-channel',
function(messages){
for (var i=0;i<messages.length;i++){
var content = messages[i].content;
var tnetnoc = content.split('').reverse().join('');
spire.publish('client-subscribable-channel', tnetnoc, function(){});
}
}
@thedaniel
thedaniel / gist:1721075
Created February 2, 2012 02:44
createAndAssign.js
spire.start(process.env.SPIRE_KEY, function(err, session) {
spire.channel(
'client-publishable-channel',
function(err, channel){
if (!err) {
clientPublishableChannelData = {url: channel.data.url, capability: channel.data.capability};
}
}
);
@thedaniel
thedaniel / gist:1720921
Created February 2, 2012 02:06
Spire capabilities 1
var Spire = require('spire.io.js');
var express = require('express');
if (!process.env.SPIRE_KEY){
console.log("You must set a SPIRE_KEY environment variable");
process.exit(1);
}
var spire = new Spire();
var clientSubscriptionData;
import spire
import requests
client = spire.Client('http://localhost:1337', key='1', async=False)
session = client.session()
print session.url
channel = session.channel()
channel.publish('mr watson. come here. i need you.')
session = client.session()
Global channel:
=============
http://localhost:1337/session/6/channel/16
None
[u'mr watson. come here. i need you.']
Named channel:
=============
http://localhost:1337/session/6/channel/17
foo
[u'What hath Shark wrought?']
Global channel:
=============
[u'mr watson. come here. i need you.']
Named channel:
=============
[u'What hath Shark wrought?']
Subchannel:
=============
[u'Can you hear me now?']
import subprocess
for i in range(0,1500):
subprocess.call("convert -size 1024x768 plasma: image-%i.jpg" % i, shell=True)
No Gecko sdk detected. Install xulrunner-dev to compile 64-bit Firefox extension.No srcs specified for selenium-core
** Invoke //rb:gem:build (first_time)
** Invoke build/selenium-webdriver-0.0.31.dev.gem (first_time)
** Invoke //rb:chrome (first_time)
** Invoke //rb:common (first_time)
** Execute //rb:common
Preparing: //rb:common in build/rb
** Invoke //rb:remote (first_time)
** Invoke //rb:common
** Execute //rb:remote