Skip to content

Instantly share code, notes, and snippets.

"""
Django ORM Optimization Tips
Caveats:
* Only use optimizations that obfuscate the code if you need to.
* Not all of these tips are hard and fast rules.
* Use your judgement to determine what improvements are appropriate for your code.
"""
# ---------------------------------------------------------------------------
@Snugug
Snugug / performance.js
Last active March 15, 2019 18:26
A Chrome DevTools Snippet to get page performance numbers. Returns interesting Navigation Timings and Resource Sizing. Unfortunate workaround for content types until https://github.com/w3c/resource-timing/issues/203 hits
function getExt(filename, opts) {
if (!opts) opts = {};
if (!filename) return "";
var ext = (/[^./\\]*$/.exec(filename) || [""])[0];
return opts.preserveCase ? ext : ext.toLowerCase();
};
async function typeMap () {
const db = await fetch('https://unpkg.com/mime-db/db.json').then(t => t.json());