Skip to content

Instantly share code, notes, and snippets.

View EnTeQuAk's full-sized avatar

Christopher Grebs EnTeQuAk

  • Mozilla
  • Berlin, Germany
View GitHub Profile
@coordt
coordt / fabfile.py
Created December 1, 2010 12:51
A Fabric fabfile that allows you to check which packages are not like the others on a set of servers.
from __future__ import with_statement
from fabric.api import env, run, settings, hide
from fabric.decorators import hosts, runs_once
venv = "/home/websites/.virtualenvs/twtv3/"
env.user = 'webdev'
env.hosts = [
'192.168.1.10',
'192.168.1.11',
class SiteResource(ModelResource):
""" Thing that are meant to be accessed with a cookie """
def dispatch(self, request_type, request, **kwargs):
kwargs['site'] = Site.objects.get_current()
return super(SiteResource, self).dispatch(request_type, request, **kwargs)
@zyegfryed
zyegfryed / gist:814432
Created February 7, 2011 14:25
Tastypie OAuth
from oauth2 import Error
from django.utils.translation import ugettext as _
from tastypie.authentication import Authentication
from oauth_provider.utils import initialize_server_request, send_oauth_error, get_oauth_request
from oauth_provider.consts import OAUTH_PARAMETERS_NAMES
from oauth_provider.store import store, InvalidTokenError
+ def is_due(self):
+ """See :meth:`celery.task.base.PeriodicTask.is_due`."""
+ due = self.schedule.is_due(self.last_run_at)
+ if not self.model.enabled:
+ due[0] = False
+ return due
activerehashing yes
appendfsync everysec
appendonly no
bind 0.0.0.0
daemonize yes
databases 1
dbfilename dump_1.rdb
dir /var/redis/
glueoutputbuf yes
hash-max-zipmap-entries 512
@bohde
bohde / example.js
Created February 23, 2011 00:47
Example of using curl and jquery with Tastypie
var data = JSON.stringify({
"user": "/api/v1/user/1",
"title": "My New Blog Post",
"body": "Something interesting should be here..."
});
$.ajax({
url: '/api/v1/entry/',
type: 'POST',
contentType: 'application/json',
@balupton
balupton / README.md
Last active April 20, 2022 13:21
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
@martinbalfanz
martinbalfanz / gist:921844
Created April 15, 2011 15:05
lesscss 2 column layout without floats
#main {
display:table;
#sidebar, #content {
display:table-cell;
}
#sidebar {
width:150px;
}
@empty
empty / show_hide_django_filters.js
Created April 15, 2011 18:32
Simple jQuery script to show / hide Django's change list filters.
<script type="text/javascript">
jQuery(document).ready(function($){
$('<div id="show-filters" style="float: right;"><a href="#">Show Filters</a></p>').prependTo('div.actions');
$('#show-filters').hide();
$('#changelist-filter h2').html('<a style="color: white;" id="hide-filters" href="#">Filter &rarr;</a>');
$('#show-filters').click(function() {
$('#changelist-filter').show('fast');
$('#changelist').addClass('filtered');
$('#show-filters').hide();
import datetime
from haystack import indexes
from haystack import site
from myapp.models import Note
class NoteIndex(indexes.SearchIndex):
text = indexes.CharField(document=True, use_template=True)
author = indexes.CharField(model_attr='user')
pub_date = indexes.DateTimeField(model_attr='pub_date')