Skip to content

Instantly share code, notes, and snippets.

View BeWe11's full-sized avatar

Benjamin Weigang BeWe11

View GitHub Profile
@ckrybus
ckrybus / 1integrate-django-filter-django-tables2-django-crispy-forms.md
Last active May 13, 2024 05:01
How to integrate django-crispy-forms, django-tables2 and django-filter in order to display a paginated table with filter functionality.
@jnturton
jnturton / userContent.css
Last active August 30, 2024 15:10
A multi-column layout for Firefox's Reader mode.
/* Save this file as userContent.css in the chrome/ subdirectory of your Firefox profile
* directory. You may need to create the chrome/ subdirectory first.
*/
@namespace url(http://www.w3.org/1999/xhtml);
/* multi-column layout for FF < 58 */
@-moz-document url-prefix("about:reader") {
/* multi-column layout */
#container {
@bruce-shi
bruce-shi / disable_signals.py
Created September 18, 2016 02:44 — forked from RobertKolner/disable_signals.py
Temporarily disable all signals in django.
from collections import defaultdict
from django.db.models.signals import *
class DisableSignals(object):
def __init__(self, disabled_signals=None):
self.stashed_signals = defaultdict(list)
self.disabled_signals = disabled_signals or [
pre_init, post_init,
pre_save, post_save,
@dmyersturnbull
dmyersturnbull / groupyby_parallel.py
Last active February 6, 2024 00:43
Performs a Pandas groupby operation in parallel
import pandas as pd
import itertools
import time
import multiprocessing
from typing import Callable, Tuple, Union
def groupby_parallel(
groupby_df: pd.core.groupby.DataFrameGroupBy,
func: Callable[[Tuple[str, pd.DataFrame]], Union[pd.DataFrame, pd.Series]],
num_cpus: int = multiprocessing.cpu_count() - 1,
@lgyanf
lgyanf / add_query_parameters.py
Created June 14, 2016 10:49
A python decorator that adds query parameters to django-rest-framework swagger docstring.
# -*- coding: utf-8 -*-
import collections
import yaml
from rest_framework import fields
"""
Convert rest_framework.fields classes to Swagger data types according to http://swagger.io/specification/
Return 'string' by default.