Skip to content

Instantly share code, notes, and snippets.

View guillaumepiot's full-sized avatar

Guillaume Piot guillaumepiot

View GitHub Profile
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
@drinks
drinks / gist:5447540
Last active January 10, 2022 01:33
Regenerate permissions when they get out of sync with content types in a django project (will destroy all existing permissions) I swear there used to be a management command for this...
from django.db.models import get_apps, get_models
from django.contrib.auth.management import create_permissions
Permission.objects.all().delete()
[create_permissions(app, get_models(app), 2) for app in get_apps()]
@ShawnMilo
ShawnMilo / validate_uuid4.py
Created December 3, 2013 20:55
Validating a uuid4 with Python.
from uuid import UUID
def validate_uuid4(uuid_string):
"""
Validate that a UUID string is in
fact a valid uuid4.
Happily, the uuid module does the actual
checking for us.
@nicksnell
nicksnell / osx-setup.md
Last active December 4, 2015 23:37
Script for setting up Homebrew and a bunch of apps

OSX Setup

  1. Software update
  2. Setup XCode
  3. Install Oh-my-ZSH

curl -L http://install.ohmyz.sh | sh

  1. Generate SSH keys
  2. Install Dotfiles
@sebmarkbage
sebmarkbage / Enhance.js
Last active January 31, 2024 18:33
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {