Skip to content

Instantly share code, notes, and snippets.

View d9i's full-sized avatar

Dara Kharabi d9i

View GitHub Profile
@d9i
d9i / mt.lua
Created March 1, 2012 16:41
Fun with metatables
-- Use single inheritance to do fun things with tables
mt = {}
mt.__index = function (t, k)
tbl = {}
setmetatable(tbl, mt)
return tbl
end
setmetatable(_G.table, mt)
print(m.e.t.a)
@d9i
d9i / Euler.py
Created February 22, 2012 07:25
Euler method of approximating Diff. Eq.s -- MK's cut
from __future__ import division
# Euler method of approximating Diff. Eq.s
# Uses eval to reduce f(x,y) -- is this okay?
def euler(eq, x, y, h, e):
while x < e:
eqResult = eval(eq)
x = x + h
y = y + (h*eqResult)