Skip to content

Instantly share code, notes, and snippets.

View royteusink's full-sized avatar

Roy Teusink royteusink

View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active October 17, 2025 07:12
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@adactio
adactio / basicServiceWorker.js
Last active March 27, 2023 09:30
A basic Service Worker, for use on, say, a blog.
'use strict';
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
(function() {
// Update 'version' if you need to refresh the cache
var staticCacheName = 'static';
var version = 'v1::';
@manifestinteractive
manifestinteractive / multiple-npm-accounts.md
Created September 2, 2017 03:41
Multiple NPM Accounts on Single Machine

Multiple NPM Accounts on Single Machine

Create Custom NPM Config

If you do not already have a local ~/.npmrc file, you need to create one.

  1. Open a terminal window
  2. Run npm login
@ryanhamley
ryanhamley / use-svg-as-icon-image-mapboxgl.js
Last active October 25, 2024 12:42
This gist shows how to use an <svg> element as an icon-image for a Mapbox GL symbol layer
// How to add an SVG as a symbol layer's icon image: https://github.com/mapbox/mapbox-gl-js/issues/5529#issuecomment-340011876
// Also see here: https://stackoverflow.com/a/11765731/2748013 (we need the data url stuff for the image src)
// NOTE: Importing SVGs requires an inline module loader such as https://github.com/webpack-contrib/svg-inline-loader
import template from './templates/marker.svg';
const width = 20;
const height = 40;
const img = new Image(width, height);
// map is your Mapbox GL map object
@blackcater
blackcater / diagrams.md
Created July 6, 2018 16:45
Markdown Diagrams

Diagrams

Markdown Preview Enhanced supports rendering flow charts, sequence diagrams, mermaid, PlantUML, WaveDrom, GraphViz, Vega & Vega-lite, Ditaa diagrams. You can also render TikZ, Python Matplotlib, Plotly and all sorts of other graphs and diagrams by using Code Chunk.

Please note that some diagrams don't work well with file exports such as PDF, pandoc, etc.

Flow Charts

This feature is powered by flowchart.js.

@Ron-e
Ron-e / bash.txt
Created September 2, 2018 10:09
remove services before installing Sentora
yum remove -y httpd httpd-devel php php-devel php-gd php-mbstring php-intl php-mysql php-xml php-xmlrpc php-mcrypt php-imap php-pear php-mysql php-cli php-common php5-dev myself mysql dovecot-mysql MariaDB MariaDB-common MariaDB-compat MariaDB-server phpMyAdmin postfix dovecot dovecot-mysql dovecot-pigeonhole sendmail ProFTPd proftpd proftpd-mysql vsftpd named bind bind-utils bind-libs bind9 pdns pdns-backend-mysql pdns-server pdns-server-backend-mysql webalizer crontabs
yum clean all
yum install -y curl
@vicgonvt
vicgonvt / deployment_guide.md
Last active July 17, 2025 01:37
Deployment Guide for Ubuntu Server from Scratch with Laravel
@royteusink
royteusink / vue-sanctum.md
Last active December 31, 2020 13:21
vue cli + laravel sanctum

CORS issues with local development setup Laravel Sanctum with Vue3 cli

app.yourdomain.test

vue app created with vue cli.

axios.create({
  baseURL: process.env.VUE_APP_API_URL,
  withCredentials: true
@vivgui
vivgui / bigger-tailwindcss-spacing-scale.js
Last active August 28, 2023 21:55
Here's a bigger spacing scale for TailwindCSS.
spacing: {
"13": '3.25rem',
"15": '3.75rem',
"17": '4.25rem',
"18": '4.5rem',
"19": '4.75rem',
"76": "19rem",
"84": "21rem",
"88": "22rem",
"92": "23rem",
@lukaskleinschmidt
lukaskleinschmidt / HandleInertiaRequests.php
Last active November 24, 2024 08:22
inertia-laravel multiple root views
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Inertia\Middleware;
class HandleInertiaRequests extends Middleware
{