Skip to content

Instantly share code, notes, and snippets.

<?php
/*
Extract the data represented as an array of columns and represent it as an
array of rows.
Assert that the data in all non-empty columns is of the same length.
Represent empty columns with an array of $zeros.
*/
@aprimc
aprimc / less_flimsy_arduino_ocelli.ino
Created October 28, 2012 15:26
Less Flimsy Arduino Ocelli
/*
Less Flimsy Arduino Ocelli
Get the direction of the source of light from three photoresistors.
Andrej Primc <aprimc@gmail.com> (http://fgh.si)
*/
@aprimc
aprimc / flimsy_arduino_ocelli.ino
Created October 27, 2012 21:10
Flimsy Arduino Ocelli
/*
NOTE: don't use this, use https://gist.github.com/3968902 instead
Flimsy Arduino Ocelli
Get the direction of the source of light from three photoresistors and
present it as a number on a clock dial.
Andrej Primc <aprimc@gmail.com> (http://fgh.si) inspired by the bees
@aprimc
aprimc / ntph.py
Created September 26, 2012 18:33
Packrat parser for Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from copy import copy
class T:
def __init__(self, tag, value = None, props = None, comment = None, head = False, assign = None, agree = None, consume = None):
# tag
@aprimc
aprimc / robots_txt.erl
Created September 26, 2012 18:24
robots.txt parser for Erlang
%% @author Andrej Primc
%% @copyright 2011 Andrej Primc
%% @doc Utility for parsing robots.txt file.
-module(robots_txt).
-export([parse/1, parse/2, is_allowed/2, is_allowed/3]).