Skip to content

Instantly share code, notes, and snippets.

@joewalnes
joewalnes / README.md
Created September 22, 2012 18:23
WebSocket Slide Server

Demonstrates a way to build an HTML slide deck and allow multiple browsers to all see slide changes at the same time, triggered by something externally (via an HTTP request). Uses WebSockets to for real time updates.

Instructions

  • Requires Python. Tested on 2.7. Runs on a Pi and any old Linux/OSX setup. Should work on Python 3 - maybe.
  • Install Tornado. You can use pip install tornado or download the tarball from http://www.tornadoweb.org/.
  • Copy slides.html and slide-server.py into the same directory.
  • Run python slide-server.py. Uses sensible defaults. --help for options.
  • Open http://localhost:54321/ in your browser. Recommend Chrome.
@joewalnes
joewalnes / example.html
Created November 1, 2012 21:01
TinyTest.js
<script src="THING_TO_TEST.js"></script>
<script src="tinytest.js"></script>
<script>
TinyTest.run('THING_TO_TEST.js', {
'some test name': function() {
this.assertEquals(1, 2);
},
@joewalnes
joewalnes / home-yet.py
Created December 14, 2012 03:12
Am I home yet?
#!/usr/bin/env python
"""A tiny script that polls your location on Google Latitude, and updates
the color of a Blink1 LED. http://shop.thingm.com/blink1/
Red = At work
Blue = At home
Green = On my way
Should work on Windows, OS-X and Linux. Requires Python 2.7 or later.
@joewalnes
joewalnes / 1. web.xml
Created December 21, 2012 12:47 — forked from anonymous/MyCustomDecoratorSelector.java
Custom SiteMesh 3 configuration - selecting a decorator based on HttpSession.
<web-app>
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.blah.MyCustomSiteMeshFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
@joewalnes
joewalnes / gist:6996934
Created October 15, 2013 19:04
parser notes
"{{foo bar.baz.bam}}"
OPEN ID(foo) ID(bar) SEP ID(baz) SEP ID(bam) CLOSE
root
TemplateNode(statements)
TemplateNode([statement])
TemplateNode([expression])
TemplateNode([ExpressionNode(expression_contents)])
TemplateNode([ExpressionNode(path param* hash?)])
TemplateNode([ExpressionNode(IdNode.build(path_segments) param*)])
TemplateNode([ExpressionNode(IdNode.build(id) param*)])

Keybase proof

I hereby claim:

  • I am joewalnes on github.
  • I am joewalnes (https://keybase.io/joewalnes) on keybase.
  • I have a public key whose fingerprint is 5EE8 93C3 28CD 4BE5 FD9D B392 E50E 80DF 9AD0 F330

To claim this, I am signing this object:

@joewalnes
joewalnes / with-great-regret.js
Last active August 29, 2015 14:01
with great regret
// Let's look at a snippet from a React example here: http://facebook.github.io/react/
// -----------------------------
// This is how you build the React virtual DOM with plain JavaScript.
return (
React.DOM.div(null,
React.DOM.h3(null, "TODO"),
TodoList({items:this.state.items}),
React.DOM.form({onSubmit:this.handleSubmit},
MODULES := ./node_modules
BIN := $(MODULES)/.bin
.PHONY: install_modules all clean
all: install_modules filtrex.js filtrex.min.js
clean:
rm -f filtrex.js
rm -f filtrex.min.js
@joewalnes
joewalnes / 2015.md
Last active August 29, 2015 14:12
My 2015 tech predictions
@joewalnes
joewalnes / go-getter
Last active March 9, 2016 12:58
go-getter: Alternative to "go get" that fixes packages to a version for consistent and repeatable builds.
#!/bin/bash
# Alternative to "go get" that grabs Go packages based on a fixed version.
# Use this to ensure consistent and repeatable builds.
#
# While there are other tools out there that do this, this is really just
# a very small shell script so painless to work into your existing workflow.
#
# Usage:
#