a/o 2020-05-29
--
- Restart with Cmd-R or Cmd-D
- Erase drive / 3x if second-hand
- Reinstall MacOS
# Enable gzip. Highly recommending for best peformance | |
gzip on; | |
gzip_comp_level 6; | |
gzip_types text/html text/css text/javascript application/json application/javascript application/x-javascript; | |
# By default, do not set expire headers | |
expires 0; | |
# Set expires header for console CSS and JS. | |
# These files are timestamped with each new release, so it is safe to cache them agressively. |
var Embed = { | |
config : { | |
elementId : 'embed', | |
trigger: document.querySelectorAll('[data-js="embedTrigger"]'), | |
videoId : 7100569, | |
autoplay : true, | |
vidWidth: 640, | |
vidHeight: 400 | |
}, |
# Check an FTP directory for new files, send any to Zencoder for | |
# conversion to HTTPLive playlists, tell Zencoder to put converted files | |
# in FTP or S3 | |
# Installation: | |
# pip install zencoder | |
# Usage: | |
# Add S3 credentials to Zencoder - https://app.zencoder.com/account/credentials | |
# Configure Zencoder, S3 and FTP details |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
#Good practices for project management in Django
#Setting up the environment
Each Django project should be encapsulated in its own virtual environment, allowing us to manage the requirements and dependencies independently.
If you don't have Virtualenv installed, please visit this page and download the virtualenv package. For a simple installation:
Google Chrome Developers says:
The new WOFF 2.0 Web Font compression format offers a 30% average gain over WOFF 1.0 (up to 50%+ in some cases). WOFF 2.0 is available since Chrome 36 and Opera 23.
Some examples of file size differences: WOFF vs. WOFF2
# Notes: | |
# Python 3 assumed, but shouldn't be hard to backport to Python 2 | |
# Cobbled together from two slightly different implementations, sorry for any inconsistencies. | |
# This creates two models, NavigationMenu, and NavigationMenuItem. A site can have many NavigationMenus, which are referenced from | |
# the template by location. E.g., 'footer', 'left_nav'. You can also create single-item lists for special purpose links/buttons, | |
# such a privacy_policy or homepage_cta. This helps to reduce hard coding in templates. | |
# NavigationMenuItem mixes in some different link types (Page, Document, URL) and presents them in a consistent way. It provides | |
# the ability to override the title of the referenced object. |
from django.utils.safestring import mark_safe | |
from markdown import markdown | |
from pygments import highlight | |
from pygments.formatters import get_formatter_by_name | |
from pygments.lexers import get_lexer_by_name | |
from wagtail.wagtailcore import blocks | |
class CodeBlock(blocks.StructBlock): |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent