Skip to content

Instantly share code, notes, and snippets.

View gobengo's full-sized avatar

Benjamin Goering gobengo

View GitHub Profile
@gobengo
gobengo / index.html
Created December 12, 2011 19:03 — forked from ninowalker/server.py
A simple web server in two (three) steps
<html>
<head></head>
<body>
<p>Hello, world!</p>
</body>
</html>
@gobengo
gobengo / GraphMatrix
Created January 21, 2011 06:20
Check it out
Imagine graph G with vertexes A, B, C (sketch this if that's your thing). G has the following directed edges:
A->B
B->C
C->A
Basically this is a triangle with a loop. Now, let's say we model this with a binary matrix. Edge A->B means that G[A][B]=1. Similarly: G[B][C], G[C][A] = 1, 1. Think about this 2D array as a matrix G1:
ABC
A010
B001
C100
>>> class X:
... pass
...
>>> @classmethod
... def mysum(cls, x, y):
... return x + y
...
>>> X.setattr('s', mysum)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
@gobengo
gobengo / xsdDateTime.js
Created June 8, 2015 23:08
JavaScript xsd:dateTime Parser
// built from definition: http://books.xmlschemata.org/relaxng/ch19-77049.html
var xsdDateTimePattern = new RegExp([
'(\\d{4})', //year
'-',
'(\\d{2})', // month
'-',
'(\\d{2})', // day
'T',
'(\\d{2})', // hour
':',