⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,
This file contains hidden or 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
| // add all the elements inside modal which you want to make focusable | |
| const focusableElements = | |
| 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'; | |
| const modal = document.querySelector('#exampleModal'); // select the modal by it's id | |
| const firstFocusableElement = modal.querySelectorAll(focusableElements)[0]; // get first element to be focused inside modal | |
| const focusableContent = modal.querySelectorAll(focusableElements); | |
| const lastFocusableElement = focusableContent[focusableContent.length - 1]; // get last element to be focused inside modal | |
This file contains hidden or 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
| #!/bin/bash -e | |
| # | |
| # Generate GIFs of font changes over time | |
| # | |
| # HERE BE DRAGONS! | |
| # This is a hack of a script. It won't just run for you. Edit it to suit your system and needs. | |
| # | |
| pushd "$(dirname "$0")" >/dev/null | |
| chardiffdir=$PWD | |
| pushd "../.." >/dev/null |
This file contains hidden or 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
| console.rainbow = function (str) { | |
| const colors = [ | |
| "red", | |
| "orange", | |
| "yellow", | |
| "green", | |
| "blue", | |
| "indigo", | |
| "violet",//white in VS Code |
This file contains hidden or 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
| /* | |
| Copy this into the console of any web page that is interactive and doesn't | |
| do hard reloads. You will hear your DOM changes as different pitches of | |
| audio. | |
| I have found this interesting for debugging, but also fun to hear web pages | |
| render like UIs do in movies. | |
| */ | |
| const audioCtx = new (window.AudioContext || window.webkitAudioContext)() |
Follow this guide to install WSL:
https://docs.microsoft.com/en-us/windows/wsl/install-win10
- Get your build tools and python required libraries installed:
Thanks everyone for commenting/contributing! I made this in college for a class and I no longer really use the technology. I encourage you all to help each other, but I probably won't be answering questions anymore.
This article is also on my blog, too.
Note: $ denotes the start of a command. Don't actually type this.
- Install WSL (Ubuntu for Windows - can be found in Windows Store). I recommend the latest version (I'm using 18.04) because there are some bugs they worked out during 14/16 (microsoft/WSL#785)
- Go to https://repo.continuum.io/archive to find the list of Anaconda releases
- Select the release you want. I have a 64-bit computer, so I chose the latest release ending in
x86_64.sh. If I had a 32-bit computer, I'd select thex86.shversion. If you accidentally try to install the wrong one, you'll get a warning in the terminal. I chose `Ana
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "os/exec" | |
| "path/filepath" | |
| "strings" | |
| "syscall" | |
| ) |
This file contains hidden or 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 python3 | |
| # Distributed under the MIT software license | |
| import binascii, struct, sys, io, argparse | |
| from PIL import Image | |
| IMG_WIDTH = 512 # could be made adaptive... | |
| MIN_HEIGHT = 4 # minimum height of image; twitter won't let us upload anything smaller | |
| BYTES_PER_PIXEL = 4 # RGBA, 8 bit | |
| def div_roundup(x,y): |