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
jQuery.fn.sort = function() { return this.pushStack( [].sort.apply( this, arguments ), []); }; | |
$('.djDebugSql').closest('tr').each(function(i) { this.setAttribute('rel',i); }); | |
function dtsql(o){ | |
switch (o) { | |
case 'clean' : $('.djDebugSql').each(function(){ $(this).contents()[1].nodeValue = ' '; }); break; | |
case 'time' : tbody = $('.djDebugSql:eq(0)').closest('tbody'); tbody.children('tr').sort(function(a,b){ return $(b).children('td:eq(0)').html() - $(a).children('td:eq(0)').html() }).appendTo(tbody); | |
break; | |
} | |
} | |
dtsql('time'); |
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 django.test.client import Client | |
def render_url(url): | |
c = Client() | |
return c.get(url).content |
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
# based on http://stackoverflow.com/questions/797773/django-caching-can-it-be-done-pre-emptively | |
# run this from `manage.py shell` | |
# if you have ipython, you can do `what_view /some/silly/url/` and remember the leading and trailing slash | |
from django.core.urlresolvers import resolve | |
def what_view(url): | |
try: | |
(v, foo, params) = resolve(url) | |
print "View Name: %s Line: %s of %s" % (v.__name__, v.__code__.co_firstlineno, v.__code__.co_filename) | |
return v, foo, params | |
except: |
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
javascript:(function(){var script=document.createElement('script');script.type='text/javascript';script.src='http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';document.documentElement.childNodes[0].appendChild(script)})() |
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
javascript:(function(){$('[style]').removeAttr('style'); $('link[type="text/css"]').remove(); $('style').remove();})(); |
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
javascript:(function(){var a=location.href.split('/');a[0]='http:';a[2]=location.port?'www.texastribune.org':'localhost:8000';window.open(a.join('/'))})(); |
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
$('*').hover(function(){ var t = $(this); t.css('outline',t.parents().length + 'px solid red'); }, function(){ $(this).css('outline','0 none'); }) |
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
jQuery.fn.simulateClick = function() { | |
// simulate a mouse click, only acts on the first element of a set | |
if (this.length) { | |
var evt = document.createEvent("MouseEvents"); | |
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); | |
this[0].dispatchEvent(evt); | |
} | |
return this; | |
} |
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
function _(l){return l+(_+l)[11-((_._=(_._?_._:!_)+1)%(1+1)?!1:1+1+1+1+1)]}_(_(_(''))) |
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
csslint --rules=empty-rules,zero-units,display-property-grouping,vendor-prefix,regex-selectors,import,duplicate-properties |
OlderNewer