⚠️ 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 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
CREATE OR REPLACE FUNCTION guess_language(string text) | |
RETURNS text | |
LANGUAGE sql | |
AS | |
$$ | |
SELECT cfgname::text FROM pg_ts_config WHERE cfgname <> 'simple' ORDER BY length(to_tsvector(cfgname::regconfig,string)) LIMIT 1 | |
$$; | |
-- | |
-- Demo testing some random sentences from Wikipedia: |
This file contains 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
FROM php:7.2.19-cli | |
RUN set -eux; \ | |
apt update; \ | |
apt install --no-install-recommends unzip; \ | |
rm -rf /var/lib/apt/lists/*; \ | |
cd /usr/src; \ | |
curl -o sqlite.zip https://www.sqlite.org/2017/sqlite-preprocessed-3200100.zip; \ | |
unzip sqlite.zip; \ | |
rm sqlite.zip; \ |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<link rel="stylesheet" href="./style.css"> | |
</head> | |
<body> |
The trend of using monorepos makes a lot of things easier to manage. However, when you want to fork a single package inside a monorepo, you'll have to chose one of two options:
- Fork the entire monorepo (meaning you get all those extra boilerplate you don't really care about)
- Manually copying the package files into a new git repo (meaning you'll loose all git history and have a lot of work to do when there's a new version of your base package)
The good news: There's a solution for this! And it's actually built in to git.
One of the lesser-known (and vaguely documented) features of git is subtree
. It's intended for this purpose, working as a great alternative to the criticized submodules
.
There are very few resources about using this in practice, so here's a guide for this specific use case.
This file contains 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
<template> | |
<el-menu :router="true" :default-active="activeLink"> | |
<template v-for="rule in $router.options.routes"> | |
<el-submenu v-if="rule.children && rule.children.length > 0" | |
:index="rule.path" | |
> | |
<template slot="title"><i :class="rule.icon"></i>{{ rule.title }}</template> | |
<el-menu-item v-for="child in rule.children" :index="rule.path + '/' + child.path">{{ child.title }}</el-menu-item> | |
</el-submenu> | |
<el-menu-item v-else |
This file contains 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 python | |
import argparse | |
import base64 | |
import json | |
import os | |
def main(): | |
parser = argparse.ArgumentParser( | |
description="Dump all certificates out of Traefik's acme.json file") |
This file contains 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
function get(path, obj, fb = `$\{${path}}`) { | |
return path.split('.').reduce((res, key) => res[key] || fb, obj); | |
} | |
function parseTpl(template, map, fallback) { | |
return template.replace(/\$\{.+?}/g, (match) => { | |
const path = match.substr(2, match.length - 3).trim(); | |
return get(path, map, fallback); | |
}); | |
} |
This file contains 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
/** | |
* Produces a function which uses template strings to do simple interpolation from objects. | |
* | |
* Usage: | |
* var makeMeKing = generateTemplateString('${name} is now the king of ${country}!'); | |
* | |
* console.log(makeMeKing({ name: 'Bryan', country: 'Scotland'})); | |
* // Logs 'Bryan is now the king of Scotland!' | |
*/ | |
var generateTemplateString = (function(){ |
This file contains 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
Windows Registry Editor Version 5.00 | |
[-HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder] | |
[-HKEY_CLASSES_ROOT\Directory\shell\Cmder] |
NewerOlder