Skip to content

Instantly share code, notes, and snippets.

Patrick Browne ptbrowne

Block or report user

Report or block ptbrowne

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ptbrowne / gist:1462440
Created Dec 11, 2011 — forked from jamescasbon/
Pure python templates using with statement
View gist:1462440
A really stupid python template language inspired by coffeekup, markaby.
Do not use this code, it will ruin your day. A byproduct of insomnia.
This module defines a template language that allows us to do:
d = Doc()
View gist:1502206
# HCI memory structure - core interface
## Objects as structures
namespace java fr.sciencespo.medialab.hci.memorystructure.domain
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# #Natural Language Processing in Python
# #Assignment #2
# Exercises: 4, 8, 12, 13, 18, 25, 26 (Chapter 2)
# Your Turn: Pages 44, 55
from __future__ import division
from PA1 import count_initial_indent, strip_initial_indent, write_doc
ptbrowne / PA3.c
Created Mar 16, 2012
PA3 computer graphics
View PA3.c
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <math.h>
#include <sys/types.h>
#include <GL/glut.h>
#include "FrameXform.h"
#include "WaveFrontOBJ.h"
ptbrowne /
Created Mar 16, 2012
pouring water with bfs
from copy import copy
def ancesters(child, parents):
when given a child and a child->parent dict, returns all child's ancesters
from youngest to oldest
yield child
while parents.get(child):
child = parents.get(child)
ptbrowne / pouring.scala
Created Mar 21, 2012
pouring water scala
View pouring.scala
import collection.mutable.HashSet
import collection.mutable.Queue
import collection.mutable.ArraySeq
case class Container(capacity: Int, filled: Int) {
// overload + and - methods
def +(toAdd: Int) = {
ptbrowne /
Created May 7, 2012
heap based priority queue
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#author : Patrick Browne
from time import time
from random import randint
class Heap(list):
ptbrowne / menufromjson.html
Created Oct 28, 2012
generation of menu from json file (html part)
View menufromjson.html
<title>Menu from Json</title>
<script src="../../lib/jquery-1.7.2.js"></script>
<script src="../../lib/bootstrap/js/bootstrap.js"></script>
<link href="../../lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
body {
ptbrowne / sequence-diagram-in-github.js
Last active Dec 26, 2015
TamperMonkey extension to draw sequence diagram in Github
View sequence-diagram-in-github.js
// ==UserScript==
// @name Sequence Diagram in Github
// @version 0.1
// @description Use to put sequence diagrams in Github
// @match*/*/issues/*
// @require
// @require
// @run-at document-end
// example in Github Issues
import re
import pprint
import requests
You can’t perform that action at this time.