Skip to content

Instantly share code, notes, and snippets.

View ojii's full-sized avatar

Jonas Obrist ojii

View GitHub Profile
@ojii
ojii / please-include-a-repro.md
Last active January 24, 2023 00:01 — forked from Rich-Harris/please-include-a-repro.md
Please include a repro

Please include a repro

You probably arrived here because of a curt message in response to an issue you filed on a repo that I contribute to. Sorry about that (particularly if you filed the issue long ago and have been waiting patiently for a response). Let me explain:

I work on a lot of different open source projects. I really do like building software that makes other people's lives easier, but it's crazy time-consuming. One of the most time-consuming parts is responding to issues. A lot of OSS maintainers will bend over backwards to try and understand your specific problem and diagnose it, to the point of setting up new test projects, fussing around with different Python versions, reading the documentation for build tools that we don't use, debugging problems in third party dependencies that appear to be involved in the problem... and so on. I've personally spent hundreds of hours of my free time doing these sorts of things to try and help people out, because I want to be a responsible maintainer and

@ojii
ojii / common.py
Created October 26, 2011 14:18
requests vs sockets
URL = 'http://httpbin.org/status/200'
def check(status_code, headers, content):
assert status_code == 200
assert headers['Content-Length'] == '0'
assert headers['Content-Type'] == 'text/html; charset=utf-8'
assert headers['Connection'] == 'close'
print 'OK'
@ojii
ojii / set-me-up.py
Created October 17, 2012 16:49
setup py generator
# -*- coding: utf-8 -*-
import re
import distutils.sysconfig as sysconfig
import os
__doc__ = '''set-me-up.
Usage:
set-me-up <projectdir>
'''
@ojii
ojii / example.html
Created August 4, 2011 18:48
django-cms 2.2 tutorial app files
{% load cms_tags sekizai_tags %}
<!doctype html>
<head>
<title>{{ request.current_page.get_title }}</title>
{% render_block "css" %}
</head>
<body>
{% cms_toolbar %}
{% placeholder "main" %}
In [1]: class Foo:
...: def __init__(self):
...: exec("self.__bar = 'hello'")
...: def bar(self):
...: print(self.__bar)
...:
In [2]: foo = Foo()
In [3]: foo.__bar
class A:
def a(self):
class __B:
def __b(self):
print("B")
_A__B()._B__b()
A().a()
@ojii
ojii / example-output.txt
Last active December 26, 2018 06:12
Make `python -c ...` print the result
$ ./python.exe -c '2+3'
5
@ojii
ojii / example.html
Created January 12, 2011 15:39
example settings.py for the django CMS
{% load cms_tags %}
<!doctype html>
<head>
<title>{{ request.current_page.get_title }}</title>
{% plugins_media %}
</head>
<body>
{% placeholder "main" %}
</body>
@ojii
ojii / messages_test_mixin.py
Created October 7, 2011 10:01
django messages framework testing utilities
from contextlib import contextmanager
from django.contrib.messages.storage.base import BaseStorage, Message
from django.test.client import RequestFactory
from django.utils.decorators import method_decorator
class TestMessagesBackend(BaseStorage):
def __init__(self, request, *args, **kwargs):
self._loaded_data = []
super(TestMessagesBackend, self).__init__(request, *args, **kwargs)
@ojii
ojii / cbv_decorator.py
Created January 27, 2013 05:42
Class based view decorators for Django
def cbv_decorator(decorator):
"""
Turns a normal view decorator into a class-based-view decorator.
Usage:
@cbv_decorator(login_required)
class MyClassBasedView(View):
pass
"""