Skip to content

Instantly share code, notes, and snippets.

"""
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
<!DOCTYPE html>
<!-- Helpful things to keep in your <head/>
// Brian Blakely, 360i
// http://twitter.com/brianblakely/
-->
<head>
<!-- Disable automatic DNS prefetching.
@tkersey
tkersey / Undo a commit and redo
Created October 8, 2010 22:36
Git: undo a commit and redo
http://stackoverflow.com/questions/927358/git-undo-last-commit
Undo a commit and redo
$ git commit ...
$ git reset --soft HEAD^ (1)
$ edit (2)
$ git commit -a -c ORIG_HEAD (3)
This is most often done when you remembered what you just committed is incomplete, or you misspelled your commit message, or both. Leaves working tree as it was before "reset".
@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;
@dbrgn
dbrgn / queryset_generators.py
Created April 1, 2011 08:41
queryset_generator and queryset_list_generator
def queryset_generator(queryset, chunksize=1000):
"""
Iterate over a Django Queryset ordered by the primary key
This method loads a maximum of chunksize (default: 1000) rows in its
memory at the same time while django normally would load all rows in its
memory. Using the iterator() method only causes it to not preload all the
classes.
Note that the implementation of the generator does not support ordered query sets.
#!/usr/bin/python
from sorl.thumbnail.conf import settings
from sorl.thumbnail.base import ThumbnailBackend
FORMAT_DICT = {
'png': 'PNG',
'jpeg': 'JPEG',
'jpg': 'JPEG',
@paulirish
paulirish / rAF.js
Last active June 24, 2025 18:39
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@catupper
catupper / dictionary.txt
Created September 20, 2012 11:22
wordhere solver dictionary
This file has been truncated, but you can view the full file.
aaa
aachen
aah
aahed
aahing
aahs
aal
aalborg
aalii
aaliis