I hereby claim:
- I am marram on github.
- I am marram (https://keybase.io/marram) on keybase.
- I have a public key whose fingerprint is 2DB6 6EAA 760E 19AB B0D6 B3D8 85BA 8EF6 8D85 5B20
To claim this, I am signing this object:
# Copyright 2015 Bluecore, Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
class PullQueueWorker(Command): | |
""" @num_tasks: The number of tasks to execute at a time. | |
""" | |
# The queue that this work is invoked from. This is a PUSH queue. | |
# It is used by the base_class to determine how to schedule a command. | |
# It is different from the queue that the worker reads the tasks from | |
queue_name = None | |
pull_queue_name = None | |
# The target machine | |
target = None |
queue: | |
- name: default | |
rate: 500/s | |
bucket_size: 100 | |
retry_parameters: | |
task_retry_limit: 3 | |
min_backoff_seconds: 1 | |
max_backoff_seconds: 5 | |
max_doublings: 0 |
I hereby claim:
To claim this, I am signing this object:
/** | |
* Divide two Keen series. | |
* by @marram for TriggerMail | |
*/ | |
Keen.RateChart = function(numerator, denominator, chartOptions, element){ | |
this.numerator = numerator; | |
this.denominator = denominator; | |
this.options = chartOptions; | |
this.__numdata = {}; | |
this.__dendata = {}; |
<!-- Add the following lines to theme's html code right before </head> --> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script> | |
<script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script> | |
<script src="http://static.tumblr.com/fpifyru/AKFlv9zdu/embedgist.js"></script> | |
<!-- | |
Usage: just add <div class="gist">[gist URL]</div> | |
Example: <div class="gist">https://gist.github.com/1395926</div> | |
--> |
def fetch_picks(games, users): | |
""" Fetches picks for a given list of games and users | |
""" | |
key_names = [] | |
for user in users: | |
key_names.extend([Pick.make_key_name(user, game) for game in games]) | |
# Fetch in parallel, 1k at a time | |
picks = [] | |
for slice in miscutils.split_list(key_names, 1000): |
class Pick(db.Model): | |
# Models a user's prediction of which team will win a game. | |
user = db.ReferenceProperty(User) | |
game = db.ReferenceProperty(Game) | |
picked_team = db.ReferenceProperty(Team) | |
@classmethod | |
def make_key_name(cls, user, game): | |
user_key = str(user.key()) | |
game_key = str(game.key()) |
friends_picks = [] | |
for friend in friends: | |
for game in games: | |
pick = get_pick(friend, game) | |
if pick: | |
friends_picks.append(pick) |
class Game(db.Model): | |
team = db.ReferenceProperty(Team) | |
home_team = db.ReferenceProperty(Team) | |
start_time = db.DateTimeProperty | |
class Pick(db.Model): | |
# Models a user's prediction of which team will win a game. | |
user = db.ReferenceProperty(User) | |
game = db.ReferenceProperty(Game) | |
picked_team = db.ReferenceProperty(Team) |