Skip to content

Instantly share code, notes, and snippets.

View nathanborror's full-sized avatar

Nathan Borror nathanborror

View GitHub Profile
@nathanborror
nathanborror / gist:188346
Created September 17, 2009 04:28
URL resolver
urlpatterns([
{'regex': /^\/(\w+)\/$/, 'view': View.timeline},
{'regex': /^\/(\w+)\/timeline\//, 'view': View.timeline},
{'regex': /^\/(\w+)\/notes\//, 'view': View.notes},
{'regex': /^\/(\w+)\/books\/$/, 'view': View.readerbooks},
{'regex': /^\/(\w+)\/contacts\//, 'view': View.contacts}
]);
function urlpatterns(obj) {
/**
* DatePicker
* @author Rick Hopkins
* @modified Micah Nolte, Martin Vaina, Nathan Borror
* @version 1.0
* @classDescription A date picker object for user with MooTools 1.2
* MIT-style License.
*
* Example:
* new DatePicker('date_input');
@nathanborror
nathanborror / gist:194559
Created September 27, 2009 02:44
Comparison filters
from django.template import Library
from django.template.defaultfilters import lower
register = Library()
@register.filter
def gt(value, arg):
"Returns a boolean of whether the value is greater than the argument"
try:
return float(value) > float(arg)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>untitled</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/mootools/1.2.3/mootools-yui-compressed.js"></script>
<script type="text/javascript">
var Box = new Class({
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.core.cache import cache
RELATIONSHIP_CACHE = 60*60*24*7
RELATIONSHIP_CACHE_KEYS = {
'FRIENDS': 'friends',
'FOLLOWERS': 'followers',
# base.html
{% block content_wrapper %}
<div class="content">
{% block content %}{% endblock %}
</div>
{% endblock %}
# object_detail.html
@nathanborror
nathanborror / gist:266580
Created December 31, 2009 02:46
Readernaut API
=====================
Readernaut Public API
=====================
1.0 (pre-release)
=================
Reader Books
------------
The Department of Mad Scientists (Michael Belfiore)
- Highlight Loc. 184-92 | Added on Friday, January 01, 2010, 05:28 PM
The United States spent $651 billion on defense-related activities in 2009. That’s more than half of the U.S. discretionary budget, and more than the military budgets of China, Russia, and Europe combined. No less a figure than President Eisenhower—the same president who launched NASA and DARPA—warned of the direct cost to the nation’s citizens of extreme military spending. “Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed,” he told the American Society of Newspaper Editors in a speech that was broadcast over television and radio in April 1953. “The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is
diff --git a/taggit/managers.py b/taggit/managers.py
index a751e21..918d256 100644
--- a/taggit/managers.py
+++ b/taggit/managers.py
@@ -2,7 +2,7 @@ from collections import defaultdict
import django
from django.contrib.contenttypes.models import ContentType
-from django.db import models
+from django.db import models, connection
{% block content %}
- - -
<div class="section_wrapper">
<div class="section"></div>
<div class="section"></div>
<div class="section section_end"></div>
</div>