Skip to content

Instantly share code, notes, and snippets.

Thomas Gruner tomgruner

View GitHub Profile
@tomgruner
tomgruner / gist:5ce8bb1f4c55d17b5b25
Created Jul 4, 2014
Migrate from django social auth to python social auth
View gist:5ce8bb1f4c55d17b5b25
from django.contrib.sessions.models import Session
for s in Session.objects.iterator():
session_dict = s.get_decoded()
if '_auth_user_backend' in session_dict.keys():
#New backend is social.backends.facebook.FacebookOAuth2
#Change from old backend
if session_dict['_auth_user_backend'] == 'social_auth.backends.facebook.FacebookBackend':
session_dict['_auth_user_backend'] = 'social.backends.facebook.FacebookOAuth2'
new_s = Session.objects.save(s.session_key, session_dict, s.expire_date)
print new_s.pk
@tomgruner
tomgruner / hello.conf
Created May 10, 2014
example supervisor conf for docker
View hello.conf
[program:hello]
command = docker run --rm busybox /bin/sh -c "while true; do echo hello world; sleep 1; done"
autostart = true
autorestart = true
@tomgruner
tomgruner / row_template.html
Created Aug 3, 2012
Tooltip Ellipsis inside backbone view render method
View row_template.html
<script id="componentTypeRowTpl" type="text/html">
<td>{{ name }}</td>
<td class="ellipsis_100">{{ description }}</td>
</script>
@tomgruner
tomgruner / admin.py
Created Jan 11, 2012 — forked from uhop/admin.py
Adding Dojo's rich editor with minimal plugins to Django's Admin that shows the editor on click and hides on blur
View admin.py
# Example how to add rich editor capabilities to your models in admin.
from django.contrib.admin import site, ModelAdmin
import models
# we define our resources to add to admin pages
class CommonMedia:
js = (
'https://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js',
You can’t perform that action at this time.