Skip to content

Instantly share code, notes, and snippets.

/**
* simple groovy server using spring boot
*
* spring run script.groovy
*
* uses:
*
* https://spring.io/blog/2013/08/06/spring-boot-simplifying-spring-for-everyone
* http://spring.io/guides/gs/uploading-files/
*
@robshep
robshep / pom.xml-snippet
Created December 30, 2014 22:24
Force sping profile "test" during maven testing
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<spring.profiles.active>test</spring.profiles.active>
</systemPropertyVariables>
</configuration>
{
"plugins" : {
"metalsmith-static": {
"src": "public",
"dest": "."
}
}
}
@robshep
robshep / geojson.js
Last active August 29, 2015 14:19
basic restify/node.js based server for providing GeoJSON features
// npm install restify pg
/**
* Configure the tables and the columns required as properties
*/
var tables = {
'boundary' : { geom:'polygon', cols:['id', 'area_id', 'org_id'] },
'stage' : { geom:'route', cols:['id', 'event_id', 'name', 'outandback', 'start_time', 'num', 'distance'] },
'stagepoi' : { geom:'point', cols:['id', 'stage_id', 'type' ] }
};
@robshep
robshep / index.html
Last active August 29, 2015 14:21
Touch Wheel Menu
<!DOCTYPE html>
<!-- saved from url=(0065)http://konvajs.github.io/downloads/code/sandbox/Star_Spinner.html -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>Konva WheelSpin Demo</title>
<style>
body {
margin: 0;
overflow: hidden;
background-color: #F0F0F0;
@robshep
robshep / delete_eav_from_hstore.sql
Last active August 29, 2015 14:22
Build an HStore-based query index for EAV attributes
CREATE OR REPLACE FUNCTION delete_thing_att_map_hstore()
RETURNS trigger AS
$BODY$BEGIN
update
thing
set
att_map = ( att_map - OLD.def_id::text )
WHERE
id = NEW.thing_id;
@robshep
robshep / http_config.ng.js
Last active August 29, 2015 14:23
Common AngularJS HTTP configurations
/**
* @author Rob Shepherd
*/
'use strict';
;(function(){
angular.module('sbHttpConfig', [])
.factory('httpRedirectionInterceptor', ['$location', function($location) {
var width = 0.7; // to 2.3
var freq = 20; // to 100;
var i = null;
var go = function(){
i = setInterval(function() {
digitalPulse(B10, 1, width);
}, freq);
};
@robshep
robshep / writeup.md
Last active August 29, 2015 14:26
JSOxford - Hacking the NodeBots - July 2015

JSOxford - Hacking the NodeBots - July 2015

Last saturday saw the middle of three events in the Summer of Hacks series from JSOxford.

The guys put together a great event in partnership with Gordon from Pur3. Gordon is the talented inventor of the Espurino family of javascript powered microcontrollers and had previously given a talk to the group about the boards, so most people were already juiced up to try it out.

A heap of wires, batteries, servos and other electronics had been duly arranged and Gordon had even gone to the supreme effort of developing a printed circuit board to form the chassis of the mobile robot and had instructions prepared to give us a head start of assembling our soon-to-be planet destroying synthetic lifeform underlings!

@robshep
robshep / overlappingQueueDispatch.js
Created September 28, 2012 11:45
Mutex for overlapping online queue dispatching in JS (node)
var $ = require("jquery");
var things = ["a", "b", "c", "d", "e", "f"];
var mutex = 0;
var onSuccess = function( data){
console.log(" Success: " + data + " [" + mutex + "]");
var sentThing = things.shift();
console.log(" Dequeue item: " + sentThing + " [" + mutex + "]")