Skip to content

Instantly share code, notes, and snippets.

View GitRon's full-sized avatar
💭
🇪🇺

Ronny V. GitRon

💭
🇪🇺
View GitHub Profile
@denis-ryzhkov
denis-ryzhkov / patch_graphene_django_choices_converter.py
Last active June 3, 2021 19:12
Prevent `graphene_django` from converting Django `choices` to `graphene.Enum` constants: ints like 7 are not converted to "A_7", and so on
import graphene_django
def patch_graphene_django_choices_converter():
"""
Prevent `graphene_django` from converting Django `choices` to `graphene.Enum` constants
Pros:
- Ints like 7 are not converted to "A_7"
- Strings like "Some String" are not converted to "SOME_STRING"
@jonashaag
jonashaag / 1fast_email_backend.py
Last active June 14, 2021 14:10
Fast Django development email backend (socket.getfqdn() slowness)
from django.core.mail.message import make_msgid
class FastMailBackendMixin:
"""Work around slow development email backend due to slow socket.getfqdn() call.
This simply uses "example.com" instead of your local machine's hostname.
"""
def send_messages(self, messages):
for message in messages:
@JusteLeblanc
JusteLeblanc / materialize_form_theme.html.twig
Created February 27, 2017 21:09
Symfony2 form theme to integrate Materialize in your Symfony2 forms
{% extends 'form_div_layout.html.twig' %}
{% block form_row -%}
<div class="row{% if (not compound or force_error|default(false)) and not valid %} has-error{% endif %}">
<div class="input-field col s12">
{{- form_widget(form) -}}
{{- form_label(form) -}}
{{- form_errors(form) -}}
</div>
</div>
Here's how to make jQuery DataTables work with npm and webpack. DT checks for AMD compatibility first
which breaks when you're using CommonJS with webpack.
Install DT core: npm install datatables.net
Install a DT style: npm install datatables.net-bs (bootstrap)
Install the imports-loader webpack plugin: https://github.com/webpack/imports-loader#disable-amd
Create a loader "exception" just for DT in webpack.config.js:
module: {
loaders: [