This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 |