Skip to content

Instantly share code, notes, and snippets.

View charlax's full-sized avatar

Charles-Axel Dein charlax

View GitHub Profile
@charlax
charlax / fixtures_vs_factories.md
Last active August 29, 2015 13:57
Fixtures vs. Factories

Factories are great when your business logic does not really depend on complex objects relationships and setup.

Fixtures are more powerful when you need to setup a complex object architecture with very specific attributes. For instance, if you want to test a tax engine that depends on a set of transactions with very specific attributes (currencies, amounts, etc.), a set of users with very specific attributes (citizenship, business status, etc.), it will be easier to write this setup using fixtures.

client:
  fields:
    name: Charles

client_french:
@charlax
charlax / json_make_hash_bench
Created September 18, 2014 22:33
json/ujson vs. make_hash
In [1]: import ujson
In [2]: d = {"e": {"e": {"e": {c: str(c) for c in range(100)}}}}
In [3]: %paste
import copy
def make_hash(o):
"""
@charlax
charlax / gist:38ecd925a8bcb8cadcf5
Created April 3, 2015 17:50
Fix Unable to find 'openssl/opensslconf.h'
SWIG/_m2crypto.i:30: Error: Unable to find 'openssl/opensslv.h'
SWIG/_m2crypto.i:33: Error: Unable to find 'openssl/safestack.h'
SWIG/_evp.i:12: Error: Unable to find 'openssl/opensslconf.h'
SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf.h'
error: command 'swig' failed with exit status 1
@charlax
charlax / create_chrome_markdown_link.applescript
Created May 31, 2017 08:18
Create Google Chrome markdown link for Textexpander (Apple Script)

Keybase proof

I hereby claim:

  • I am charlax on github.
  • I am charlax (https://keybase.io/charlax) on keybase.
  • I have a public key ASAnaIUUkAE-_KNoDaPZOMIa49XGlkuYBlKsFqs4gdORAAo

To claim this, I am signing this object:

@charlax
charlax / pyproject.toml
Created March 19, 2021 17:09
pyproject.toml
[tool.poetry]
name = "poetrytest"
version = "0.1.0"
description = ""
authors = ["Charlax <redacted>"]
[tool.poetry.dependencies]
python = "^3.9"
[tool.poetry.dev-dependencies]