View reindent.bat
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
@echo off | |
if [%1]==[] goto USAGE | |
goto REINDENT | |
:USAGE | |
echo. | |
echo Usage: reindent path\to\file.py | |
echo. | |
goto END |
View text-enhance-death.js
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 killTextEnhance() | |
{ | |
$("a[title]").each(function (i, element) { | |
if (element.title.toLowerCase().indexOf("text-enhance") > -1) | |
{ | |
$(this).contents().unwrap(); | |
} | |
}); | |
} |
View django_management_profile.py
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 cProfile import Profile | |
from django.core.management.base import BaseCommand | |
class ProfileEnabledBaseCommand(BaseCommand): | |
"""Enable profiling a command with --profile. | |
Requires child class to define _handle instead of handle. | |
via https://gist.github.com/dfrankow | |
""" |
View Firefox Font Adjustment
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
body { | |
font: normal 75% Xyz, Arial, Helvetica, sans-serif; | |
} | |
@-moz-document url-prefix() { | |
body { | |
font: 70% Xyz, Arial, Helvetica, sans-serif; | |
} | |
} |
View Django decorator compatible with admindocs
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
def my_decorator(function=None): | |
def _decorator(view_function): | |
def _view(request, *args, **kwargs): | |
if not some_security_check(request.user): | |
return HttpResponseRedirect(reverse('auth_login')) | |
return view_function(request, *args, **kwargs) | |
_view.__name__ = view_function.__name__ | |
_view.__dict__ = view_function.__dict__ | |
_view.__doc__ = view_function.__doc__ | |
_view.__module__ = view_function.__module__ |
View middleware.py
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
""" | |
SSL Middleware | |
Stephen Zabel | |
This middleware answers the problem of redirecting to (and from) a SSL secured path | |
by stating what paths should be secured in urls.py file. To secure a path, add the | |
additional view_kwarg 'SSL':True to the view_kwargs. | |
For example |
View Dover Goodreads Bookmarklet
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:window.open("http://librarycatalog.dover.nh.gov/cgi-bin/koha/opac-search.pl?idx=&q="+encodeURIComponent(document.getElementById("bookTitle").innerText.replace(/\([^\)]+\)/, '').replace(/^\s\s*/, '').replace(/\s\s*$/, ''))); |
View gist:5753154
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 collections import defaultdict | |
import operator | |
import os | |
from xlrd import open_workbook | |
""" | |
starting from the "raw" data, which I'm assuming is the first tab, Sorted by Customer | |
group everything by part number and get the total sold | |
then list the items in descending order of popularity | |
Do you need any other data beyond part and total sold? Looks like I should sum the Extended Price column as well? |
View AWS Backup
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
#!/usr/bin/env python | |
import datetime | |
import os | |
import time | |
from zipfile import ZipFile, ZIP_DEFLATED | |
from django.conf import settings | |
from django.core.mail import mail_admins | |
from django.core.management.base import BaseCommand |
View gist:5986873
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
EMAIL_HOST = 'smtp.server.net' | |
EMAIL_HOST_USER = 'user' | |
EMAIL_HOST_PASSWORD = 'p@ssword' | |
DEFAULT_FROM_EMAIL = 'forms@exmaple.com' | |
SERVER_EMAIL = 'forms@example.com' | |
# for SSL only | |
EMAIL_PORT = 587 | |
EMAIL_USE_TLS = True |
OlderNewer