Skip to content

Instantly share code, notes, and snippets.

Avatar

Andy Matthews commadelimited

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

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:

View how-many-players.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
How many unique, simultaneous, players can my board game collection support?
"""
import sys
from boardgamegeek import BGGClient
View boardgame-instagram-hashtag-generator.py
# -*- 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 Mar 6, 2017
Pull a list of unique played games for X-Y time period, print game name, id, designers, and play count.
View bgg_designers.py
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')
View BGG overlaps
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
View flask_route.py
@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)
View bgg_format.py
from collections import (
defaultdict,
OrderedDict,
)
games = [
{
'categories': ['Deduction', 'Party Game', 'Spies/Secret Agents', 'Word Game'],
'game': 'Codenames',
'id': 178900,
View words-starting-with-sc.md
  • 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 Sep 29, 2018
Show the owned games overlap of two BGG users
View bgg_games.py
########################################
# DO NOT CHANGE ANYTHING BELOW THIS LINE
########################################
import sys
from boardgamegeek.api import BoardGameGeek
bgg = BoardGameGeek()