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
var jsonDataRe = /example\.com\/(.*\.json)/; | |
self.addEventListener('fetch', function(event) { | |
var request = event.request, | |
match = jsonDataRe.exec(request.url); | |
if (match) { | |
// Use regex capturing to grab only the bit of the URL | |
// that we care about, ignoring query string, etc. | |
var cacheRequest = new Request(match[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
var jsonDataRe = /example\.com\/(.*\.json)/; | |
self.addEventListener('fetch', function(event) { | |
var request = event.request, | |
match = jsonDataRe.exec(request.url); | |
if (match) { | |
// Use regex capturing to grab only the bit of the URL | |
// that we care about, ignoring query string, etc. | |
var cacheKey = match[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
function cachePut(key, request, response) { | |
caches.open(key).then(function(cache) { | |
cache.put(request, response); | |
}); | |
} | |
function cacheGet(key) { | |
return new Promise(function(resolve, reject) { | |
caches.open(key).then(function(cache) { | |
cache.keys().then(function(keyArray) { | |
if (keyArray.length) { |
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
Hey, I'm trying to test this page on as many hi-DPI (aka "retina") devices | |
as possible: | |
http://www.soundslice.com/scores/auld-lang-syne/?retina | |
Can you take a look and let me know whether everything looks good and whether | |
it's any more sluggish than the non-retina version? Also let me know your | |
devicePixelRatio, which you can get from http://www.devicepixelratio.com/ -- | |
if your ratio is something other than 1 or 2 (e.g., 1.5), I'm particularly | |
interested. |
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
# Two-phased template rendering. | |
# See http://www.holovaty.com/writing/django-two-phased-rendering/ | |
# LICENSE: Public domain. | |
################ | |
# TEMPLATE TAG # | |
################ | |
from django import template | |
register = template.Library() |
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
// Copyright 2013 Soundslice LLC. License: BSD. | |
/* HTML example: **************** | |
<figure class="vid"> | |
<video preload> | |
<source src="/videos/help/playhead.mp4" type="video/mp4"> | |
<source src="/videos/help/playhead.webm" type="video/webm"> | |
</video> | |
<p>To move the playhead, click in the timeline or drag the playhead’s diamond.</p> |
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
$ git push heroku master | |
Counting objects: 146, done. | |
Delta compression using up to 4 threads. | |
Compressing objects: 100% (120/120), done. | |
Writing objects: 100% (120/120), 12.64 KiB, done. | |
Total 120 (delta 98), reused 0 (delta 0) | |
-----> Python app detected | |
-----> No runtime.txt provided; assuming python-2.7.3. | |
-----> Preparing Python runtime (python-2.7.3) | |
-----> Installing Distribute (0.6.34) |
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
# Does not fully work, but gets you partially there. | |
class UserlessAdminSite(admin.sites.AdminSite): | |
def check_dependencies(self): | |
pass | |
def has_permission(self, *args, **kwargs): | |
return True | |
class UserlessModelAdmin(admin.ModelAdmin): |