Skip to content

Instantly share code, notes, and snippets.

@brendanberg
brendanberg / circles.dbn
Created February 25, 2019 18:53
Sample DBN programs
Command Circlepixels cx cy dx dy v
{
Set [(cx+dx) (cy+dy)] v
Set [(cx+dx) (cy-dy)] v
Set [(cx-dx) (cy+dy)] v
Set [(cx-dx) (cy-dy)] v
Set [(cx+dy) (cy+dx)] v
Set [(cx+dy) (cy-dx)] v
Set [(cx-dy) (cy+dx)] v
Set [(cx-dy) (cy-dx)] v
@brendanberg
brendanberg / combinators.js
Created December 28, 2018 23:23 — forked from Avaq/combinators.js
Common combinators in JavaScript
const I = x => x;
const K = x => y => x;
const A = f => x => f(x);
const T = x => f => f(x);
const W = f => x => f(x)(x);
const C = f => y => x => f(x)(y);
const B = f => g => x => f(g(x));
const S = f => g => x => f(x)(g(x));
const P = f => g => x => y => f(g(x))(g(y));
const Y = f => (g => g(g))(g => f(x => g(g)(x)));
@brendanberg
brendanberg / document_navigation.md
Last active August 12, 2016 22:57
What would a better JSON look like?

Referencing Values within HRON Documents

HRON-Path is a standard for accessing values within HRON documents.

("urn:isbn:978-1891024634") {
  title: "Andy Warhol Prints: A Catalogue Raisonné 1962-1987",
  edition: "4th Revised, Expanded Edition (April 2, 2003)",
  publisher: <href: "https://www.wikidata.org/wiki/Q5283109",
    type: "https://schema.org/Organization">,
  dimensions: "9.8 x 1.5 x 11.8 inches",
@brendanberg
brendanberg / policy.json
Created October 27, 2014 15:19
Amazon S3 Policy Example
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListAllMyBuckets"
],
"Resource": "arn:aws:s3:::*"
},
@brendanberg
brendanberg / gist:633b62c49bb20219ca1d
Last active August 29, 2015 14:06
Python's dateutil module, everybody!
>>> from dateutil import parser
>>> parser.parse('0001-01-01')
datetime.datetime(2001, 1, 1, 0, 0)
>>> parser.parse('0010-01-01')
datetime.datetime(2001, 10, 1, 0, 0)
>>> parser.parse('0015-01-01')
datetime.datetime(2001, 1, 15, 0, 0)
println("Hello")
var conn = Socket().connect(8000, address: "127.0.0.1").listen(limit:128).accept() { connection, address in
println("Accepted a connection from port \(address.addressString)")
return connection
}.read() { connection, inStr in
let arr = inStr.componentsSeparatedByString("\n")
let response = (arr[0].uppercaseString + "\n")
return connection.write(response)
}.close()

Bruce Graham Interviewed by Detlef Mertins

August 7, 2002
Hobe Sound, Florida

Detlef Mertins: During the forty years that you were at SOM, what would you say were the guiding principles, approaches, or ideas for your architecture?
Bruce Graham: Most important was working in Chicago, which I think is still the best architectural city in the United States. It gave you direction, an overall direction. I don't mean that you had to imitate other architects like Frank Lloyd Wright, Louis Sullivan, or even Mies. But there was a great tradition in architecture and a city that was perfectly planned after the big fire. It has a grid and a beach that goes all the way from Indiana to Milwaukee. The grid created a sense of direction for the people. It created neighborhoods with their own parks, their own school systems, and so on. I followed that kind of philosophy.

DM: So you inherited an architectural tradition and a body of work that you saw as a positive influence, something that you had to respon

@brendanberg
brendanberg / story.md
Last active July 5, 2021 22:22
How to tell a computer what to do using words instead of numbers.

Sometimes we want to tell computers what to do. People like using words to tell people or things what to do. But computers don't understand words in this way. Instead, they understand numbers that tell them what to do. So we need to tell computers what the words mean as numbers. This is an easy story that tells how we can do that (but doesn't tell in fine points).

To tell computers what words mean as numbers, we can write words that change other words into numbers. To do this, we need to decide what words we can use and what orders we can use them in. Then we need to tell the computer what to do with these words.

Even though a computer can't read words that tell it what to do, it can see if one word is the same as another word. It can do this for one word after another after another. We can tell the computer what words are allowed to follow earlier words. And we can give these groups of words names. Some groups of words can have other named groups of words inside them. Some words by themselves have names wi

@brendanberg
brendanberg / pangrams.txt
Created November 16, 2012 00:54
Pangrams
A wizard's job is to vex chumps quickly in fog.
Who packed five dozen old quart jars in my box?
Boxers have zap of gay jock love and quit women.
Watch "Jeopardy!", Alex Trebek's fun TV quiz game.
How razorback jumping frogs can level six piqued gymnasts.
Grumpy wizards make toxic brew for the evil Queen and Jack.
@brendanberg
brendanberg / gist:4080423
Created November 15, 2012 18:49
A Parsing Expression Grammar to Turn Buffalo into Fish
/*
* Use this at http://pegjs.majda.cz/online
*
* Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo
* - becomes -
* Fishy fish fishy fish fish fish fishy fish
*
* Also, the grammar is recursive, so it could also generate ALL THE FISH.
*/