- Basic
for
loop to iterate over lines in a file:
for pkg in $(cat pkgs.txt); do sudo apt purge "$pkg" -y; done
exports.host = functions.https.onRequest((req, res) => { | |
const userAgent = req.headers['user-agent'].toLowerCase(); | |
let indexHTML = fs.readFileSync('./hosting/index.html').toString(); | |
const path = req.path ? req.path.split('/') : req.path; | |
const ogPlaceholder = '<meta name="functions-insert-dynamic-og">'; | |
const metaPlaceholder = '<meta name="functions-insert-dynamic-meta">'; | |
const isBot = userAgent.includes('googlebot') || | |
userAgent.includes('yahoou') || | |
userAgent.includes('bingbot') || |
This Gist demonstrates enabling Brotli in Nginx in App Engine Flex using a custom container.
Use of basic Nginx image adapting the example nginx.conf adapted from Full Example Configuration
docker run --rm -itd --name test-nginx \
-v $(pwd):/usr/share/nginx/html:ro \
module.exports = { | |
pages: { | |
pageA: 'src/pageA.js', | |
pageB: 'src/pageB.js', | |
pageC: 'src/pageC.js', | |
}, | |
chainWebpack: config => { | |
const options = module.exports | |
const pages = options.pages |
last 2 ChromeAndroid versions | |
last 2 Chrome versions | |
last 2 iOS versions | |
last 2 Safari versions | |
last 2 Samsung versions | |
last 2 FirefoxAndroid versions | |
last 2 Firefox versions |
#!/usr/bin/env python | |
# vim: set fileencoding=utf-8 | |
# | |
# USAGE: | |
# Back up your tmux old config, run the script and redirect stdout to your conf | |
# file. Example: | |
# | |
# $ cp ~/.tmux.conf ~/.tmux.conf.orig | |
# $ python ./tmux-migrate-options.py ~/.tmux.conf.orig > ~/.tmux.conf | |
# |
function addComments(arg, name) { | |
// 当参数前的注释不存在的情况, 加入 webpackChunkName 注释 | |
if (!arg.leadingComments) { | |
arg.leadingComments = [ | |
{ | |
type: 'CommentBlock', | |
value: ` webpackChunkName: '${name}' `, | |
}, | |
] | |
} |
Assuming you don't want to statically export
a Sapper app, most of the parts to build a simple SSG for Svelte already exist. The only thing that is missing is the tooling ('only').
However, you don't need a lot to get things going: just a couple of rollup builds and a config file will get you most of the way there. Just some glue.
What follows is a bunch of rambling, half thought out thoughts on how I would probably go about this. Most of the stuff discussed here is stuff I've actually done or half done or am in the process of doing with varying degrees of success. It is something I'll be spending more time on in the future. There are other things I have done, want to do, or think would be a good idea that are not listed here as they don't fall into the scope of a simple SSG.
*Dislaimer: This is how I would build an SSG, this isn't the only way, but I like this approach as there are a bunch of compile-time optimisations you can per
/** | |
* Semantic Versioning Comparing | |
* #see https://semver.org/ | |
* #see https://stackoverflow.com/a/65687141/456536 | |
* #see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator#options | |
*/ | |
function semverCompare(a, b) { | |
if (a.startsWith(b + "-")) return -1 | |
if (b.startsWith(a + "-")) return 1 | |
return a.localeCompare(b, undefined, { numeric: true, sensitivity: "case", caseFirst: "upper" }) |