Skip to content

Instantly share code, notes, and snippets.

View paulbjensen's full-sized avatar

Paul Jensen paulbjensen

View GitHub Profile
@paulbjensen
paulbjensen / ping.coffee
Created June 19, 2011 13:09
A simple ping script
request = require 'request'
ping = (value) ->
id = "4dfdf1bbd8e35f858f000003"
url = "localhost:3000"
request {uri: "http://#{url}/api/app/transmit?id=#{id}&value=#{value}"}, (err, res, body) ->
ping item for item in [1..10000]
@paulbjensen
paulbjensen / Cakefile
Created October 19, 2011 18:46
A CoffeeScript Cakefile to generate a control deploy.coffee file for your application
fs = require 'fs'
task "deploy_script", "Creates a deployment script for your application", ->
appName = "appName"
serverEnvironment = "staging"
serverAddress = "myserver.com"
sshUsername = "app"
startCommand = "/etc/init.d/#{appName} start"
stopCommand = "/etc/init.d/#{appName} stop"
restartCommand = "/etc/init.d/#{appName} restart"
@paulbjensen
paulbjensen / task.coffee
Created June 21, 2012 22:57
A WIP on doing something with project Shogun
# A task in project shogun
#
class Task
constructor: (@name, options={}) ->
@status = 'todo'
@[key] = value for key,value of options
start: ->
@status = 'in progress'
@paulbjensen
paulbjensen / script.coffee
Created July 9, 2012 21:42
A script used to transmit geo-located tweets about Nike to Dashku
# The script that I use to broadcast tweets about
# Nike to Dashku's demo account, in CoffeeScript.
# require some npm libraries
Twit = require 'twit'
analyze = require('Sentimental').analyze
Placefinder = require 'placefinder'
dashku = require 'dashku'
# Set your API Key
@paulbjensen
paulbjensen / ec2.js
Created October 2, 2012 14:19
A wrapper around the aws2js npm module to provide some API calls specific to Amazon EC2
// Amazon AWS EC2 API wrapper
//
var aws2js = require('aws2js');
var ec2;
var ec2Api = {
// A helper function to supply API access credentials to Amazon
//
init: function(accessKeyId, secretAccessKey) {
@paulbjensen
paulbjensen / world.coffee
Created May 20, 2013 10:09
This is the world.coffee file used at Axisto Media for an application in current development. It demonstrates how to boot a selenium server just once, make it available to your step definitions, and kill it once all of your cucumber.js feature have finished running.
# Selenium launcher is a great npm module for booting
# selenium server via a Node.js process.
selenium = require 'selenium-launcher'
soda = require 'soda'
process.env.NODE_ENV = "cucumber"
# This is our app's file.
server = require '../../server'
# We add some empty variables to store the web browser
@paulbjensen
paulbjensen / tweet_list.coffee
Created August 20, 2013 14:24
The world map and tweet list widgets from the Dashku demo
module.exports =
css: "ul {\n list-style-type: none;\n margin-left: 0px;\n margin-top: 10px;\n}\n\nli {\n padding: 5px;\n background: rgba(255,255,255,0.03);\n margin: 5px;\n border-radius: 5px;\n color:#f1f1f1;\n cursor: pointer;\n}\n\n* content ul {\n overflow: clip; \n}"
height: 608
html: "<ul id=\"tweets\">\n <li></li>\n</ul>"
json: "{\n \"text\": \"I just finished a 8.02 mi run with Nike+ Running. #nikeplus\",\n \"location\": {\n \"latitude\": \"51\",\n \"longitude\": \"0\"\n },\n \"sentiment\": 1,\n \"tweet_id\": \"24324324234\",\n \"screen_name\": \"jeese\",\n \"_id\": \"4fe772d77c249dc40e0004d7\",\n \"apiKey\": \"c19cabb2-85d6-4be0-b1d6-d85a19b8245e\"\n}"
name: "on Twitter"
script: "// You can use 3rd-party libraries with your widget. For more information, \n// check out the Docs section titled 'Using 3rd-party JS libraries'.\n\n// The widget's html as a jQuery object\nvar widget = this.widget;\n\n// This runs when the
@paulbjensen
paulbjensen / streamWrite.js
Created October 7, 2013 17:41
A script to replicate an issue with stream writing.
'use strict';
// Dependencies
//
var fs = require('fs'),
oldFilePath = 'oldFile.txt',
read = fs.createReadStream(oldFilePath),
write = fs.createWriteStream('./.newFile.txt');
@paulbjensen
paulbjensen / example_dashku.js
Created July 13, 2014 05:59
Example usage of Dashku's node module to send data to Dashku
var dashku = require('dashku');
var payload = {
"bigNumber": 200,
"_id": "53c21e50c24b67fb166beed4",
"apiKey": "a4f368ba-0a46-4e3f-a2fd-f1b68ffe64af"
};
dashku.setApiKey(payload.apiKey, function () {
@paulbjensen
paulbjensen / handover.md
Created September 27, 2015 10:56
Handing over SocketStream to Henrik

Hi everyone,

I'm pleased to announce that SocketStream has a new project leader, Henrik Vendelbo.

A while ago I asked if Henrik would like to consider taking over from me - he had managed to do more for SocketStream in 12 months than I had managed to do in a couple of years, and given that I was in the middle of writing a book for Manning publications and looking to move countries, it felt right to hand over the project to someone with more time.

I still have a lot of love for the project, but my time has been stretched, and so I found myself in a similar position to the one that Owen was in 2 years ago when he handed the project over to me. Running an open source software project can be a huge undertaking, and if you have the time its great, but if not then it becomes a struggle. I've discovered that for myself, and I knew I'd need to step back from my commitments rather than try and do all the things.

I'm happy to have made a dent in getting SocketStream to a more certain place - dealing with the 0.3/0.