Skip to content

Instantly share code, notes, and snippets.

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ 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,

@aurri
aurri / route.js
Last active August 29, 2015 14:03
Minimal routing library
/////////////////////////////////////////////////
//// Minimal routing library (IE10+)
/////////////////////////////////////////////////
// Listen to url changes:
// route(function(param, param...){}) - will get /param/param, split as arguments
// Navigate to path:
// route.to(path) - redirect to new path
// route.to(path, true) - redirect to new path, replacing current url
@aurri
aurri / minimal-router.js
Last active August 29, 2015 14:03
Simple minimal router
/////////////////////////////////////////////////
//// Simple minimal router (works in IE9+)
/////////////////////////////////////////////////
/*** Usage **************************************
//// Navigate to url
route('/path')
@terkel
terkel / _easing.scss
Last active February 17, 2024 23:12
Timing functions for CSS animations and transitions
// _easing.scss, CSS easing functions - gist.github.com/terkel/4377409
// Based on Caesar - matthewlein.com/ceaser
$linear: cubic-bezier( 0.250, 0.250, 0.750, 0.750 );
$ease: cubic-bezier( 0.250, 0.100, 0.250, 1.000 );
$ease-in: cubic-bezier( 0.420, 0.000, 1.000, 1.000 );
$ease-out: cubic-bezier( 0.000, 0.000, 0.580, 1.000 );
$ease-in-out: cubic-bezier( 0.420, 0.000, 0.580, 1.000 );
$ease-in-quad: cubic-bezier( 0.550, 0.085, 0.680, 0.530 );