Skip to content

Instantly share code, notes, and snippets.

@jeremyBanks
jeremyBanks / brainfuck.py
Created July 24, 2008 21:24
[2008-07] Learning Brainfuck - First Program and Python Interpreter
#!/usr/bin/env python
# encoding: utf-8
#
# Rudementary Python Brainfuck Interpreter
# jeremy@jeremybanks.ca
#
# Usage: brainfuck.py program.bf
#
# Input is from stdin, output to stdout, obviously.
# The grid is infinite in both directions.
@mcameronjones
mcameronjones / test.html
Created July 24, 2008 21:49
testing command line and eclipse compat
<html>
<head>
<title>test</title>
</head>
<body>
this is a foo
</body>
</html>
class AddPriceToProduct < ActiveRecord::Migration
def self.up
options = {:precision => 8, :scale => 2, :default => 0}
add_column :products, :decimal, options
add_column :price, :decimal, options
end
def self.down
remove_column :products, :price
class AddPriceToProduct < ActiveRecord::Migration
def self.up
add_column :products, :price, :decimal,
:precision => 8, :scale => 2, :default => 0
end
def self.down
remove_column :products, :price
end
end
class Manager < ActiveRecord::Base
belongs_to :demo
serialize :state
serialize :cache
def after_initialize
@observers = []
end
class Note
include ::DataMapper::Resource
property :id, Integer, :serial => true
property :content, String, :length => 2048
property :type, Discriminator
validates_length :content, :minimum => 4, :maximum => 2048
before :save do
curl http://api.feedburner.com/awareness/1.0/GetFeedData?uri=peelmeagrape | sed -n -e 's/.*circulation="\([0-9]*\)".*/\1/p'
require 'open-uri'
response = URI.parse("http://api.feedburner.com/awareness/1.0/GetFeedData?uri=peelmeagrape").read
puts response.match(/circulation="([0-9]*)"/)[1]
Loading development environment (Rails 2.1.0)
>> m = Manager.new
=> #<Manager id: nil, state: nil, cache: nil, kind: nil, demo_id: nil, created_at: nil, updated_at: nil>
>> m.cache
Restoring state:---
cache:
state:
=> {}
>> m.cache[:name] = "Mike"
<!-- A stab at how the first pie chart on http://teethgrinder.co.uk/open-flash-chart/gallery-pie.php could be created from a table -->
<table summary="Microsoft's Internet Explorer appears to be dying, with the Wii taking 20% of market">
<caption>Pie Chart</caption>
<tr>
<td>Wii</td>
<td>15%</td>
</tr>
<tr>
<td>Opera</td>
<td>12%</td>