A class for the static files app in Django that invalidates outdated browser cache.
You add the line
STATICFILES_STORAGE = 'path.to.hashpathstaticfilesstorage.HashPathStaticFilesStorage'
import re | |
from django.utils.text import compress_string | |
from django.utils.cache import patch_vary_headers | |
from django import http | |
try: | |
import settings | |
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS |
""" | |
jQuery templates use constructs like: | |
{{if condition}} print something{{/if}} | |
This, of course, completely screws up Django templates, | |
because Django thinks {{ and }} mean something. | |
Wrap {% verbatim %} and {% endverbatim %} around those | |
blocks of jQuery templates and this will try its best |
/* | |
Licensed under the MIT License | |
Copyright (c) 2011 Cédric Luthi | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
(r'^articles/(?P<year>\d{4}/?$, 'main.views.year'), | |
# When a use case comes up that a month needs to be involved as | |
# well, you add an argument in your regex: | |
(r'^articles/(?P<year>\d{4}/(?P<month>\d{2})/?$, 'main.views.year_month'), | |
# That works fine, unless of course you want to show something | |
# different for just the year, in which case the following case can be | |
# used, making separate views based on the arguments as djangoproject |
package | |
{ | |
public class TimeZoneUtil | |
{ | |
import com.adobe.utils.DateUtil; | |
/** | |
* List of timezone abbreviations and matching GMT times. | |
* Modified form original code at: | |
* http://blog.flexexamples.com/2009/07/27/parsing-dates-with-timezones-in-flex/ |
try: | |
from django.utils.deprecation import MiddlewareMixin | |
except ImportError: | |
MiddlewareMixin = object | |
class ForceDefaultLanguageMiddleware(MiddlewareMixin): | |
""" | |
Ignore Accept-Language HTTP headers | |
/* Original source code courtesy John from iOSDeveloperTips.com */ | |
#include <sys/socket.h> | |
#include <sys/sysctl.h> | |
#include <net/if.h> | |
#include <net/if_dl.h> | |
+ (NSString *)getMacAddress | |
{ | |
int mgmtInfoBase[6]; |
// Shave-and-a-haircut, two bits! In the upper left corner | |
var secret = [{delay:0.5, x:0, y:0, radius:200}, | |
{delay:0.25, x:0, y:0, radius:200}, | |
{delay:0.25, x:0, y:0, radius:200}, | |
{delay:0.5, x:0, y:0, radius:200}, | |
{delay:1, x:0, y:0, radius:200}, | |
{delay:0.5, x:0, y:0, radius:200}, | |
{delay:0, x:0, y:0, radius:200}]; | |
function allowInside() { |
try: | |
# for Python 2.x | |
from Queue import Queue | |
except ImportError: | |
# for Python 3.x | |
from queue import Queue | |
from threading import Thread, Event | |
import random | |
import sys |