Skip to content

Instantly share code, notes, and snippets.

View rroemhild's full-sized avatar

Rafael Römhild rroemhild

View GitHub Profile
@rroemhild
rroemhild / gist:190931
Created September 22, 2009 08:41
Tidy decimal places after comma
def tidyDecimalPlaces(value):
retval = str(value)
if ',' in value:
post,pre = value.split(',')
if len(pre) == 0:
retval = "%s,00" % post
elif len(pre) == 1:
pre = "%s0" % pre
retval = "%s,%s" % (post,pre)
else:
@rroemhild
rroemhild / is_true.sh
Last active August 29, 2015 14:07
bash is_true function
is_true() {
local var=${1,,}
case $var in
yes|y|true|t|on|1) return 0 ;;
esac
return 1
}
is_true "true"; echo $?
# 0