Skip to content

Instantly share code, notes, and snippets.

@MethodGrab
MethodGrab / pre-commit
Created July 1, 2020 12:26 — forked from kuy/pre-commit
git: pre-commit hook script to prevent committing FIXME code
#!/bin/sh
matches=$(git diff --cached | grep -E '\+.*?FIXME')
if [ "$matches" != "" ]
then
echo "'FIXME' tag is detected."
echo "Please fix it before committing."
echo " ${matches}"
exit 1
@MethodGrab
MethodGrab / styles.less
Last active January 19, 2018 13:00
Atom styles to disable ligatures on the active line
// Disable ligatures on the active line
// https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-ligatures
atom-text-editor.editor {
.line.cursor-line {
font-variant-ligatures: none;
}
}
@ColCh
ColCh / README.md
Last active September 26, 2024 08:12
Git pre-push hook to confirm pushing to master
#!/usr/bin/env bash #adding this to force silly gist highlighting. REMOVE THIS
# This is a modified version of the script generated by https://docs.npmjs.com/cli/completion to include `npm install` autocompletion.
# Basically we added `if` blocks to check for `install` subcommand.
###-begin-npm-completion-###
#
# npm command completion script
#
# Installation: npm completion >> ~/.bashrc (or ~/.zshrc)
@MethodGrab
MethodGrab / macOS External Display Fix.md
Last active November 16, 2022 20:54
A fix for blurry text on external displays in macOS & OS X

macOS External Display Fix

A fix for blurry text on external displays in macOS & OS X.

  1. Run the patch (src) which will create a new directory in the CWD called DisplayProductID-YYYY:

    ruby ./patch-edid.rb
  2. Reboot into recovery mode (hold down CMD-R while rebooting)

@pirate
pirate / parseURLParameters.js
Last active December 15, 2023 07:17
Parse URL query parameters in ES6
function getUrlParams(search) {
const hashes = search.slice(search.indexOf('?') + 1).split('&')
const params = {}
hashes.map(hash => {
const [key, val] = hash.split('=')
params[key] = decodeURIComponent(val)
})
return params
}

The issue:

..mobile browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap.

(from a new defunct https://developers.google.com/mobile/articles/fast_buttons article)

touch-action CSS property can be used to disable this behaviour.

touch-action: manipulation The user agent may consider touches that begin on the element only for the purposes of scrolling and continuous zooming. Any additional behaviors supported by auto are out of scope for this specification.

@MethodGrab
MethodGrab / README.md
Last active February 22, 2023 14:15
Jenkins NodeJS Plugin: Missing nodejs.org installers

Jenkins NodeJS Plugin: Missing nodejs.org installers

Versions

  • Ubuntu 14.04 LTS x64
  • Java 1.7
  • Jenkins 1.639
  • NodeJS plugin 0.2.1
@paulirish
paulirish / what-forces-layout.md
Last active November 19, 2024 01:01
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