Skip to content

Instantly share code, notes, and snippets.

Avatar

Dara Kharabi d9i

View GitHub Profile
@d9i
d9i / mt.lua
Created Mar 1, 2012
Fun with metatables
View mt.lua
-- 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 Feb 22, 2012
Euler method of approximating Diff. Eq.s -- MK's cut
View Euler.py
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)