Skip to content

Instantly share code, notes, and snippets.

<html>
<body>
<svg id="svg" width="600" height="200">
<rect width="100" height="100" style="fill:rgb(255,0,0);stroke-width:1;stroke:rgb(0,0,0)"/>
<rect width="100" height="100" style="fill:rgb(0,0,255);stroke-width:1;stroke:rgb(0,0,0)"/>
<rect width="100" height="100" style="fill:rgb(0,0,255);stroke-width:1;stroke:rgb(0,0,0)"/>
<rect width="100" height="100" style="fill:rgb(0,0,255);stroke-width:1;stroke:rgb(0,0,0)"/>
<rect width="100" height="100" style="fill:rgb(0,0,255);stroke-width:1;stroke:rgb(0,0,0)"/>
<rect width="100" height="100" style="fill:rgb(0,0,255);stroke-width:1;stroke:rgb(0,0,0)"/>
<rect width="100" height="100" style="fill:rgb(0,0,255);stroke-width:1;stroke:rgb(0,0,0)"/>
@kavanagh
kavanagh / index.html
Last active December 24, 2015 10:39 — forked from anonymous/index.html
<!DOCTYPE html>
<html>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
.marker-properties {
border-collapse:collapse;
font-size:11px;
@kavanagh
kavanagh / map.geojson
Created August 28, 2013 16:35
via:geojson.io
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kavanagh
kavanagh / map.geojson
Created August 28, 2013 16:32
via:geojson.io
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kavanagh
kavanagh / split-paragraphs.js
Created June 24, 2013 12:18
Split a string into paragraphs
var body = '<p>' + (row.body || '').split(/[\r\n\t]+/gm).join('</p><p>') + '</p>';
@kavanagh
kavanagh / job.sh
Created June 20, 2013 16:43
function to quickly make an interactive job
# 's' below refers to symlinked sublime
# all refers to 'testem' remove this if you dont need it
function job() {
if [[ -z "$1" ]]; then
echo "You must specify a project name!"
return;
fi
mkdir $1 && cd $1 && yo ig-job && s . && s ./app/scripts/main.js && s ./app/scripts/config.js && \
osascript -e 'tell application "Terminal" to activate' -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down' -e 'tell application "Terminal" to do script "cd '$PWD' && testem" in selected tab of the front window' && \
grunt server;
@kavanagh
kavanagh / example.js
Created May 14, 2013 08:41
Very simple topic subscription.
var a = topic();
a.add(function(){
console.log('a', arguments);
});
a.fire('message for a'); // should be "a", ["message for a"]
// named topic
var b = topic('b');
@kavanagh
kavanagh / wrap-paragraphs.js
Created April 24, 2013 15:14
Wrap an array of strings with p tags
var paragraphs = ['paragraph 1', 'paragraph 1'];
var html = '<p>' + paragraphs.join('</p><p>') + '</p>';
@kavanagh
kavanagh / nodejs.sh
Created October 31, 2012 18:55 — forked from crcastle/nodejs.sh
Node.js tartup script for AWS EC2 Linux box
#!/bin/bash
# nodejs - Startup script for node.js server
# chkconfig: 35 85 15
# description: node is an event-based web server.
# processname: node
# server: /path/to/your/node/file.js
# pidfile: /var/run/nodejs.pid
#
@kavanagh
kavanagh / json-spider.js
Created October 2, 2012 01:19
A very simple node script to spider JSON web services.
var request = require( 'request' ),
fs = require( 'fs' ),
util = require( 'util' );
var todo = process.argv.splice( 2 ),
processor = {
'/rest/path/foo/bar': {
'response.result.cid': function( str ) {