Skip to content

Instantly share code, notes, and snippets.

View kant312's full-sized avatar

Quentin Delcourt kant312

View GitHub Profile

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,

@jeromecoupe
jeromecoupe / bitbucket-pipelines.yml
Last active August 2, 2019 11:29
Minimal Bitbucket Pipelines
# Only use spaces to indent your .yml configuration.
# $SSH_USER $ROOT_PATH $SSH_IP:$SSH_PATH are environment variables
# image
image: node:latest
# pipelines
pipelines:
default:
- step:
<?php declare(strict_types=1);
// In reaction to @marcoshuttle's http://marcosh.github.io/post/2017/06/16/maybe-in-php.html
// Warning: none of this code has been tested or even run.
namespace Verraes\Maybe;
interface Just extends Maybe {
// We can only extract if we know it's a Just
@kant312
kant312 / extract-translations.php
Last active November 7, 2017 11:21
Script (PHP) to extract all translatable strings from Craft CMS templates located in a specific folder
<?php
/**
* @author Quentin Delcourt <[email protected]>
* @date 2017-06-21
*
* This script will take a folder path in argument and will extract
* all translatable strings from the Craft templates encountered
* in the given folder. Each one of these will be
* outputted to stdOut in CSV format.
@gokulkrishh
gokulkrishh / media-query.css
Last active March 18, 2025 03:44
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@danharper
danharper / 1.Bus.js
Last active May 17, 2022 15:20
JavaScript Command Bus
const handlers = Symbol('handlers');
// adapts a handler class to a common interface
// (technically this one isn't required - the handler class already implements the same interface)
class ClassDispatchable {
constructor(theClass) {
this.theClass = theClass;
}
handle(command) {
return (new this.theClass).handle(command);
@jeromecoupe
jeromecoupe / Blocking li in #eecms
Last active December 19, 2015 09:39
Block </li></li> together with ExpressionEngine when using inline-block (avoid whitespace bug)
{!-- List last 3 news (blocking the <li></li> together is mandatory due to using inline-block) --}
{exp:channel:entries channel="news" disable="categories|category_fields|member_data|pagination|trackbacks" status="open" orderby="date" sort="desc" dynamic="no" limit="3"}
{if count == 1}<ul><li>{/if}
<article>
<h3><a href="{url_title_path='news-press/index'}">{title}</a></h3>
<p>{exp:eehive_hacksaw words="30" append="&hellip;"}{cf_news_summary}{/exp:eehive_hacksaw}</p>
</article>
{if count == total_results}</li></ul>{if:else}</li><li>{/if}