Skip to content

Instantly share code, notes, and snippets.

from django.contrib.admin import ModelAdmin
class MyTableAdmin(ModelAdmin):
...
paginator = LargeTablePaginator
...
@smcoll
smcoll / django_migration_pk_to_uuid.py
Last active January 24, 2024 15:55
Django migration converting integer pk table to UUID pk table
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import uuid
from django.db import migrations, models
def fill_mymodel_uuid(apps, schema_editor):
db_alias = schema_editor.connection.alias
MyModel = apps.get_model('myapp', 'MyModel')
@jbenet
jbenet / simple-git-branching-model.md
Last active June 17, 2024 14:53
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@jasonbartz
jasonbartz / uwsgi_on_pypy.md
Last active August 16, 2017 11:02
uwsgi and pypy

Deploying pypy on uwsgi

Instructions are kind of sporadic around the internet, so I thought I would gather them all in one place. The following example uses a Flask app as the thing deployed. You should only have to this once, and then you can pass the bin around.

Requirements

  • pypy 2.x (tested)
  • uwsgi 1.9.11+ (trunk as of this gist)

Build translated pypy binary and pypy lib.

from django import http
from django.conf import settings
"""
Put this file in a directory called, eg, 'middleware,' inside your django
project. Make sure to create an __init__.py file in the directory so it can
be included as a module.
Set the values for
XS_SHARING_ALLOWED_ORIGINS
XS_SHARING_ALLOWED_METHODS
@plopezbarbosa
plopezbarbosa / chat-frontend.js
Created November 15, 2012 17:12 — forked from martinsik/chat-frontend.js
Node.js chat frontend and server
$(function () {
"use strict";
// for better performance - to avoid searching in DOM
var content = $('#content');
var input = $('#input');
var status = $('#status');
// my color assigned by the server
var myColor = false;