Skip to content

Instantly share code, notes, and snippets.

View commadelimited's full-sized avatar

Andy Matthews commadelimited

View GitHub Profile
@commadelimited
commadelimited / timing.py
Created November 12, 2019 21:12
Test the time difference between directly accessing properties on a nested object, vs saving an intermediate variable.
# importing the required module
import timeit
# code snippet to be executed only once
setup = """
class FauxClass(object):
pass
page = FauxClass()
page.url = 'the url'

Keybase proof

I hereby claim:

  • I am commadelimited on github.
  • I am commadelimited (https://keybase.io/commadelimited) on keybase.
  • I have a public key ASAQmZtWglS2Z-B6hCkNWza35Z27cYczUaVejn80xPvBqgo

To claim this, I am signing this object:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
How many unique, simultaneous, players can my board game collection support?
"""
import sys
from boardgamegeek import BGGClient
# -*- coding: utf-8 -*-
from boardgamegeek.api import BGGClient
from slugify import slugify as slug
print 'Generate hashtags!'
game_id = raw_input("BGG game id: ")
bgg = BGGClient()
bgg_game = bgg.game(game_id=game_id)
@commadelimited
commadelimited / bgg_designers.py
Created March 6, 2017 21:51
Pull a list of unique played games for X-Y time period, print game name, id, designers, and play count.
from datetime import datetime
from boardgamegeek.api import BoardGameGeek
bgg = BoardGameGeek()
username = 'commadelimited'
start = '2013-01-01'
end = '2017-03-07'
mindate = datetime.strptime(start, '%Y-%m-%d')
maxdate = datetime.strptime(end, '%Y-%m-%d')
http://www.meeplemountain.com/articles/comparing-boardgamegeek-collections-of-two-users/
Agricola: All Creatures Big and Small
The Castles of Burgundy
Favor of the Pharaoh
For Sale
Jaipur
Lost Cities
No Thanks!
Patchwork
@app.route('/')
@app.route('/page/<int:page_number>/')
def index(page_number=1):
path = '' if request.url_rule.rule == '/' else request.url.replace(request.url_root, '/')
context = {
'pagination': Pagination(page_number, settings.PER_PAGE, sorted_pages),
'canonical_url': '{root}{path}'.format(root=settings.ROOT_URL, path=path)
}
return render_template('index.html', context=context)
from collections import (
defaultdict,
OrderedDict,
)
games = [
{
'categories': ['Deduction', 'Party Game', 'Spies/Secret Agents', 'Word Game'],
'game': 'Codenames',
'id': 178900,
  • scale in A minor. The second string of the violin is tuned to the A
  • scale determined by certain general thermo-dynamic principles, and
  • scale of absolute temperature. It is equivalent to -273º centigrade
  • scholar." Johnson.
  • scholarly; literary or classical, in distinction from scientific.
  • scire to know.]
  • scale graduated so as to indicate the percentage of pure alcohol,
  • scented flowers.
  • scholars.
  • scruples, 480 grains. See Troy weight.
@commadelimited
commadelimited / bgg_games.py
Last active September 29, 2018 16:53
Show the owned games overlap of two BGG users
########################################
# DO NOT CHANGE ANYTHING BELOW THIS LINE
########################################
import sys
from boardgamegeek.api import BoardGameGeek
bgg = BoardGameGeek()