Author Archives: Philip Cunningham

How We See Ourselves

When I was kid we drew pictures of ourselves and our school put them on a tea towel to sell to parents. Strange that even as a ten year old I knew I wanted to be a programmer (3, 10).

Continue reading

Posted in News | Comments Off

LittleLGP – Linear Genetic Programming in Clojure

LittleLGP is a little genetic programming (GP) project written in Clojure. It evolves populations of two distinct classes of programs that have a typical predator prey relationship. One class of program seeks to destabilize the environment whilst the other seeks to bring order.

This project was my first attempt at writing a GP program and my first program written in Clojure. Overall, I really enjoyed working on it, even if the final product isn’t great! The code is available to peruse on Github.

Continue reading

Posted in News | Comments Off

LittleLGP – Linear Genetic Programming in Clojure

LittleLGP is a little genetic programming (GP) project written in Clojure. It evolves populations of two distinct classes of programs that have a typical predator prey relationship. One class of program seeks to destabilize the environment whilst the other seeks to bring order.

This project was my first attempt at writing a GP program and my first program written in Clojure. Overall, I really enjoyed working on it, even if the final product isn’t great! The code is available to peruse on Github.

Continue reading

Posted in News | Comments Off

Computer Science and Religion

I have said that computer science is a lot like magic. And it is really good that it is like magic, because there is also a bad part in computer science that is a lot like religion.

– Harold Ableson (1985)

Continue reading

Posted in News | Comments Off

Computer Science and Religion

I have said that computer science is a lot like magic. And it is really good that it is like magic, because there is also a bad part in computer science that is a lot like religion.

– Harold Ableson (1985)

Continue reading

Posted in News | Comments Off

A Real Code Retreat

A real code retreat would be a month of slow hacking + tea brewing. No one would speak. We’d lake swim. We’d delete all the code at the end.— Alex McLean (@yaxu) March 25, 2013

Continue reading

Posted in News | Comments Off

A Real Code Retreat

A real code retreat would be a month of slow hacking + tea brewing. No one would speak. We’d lake swim. We’d delete all the code at the end.— Alex McLean (@yaxu) March 25, 2013

Continue reading

Posted in News | Comments Off

Grossperskys Credit && Aw, Shucks

I wrote these tracks a while back, but they didn’t really fit with the stuff I’d written before now. Writing them helped get me up to speed with Ableton, which I really do miss.

Continue reading

Posted in News | Comments Off

Grossperskys Credit && Aw, Shucks

I wrote these tracks a while back, but they didn't really fit with the stuff I'd written before now. Writing them helped get me up to speed with Ableton, which I really do miss.

Continue reading

Posted in News | Comments Off

Decorating Active Record Scopes

I recently ran into a problem in work where I wanted serialize the same Active Record model to JSON differently depending on context.

The solution I ended up going with was to wrap objects inside an Active Record scope in another object and proxy unknown messages to the internal object.

The example here is somewhat trivial but having these little objects helped add clarity to our JSON API.

class JSONDecorator

  attr_reader :instance

  def self.decorate(instances)
    instances.map {|instance| new(instance) }
  end

  def as_json(opts={})
    raise "define as_json method on subclass"
  end

  def initialize(instance)
    @instance = instance
  end

  def method_missing(method, *args, &block)
    instance.send(method, *args, &block)
  end

end
class ComedianAvailability < JSONDecorator

  def as_json(opts={})
    json = Hash.new
    json["id"]        = id
    json["name"]      = title
    json["rating"]    = url
    json["available"] = available
    json
  end

  def available
    active ? "yes" : "no"
  end

end
json_response = ComedianAvailability.decorate(Comedian.scoped).to_json

Continue reading

Posted in News | Comments Off