Skip to content

Instantly share code, notes, and snippets.

@renyi
renyi / gist:774117
Created January 11, 2011 06:30
django template - footer copyright
<p>Copyright &copy; {% now "Y" %} <strong>My Company</strong>. All Rights Reserved.</p>
@renyi
renyi / gist:829031
Created February 16, 2011 08:21
Pseudocode of the day: Coffee Break
def work:
while work:
reload_coffee('30 mins')
@renyi
renyi / gist:829045
Created February 16, 2011 08:38
django settings - static files
# Static media
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
(r'^media/admin/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.ADMIN_MEDIA_PREFIX}),
@renyi
renyi / gist:829049
Created February 16, 2011 08:44
django - Multi DB admin
from django.contrib import admin
from myapp.models import *
class MultiDBModelAdmin(admin.ModelAdmin):
using = 'mydb'
def save_model(self, request, obj, form, change):
obj.save(using=self.using)
def queryset(self, request):
@renyi
renyi / gist:829055
Created February 16, 2011 08:52
Tiny fluid grid - 16, min: 960px, max: 1200px
/*
http://www.tinyfluidgrid.com/
*/
.grid_1 { width: 5%; }
.grid_2 { width: 11.25%; }
.grid_3 { width: 17.5%; }
.grid_4 { width: 23.75%; }
.grid_5 { width: 30%; }
.grid_6 { width: 36.25%; }
.grid_7 { width: 42.5%; }
@renyi
renyi / gist:829058
Created February 16, 2011 08:55
django - sqlite3 + firebird
DATABASES = {
'dbSqlite': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'data.db3',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
},
'dbFirebird': {
@renyi
renyi / gist:829068
Created February 16, 2011 09:02
jquery - snippets
function get_ajax(link, para) {
$.get(link, { para }, function(data) {
$('#ajax-data').html(data);
});
}
$(document).ready(function() {
// Datepicker
$("#date_picker").datepicker({dateFormat: 'yy/mm/dd'});
@renyi
renyi / gist:829071
Created February 16, 2011 09:06
CSS3 - snippets
/* Gradient */
background-image: -moz-linear-gradient( center bottom,
rgb(22,21,18) 22%,
rgb(49,49,45) 61%,
rgb(79,79,72) 81% );
background-image: -webkit-gradient( linear,
left bottom,
left top,
color-stop(0.22, rgb(22,21,18)),
@renyi
renyi / gist:829149
Created February 16, 2011 10:23
CSS snippets
h1 {text-decoration:overline}
h2 {text-decoration:line-through}
h3 {text-decoration:underline}
h4 {text-decoration:blink}
background:red url(image.png) repeat top left scroll;
font:bold 1em/1.2em georgia,"times new roman",serif;
border:5px solid red;
"""
Here's my sample Django settings for a project I recently did. Visit http://damonjablons.wordpress.com to see the explanation.
"""
import os
import socket
# Set DEBUG = True if on the production server
if socket.gethostname() == 'your.domain.com':
DEBUG = False