-
Unit
- migrate
lister
srm_prefs
intoself.hm_prefs
- Note this migration needs to take place before the User migration below (due to migration of
rm_prefs
andhm_prefs
- Note this migration needs to take place before the User migration below (due to migration of
- migrate
-
User
- rename
rm_prefs
->hm_prefs
(ie. copy values over)- delete
rm_prefs
on User if need be
- delete
- copy all
user.personal
attributes ontouser
(top-level)age = IntField()
- rename
-
gender = StringField(choices=['male', 'female', 'third'], default="female")
This file contains hidden or 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
import re | |
import PIL | |
from PIL import Image | |
def generate_thumbnails(fn): | |
match = re.match(r"^(?P<path>[^/]+)/receipt_(?P<dimensions>\d{4}x\d{4})_(?P<mp>.{3,5})\.jpg$", fn) | |
if not match: | |
return | |
print "Generating for " + fn | |
match = match.groupdict() |
This file contains hidden or 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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "AllowAccessToBucket", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "arn:aws:iam::468336580105:user/BucketIAMUser" | |
}, | |
"Action": [ |
This file contains hidden or 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
function rainbow(numOfSteps, step) { | |
// based on http://stackoverflow.com/a/7419630 | |
// This function generates vibrant, "evenly spaced" colours (i.e. no clustering). This is ideal for creating easily distiguishable vibrant markers in Google Maps and other apps. | |
// Adam Cole, 2011-Sept-14 | |
// HSV to RBG adapted from: http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript | |
var r, g, b; | |
var h = step / numOfSteps; | |
var i = ~~(h * 6); | |
var f = h * 6 - i; | |
var q = 1 - f; |
This file contains hidden or 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
$ mkdir rb | |
$ for i in `git ls-tree HEAD | cut -f2`; do git mv ${i} rb/; done | |
# Optional - undo the move for those that shouldn't have been moved | |
$ git reset HEAD {.gitignore,Procfile,requirements.txt,scripts,minions} | |
$ git checkout -- {.gitignore,Procfile,requirements.txt,scripts,minions} | |
This file contains hidden or 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
#!/bin/bash -f | |
# Obtained from http://superuser.com/a/433702 | |
currentwindow=`tmux list-window | tr '\t' ' ' | sed -n -e '/(active)/s/^[^:]*: *\([^ ]*\) .*/\1/gp'`; | |
currentpane=`tmux list-panes | sed -n -e '/(active)/s/^\([^:]*\):.*/\1/gp'`; | |
panecount=`tmux list-panes | wc | sed -e 's/^ *//g' -e 's/ .*$//g'`; | |
inzoom=`echo $currentwindow | sed -n -e '/^zoom/p'`; | |
if [ $panecount -ne 1 ]; then | |
inzoom=""; |
This file contains hidden or 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
package com.thoughtmonkeys.pitstop; | |
import java.util.ArrayList; | |
import java.util.List; | |
import android.content.Context; | |
import android.graphics.Paint; | |
import android.util.AttributeSet; | |
import android.util.Log; |
This file contains hidden or 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
package com.thoughtmonkeys.pitstop; | |
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.content.res.Resources; | |
import android.graphics.RectF; | |
import android.os.Build; | |
import android.text.Layout.Alignment; | |
import android.text.StaticLayout; | |
import android.text.TextPaint; |
This file contains hidden or 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
function Enum() { | |
var self = this; | |
var vals = {}; | |
for(var i=0; i < arguments.length; ++i) { | |
vals[arguments[i]] = i == 0? 0 : Math.pow(2, i-1) | |
vals[i] = i == 0? 0 : Math.pow(2, i-1) | |
Object.defineProperty(self, arguments[i], { | |
'value': vals[arguments[i]], | |
}) | |
} |
This file contains hidden or 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
function keypress(n) { | |
var keyboardEvent = new KeyboardEvent('keydown', {bubbles:true}); | |
Object.defineProperty(keyboardEvent, 'charCode', {get:function(){return this.charCodeVal;}}); | |
Object.defineProperty(keyboardEvent, 'keyCode', {get: function(){return this.charCodeVal;}}); | |
keyboardEvent.charCodeVal = n; | |
document.body.dispatchEvent(keyboardEvent); | |
} |