This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if settings.DEBUG: | |
urlpatterns += patterns('', | |
(r'^media/(?P<path>.*)$', 'django.views.static.serve', { | |
'document_root': settings.MEDIA_ROOT, | |
'show_indexes': True} | |
), | |
(r'(.*\.html)$', 'django.views.generic.simple.direct_to_template'), | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os.path import abspath, dirname, join as pjoin | |
PROJ_ROOT = abspath(dirname(__file__)) | |
DEFAULT_EMAIL_FROM = '[email protected]' | |
ORDER_EMAIL_TO = '[email protected]' | |
MEDIA_ROOT = pjoin(PROJ_ROOT, 'media') | |
MEDIA_URL = '/media/' | |
ADMIN_MEDIA_PREFIX = '/media/admin/' | |
TEMPLATE_DIRS = ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( window.addEventListener ) { | |
var k = [], konami = "38,38,40,40,37,39,37,39,66,65"; | |
window.addEventListener("keydown", function(e){ | |
k.push( e.keyCode ); | |
if ( k.toString().indexOf( konami ) >= 0 ) window.location = "http://www.youtube.com/watch?v=GuIBj0R2ui4"; | |
}, true); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8> | |
<title>IE input value</title> | |
</head> | |
<body> | |
<form action=""> | |
<input id="test" type="text" name="username"> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find -name "*.py" | xargs perl -p -i -e 's/\s+\n/\n/g' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<style> | |
.theme { | |
width:400px; | |
margin:0 2px; | |
padding: 10px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// dust.js template pre-compilation | |
var template = dust.compile("Hello {name}!"); | |
// compiles to this string: | |
// | |
// '(function() { | |
// dust.register("demo", body_0); | |
// | |
// function body_0(chk, ctx) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Disregard the fact that I'm using Array.forEach here | |
*/ | |
TestCase("ReadyStateHandlerTest", { | |
"test should call failure handler for 404, 400, 500": function() { | |
var _this = this; | |
[400, 404, 500].forEach(function(status) { | |
var request = forceStatusAndReadyState(_this.xhr, status, 4) | |
assert(request.failure); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example implementation: http://jsfiddle.net/2f7w2fpn/ | |
var indent = 1; | |
function walk(tree) { | |
tree.forEach(function(node) { | |
console.log('--' + Array(indent).join('--'), node.key); | |
if(node.children) { | |
indent ++; | |
walk(node.children); | |
} |
OlderNewer