Skip to content

Instantly share code, notes, and snippets.

View washort's full-sized avatar

Allen Short washort

View GitHub Profile
{% set amo_user = request.amo_user %}
{% if user.is_authenticated() %}
<li class="account">
<a href="#" class="user" title="{{ amo_user.email }}">
{{ amo_user.welcome_name }}</a>
{% if account_links %}
<ul>
{% for link in account_links %}
{% if not loop.last %}
<li><a href="{{ link.href }}">{{ link.text }}</a></li>
@washort
washort / gist:2837637
Created May 30, 2012 17:01
EoCL changes
git diff -M HEAD
M lisp/base.lisp
M lisp/float.lisp
M lisp/util.lisp
diff --git a/lisp/base.lisp b/lisp/base.lisp
index 3ba43b3..21f6fe5 100644
--- a/lisp/base.lisp
from unittest import TestCase
from terml.twine import SourceSpan, Twine
class SourceSpanTests(TestCase):
def test_creation(self):
ss = SourceSpan("http://example.org/t", True, 1, 0, 1, 9)
self.assertEqual(ss,
SourceSpan("http://example.org/t", True, 1, 0, 1, 9))
self.assertEqual(list(ss), ["http://example.org/t", True, 1, 0, 1, 9])
@washort
washort / gist:3077043
Created July 9, 2012 15:03 — forked from Drvanon/gist:3077030
subclassing
materials = { "iron": {"hardness": 4, "organic": False}}
@washort
washort / tutorial.rst
Created August 14, 2012 04:32
parsley docs

magcius loves parsley

Parsley Tutorial

Four function calculator:

digit = anything:x ?(x in '0123456789')
number = <digit+>:ds -> int(ds)
ws = ' '*
muldiv = value:left ws ('*' value:right -> left * right
@washort
washort / tutorial.rst
Created August 16, 2012 06:24
parsley tutorial

Parsley Tutorial

From Regular Expressions To Grammars

Parsley is a pattern matching and parsing tool for Python programmers.

@washort
washort / tutorial.rst
Created August 18, 2012 06:29
parsley tutorial

Parsley Tutorial

From Regular Expressions To Grammars

Parsley is a pattern matching and parsing tool for Python programmers.


Now that you are familiar with the basics of Parsley syntax, let's look at a more realistic example: a JSON parser.

The JSON spec on http://json.org/ describes the format, and we can adapt its description to a parser. We'll write the Parsley rules in the same order as the grammar rules in the right sidebar on the JSON site, starting with the top-level rule, 'object'. :: object = token('{') members:m token('}') -> dict(m)

@washort
washort / example_bot.py
Last active December 13, 2015 21:59
txurntable, a turntable client using twisted and autobahn
import txurntable
from twisted.internet import reactor
auth = "..."
userid = "..."
roomid = "..."
def turntableStart(bot):
def speak(data):
name = data['name']