Skip to content

Instantly share code, notes, and snippets.

View stockhuman's full-sized avatar

Michael Hemingway stockhuman

View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active May 21, 2024 09:11
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
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active May 20, 2024 11:33
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@mullnerz
mullnerz / archive-website.md
Last active May 14, 2024 20:06
Archiving a website with wget

The command I use to archive a single website

wget -mpck --html-extension --user-agent="" -e robots=off --wait 1 -P . www.foo.com

Explanation of the parameters used

  • -m (Mirror) Turns on mirror-friendly settings like infinite recursion depth, timestamps, etc.
@simonghales
simonghales / revised.ts
Last active March 23, 2024 23:26
Running a game loop on a web worker
export const createNewPhysicsLoopWebWorker = (stepRate: number) => {
return new Worker('data:application/javascript,' +
encodeURIComponent(`
var start = performance.now();
var updateRate = ${stepRate};
function getNow() {
return start + performance.now();
}
@ObserverOfTime
ObserverOfTime / css-inject.js
Last active March 3, 2024 04:46 — forked from 1j01/README.md
GitHub Desktop Dark Theme - NO LONGER MAINTAINED
/**
* To apply the theme:
* 1) Open dev tools with CTRL + SHIFT + I
* 2) Go to the console
* 3) Paste the following code
* Note: You will have to do this again whenever Github Desktop updates
*/
const fs = require('fs');
const path = require('path');
@justincjahn
justincjahn / README.md
Last active January 16, 2024 20:15
Minecraft server(s) using systemd and screen.

Install

# Install dependencies
sudo yum install -y java-1.8.0-openjdk screen

# Create a new unprivileged user for minecraft
useradd -r -m -d /opt/minecraft minecraft

# Create the directory that will house our minecraft instances

sudo su --shell /bin/bash minecraft

// note : if you're on github gist and want to copy paste this code, you can click on the "Raw" button
// and then do Ctrl A, Ctrl C, Ctrl V
// (code below by Kurt Spencer, slightly modified code to run as Processing tab)
// maybe you should rather use this new (improved) version of the noise instead : https://github.com/KdotJPG/OpenSimplex2
/*
* OpenSimplex Noise in Java.
* by Kurt Spencer
*
* v1.1 (October 5, 2014)
@sabatale
sabatale / montreal-fsa-polygons.geojson
Created March 15, 2021 23:59
Geojson with postal codes FSA polygons for Montréal, QC, Canada.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@supermamon
supermamon / config.json
Last active May 3, 2023 22:52
Mars Rover Camera for Homebridge
"platforms": [
{
"platform": "Camera-ffmpeg",
"name": "Camera FFmpeg",
"cameras": [
{
"name": "Curiosity NAVCAM",
"videoConfig": {
"source": "-f image2 -loop 1 -s 720x480 -pix_fmt yuvj422p -i /homebridge/cams/curiosity-NAVCAM-curr.jpg"
}
@miguel-perez
miguel-perez / readyExec.js
Last active January 29, 2023 18:04
How to add the ability to re-run $(document).ready() functions
/**
* Replace jQuery's $.fn.ready() function with a mod exec
*
* Sites that make heavy use of the $(document).ready function
* are generally incompatable with asynchrounous content. The
* the $.fn.ready function only runs once. This script replaces
* the ready function with a module execution controller that
* let's us register functions and execute all of the functions
* as we need them. This is useful after HTML gets injected on the
* page and we want to rebind functionally to the new content.