Skip to content

Instantly share code, notes, and snippets.

View msiemens's full-sized avatar

Markus Siemens msiemens

View GitHub Profile
@msiemens
msiemens / gist:5362936
Last active December 16, 2015 02:29
Nosetests Assertion Methods
assertion_methods = [
'assert_almost_equal(s)'
'assert_dict_contains_subset',
'assert_dict_equal',
'assert_equal(s)',
'assert_false',
'assert_greater',
'assert_greater_equal',
'assert_in',
'assert_is',
@msiemens
msiemens / gist:5143963
Created March 12, 2013 15:40
A simple Python file caching decorator, caching the function's response till the given file has been changed.
import os
import inspect
from functools import wraps
_file_cache = {}
def cache_file(path):
def cache_is_fresh(name):
@msiemens
msiemens / style.css
Last active December 12, 2015 12:09
body{
color:#444;
font-family:Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman',
"Hiragino Sans GB", "STXihei", "微软雅黑", serif;
font-size:12px;
line-height:1.5em;
background:#fefefe;
width: 45em;
margin: 10px auto;
padding: 1em;
/^Author:/ {
author = $2
commits[author] += 1
commits["tot"] += 1
}
/^[0-9]/ {
more[author] += $1
less[author] += $2
file[author] += 1
@msiemens
msiemens / detectFlash.js
Created August 8, 2012 16:26
Single Line Flash Detection in Javascript
var hasFlash = navigator.mimeTypes&&navigator.mimeTypes.length?Array.prototype.slice.call(navigator.mimeTypes).some(function(a){return"application/x-shockwave-flash"==a.type}):/MSIE/.test(navigator.userAgent)?eval("try{new ActiveXObject('ShockwaveFlash.ShockwaveFlash')&&!0}catch(e){!1};"):!1;