Skip to content

Instantly share code, notes, and snippets.

🎧
.

Markus Eliasson eliasson

🎧
.
Block or report user

Report or block eliasson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@eliasson
eliasson / Makefile
Created Aug 31, 2014
Example Makefile for small projects in golang
View Makefile
PACKAGES := \
github.com/eliasson/foo \
github.com/eliasson/bar
DEPENDENCIES := github.com/eliasson/acme
all: build silent-test
build:
go build -o bin/foo main.go
@eliasson
eliasson / addcss.py
Last active Aug 29, 2015
Add CSS class for form widget in Django Templates
View addcss.py
from django import template
register = template.Library()
@register.filter(name='addcss')
def addcss(field, css):
"""
Adds the given class to the class attribute of the given field.
E.g. adds the class 'bar' to the foo widget:
@eliasson
eliasson / digest.clj
Created Oct 20, 2011
Clojure md5 digest
View digest.clj
(defn md5
"Generate a md5 checksum for the given string"
[token]
(let [hash-bytes
(doto (java.security.MessageDigest/getInstance "MD5")
(.reset)
(.update (.getBytes token)))]
(.toString
(new java.math.BigInteger 1 (.digest hash-bytes)) ; Positive and the size of the number
16))) ; Use base16 i.e. hex
You can’t perform that action at this time.