Skip to content

Instantly share code, notes, and snippets.

@Luttik
Luttik / d3-graphviz-with-requirejs-example-BROKEN-v2.html
Created November 28, 2020 13:17
d3-graphviz-with-requirejs-example-BROKEN-v2
<!-- importing require first for notebook environments that don't have it -->
<script src="https://requirejs.org/docs/release/2.3.6/minified/require.js"></script>
<div id="graph" style="text-align: center;"></div>
<script>
// Using require since that way it should work with all notebook environments
require.config({
'paths': {
d3: '//d3js.org/d3.v5.min',
'd3-interpolate': '//d3js.org/d3-interpolate.v2',
@Luttik
Luttik / d3-graphviz-with-requirejs-example-BROKEN.html
Last active November 23, 2020 20:36
Example D3-graphviz With RequireJS [Broken]
<!-- importing require first for notebook environments that don't have it -->
<script src="https://requirejs.org/docs/release/2.3.6/minified/require.js"></script>
<div id="graph" style="text-align: center;"></div>
<script>
// Using require since that way it should work with all notebook environments
require.config({
'paths': {
d3: '//d3js.org/d3.v5.min',
'd3-interpolate': '//d3js.org/d3-interpolate.v2',
@Luttik
Luttik / pytest_locker_example.py
Last active September 21, 2020 14:59
Shows how to use pytest-locker with
from unittest.mock import MagicMock, patch
import json
from json import JSONEncoder
from typing import List, Type
import requests
from pytest import fixture
from pytest_locker import Locker
from _pytest.fixtures import FixtureRequest
@Luttik
Luttik / Dockerfile
Created July 30, 2020 14:10
How I got pypiserver to run with google cloud storage
FROM python:latest
COPY .htpasswd "/.htpasswd"
RUN python3 -m pip install --upgrade pip
RUN pip3 install pypiserver[passlib]
RUN apt-get update
RUN apt-get install lsb-release -y dos2unix
RUN echo "deb http://packages.cloud.google.com/apt gcsfuse-buster main" | \
tee /etc/apt/sources.list.d/gcsfuse.list
@Luttik
Luttik / test_api_call.py
Last active July 30, 2020 14:10
An example locker call
@patch.object(XyzAPI, "XyzCall")
def test_contact_routing(mock: MagicMock, locker: Locker):
do_logic_that_calls_xyz()
# Uses json to serialize response
# call_args_list contains the data for all calls that XyzApi.XyzCall got
# indent=2 for readibility
# sort_keys=True for deterministic serialization of dictionaries.
locker.lock(json.dumps(mock.call_args_list, indent=2, sort_keys=True))
@Luttik
Luttik / 1_welcome.jinja
Last active September 21, 2020 15:09
pytest-locker example template
# templates/welcome.jinja, i.e. the template used in the test.
Hi {{user.name}},
Welcome to this test.
Kind regards,
Tester
@Luttik
Luttik / chatbot-design.yaml
Last active July 31, 2019 18:54
Example of the intended use of the first chatbot design tool in https://github.com/Luttik/chatbot-design-examples
system:
greeting:
name: Greeting
text: Welcome to your launchpad for all things Google IO?
note: YOU MIGHT WANT TO ADD RANDOM NOTES THAT SHOULD NOT BE VISIBLE IN THE GRAPH.
todo: Turn the text into a real sentence!
to:
- pre-io
- ask-attending
- post-io