Skip to content

Instantly share code, notes, and snippets.

@eswald
eswald / timestamp.py
Created April 30, 2015 23:38
TimestampMixin
from datetime import datetime, timedelta
class TimestampMixin(object):
r'''Adds assertTimestamped to TestCase classes.
Checks that the given field contains a time between the beginning of
the test run and the assertion.
'''#"""#'''
def setUp(self):
super(TimestampMixin, self).setUp()
@eswald
eswald / thoughts.lua
Last active December 17, 2015 04:58 — forked from warmist/thoughts.lua
local events_by_type={}
local event_types={}
for k,v in pairs(df.global.world.units.active) do
if dfhack.units.isCitizen(v) then
local mytypes={}
for idx,event in pairs(v.status.recent_events) do
local t=event.type
if mytypes[t]==nil then
if events_by_type[t] then