Skip to content

Instantly share code, notes, and snippets.

😶
boop

andreas andreasvirkus

😶
boop
View GitHub Profile
@pngwn
pngwn / ssg.md
Last active Jul 27, 2020
A Simple Svelte SSG.
View ssg.md

The Simplest Svelte Static Site Generator

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

View plugin-babel-import-chunkname.js
function addComments(arg, name) {
// 当参数前的注释不存在的情况, 加入 webpackChunkName 注释
if (!arg.leadingComments) {
arg.leadingComments = [
{
type: 'CommentBlock',
value: ` webpackChunkName: '${name}' `,
},
]
}
@tbutts
tbutts / tmux-migrate-options.py
Last active Aug 4, 2020
For tmux configs: Merge deprecated/removed -fg, -bg, and -attr options into the -style option
View tmux-migrate-options.py
#!/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
#
@jakecobley
jakecobley / .browserslistrc
Last active Apr 29, 2020
Browserslist configuration explicitly targeting modern browsers.
View .browserslistrc
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
@alexamies
alexamies / README.md
Last active Mar 3, 2020
Using NGINX with Brotli
View README.md

Using NGINX with Brotli

This Gist demonstrates enabling Brotli in Nginx in App Engine Flex using a custom container.

Running in Docker locally

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 \
@usrme
usrme / ONELINERS.md
Last active Jul 29, 2020
Various oneliners from various languages
View ONELINERS.md

Bash

  • Basic for loop to iterate over lines in a file:
for pkg in $(cat pkgs.txt); do sudo apt purge "$pkg" -y; done
  • More complex for loop using if statement to control actions, clean up output etc:
@user9384732902
user9384732902 / cert-manager-nginx-ingress-gke-recipe.md
Last active Feb 14, 2020
A quickstart guide to deploying cert-manager and nginx-ingress on GKE
View cert-manager-nginx-ingress-gke-recipe.md

This is a quick recipe for deploying cert-manager and nginx-ingress on GKE to obtain SSL certificates from Lets Encrypt. Whilst this recipe is designed for Google Cloud Platform, it can easily be adapted for other cloud platforms.

We'll begin with a Kubernetes cluster, and we'll obtain authentication credentials.

gcloud container clusters get-credentials my-test-app
kubectl config current-context
kubectl get nodes
@JaySunSyn
JaySunSyn / index.js
Created Jan 21, 2018
Firebase functions Dynamic OG-Tags
View index.js
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') ||
View longpress-directive.js
Vue.directive('longpress', {
bind: function (el, binding, vNode) {
// Make sure expression provided is a function
if (typeof binding.value !== 'function') {
// Fetch name of component
const compName = vNode.context.name
// pass warning to console
let warn = `[longpress:] provided expression '${binding.expression}' is not a function, but has to be`
if (compName) { warn += `Found in component '${compName}' ` }
@edsiper
edsiper / kubernetes_commands.md
Last active Jul 30, 2020
Kubernetes Useful Commands
View kubernetes_commands.md
You can’t perform that action at this time.