Skip to content

Instantly share code, notes, and snippets.

View ntwb's full-sized avatar
🏠
Working from home

Stephen Edgar ntwb

🏠
Working from home
View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active November 16, 2024 22:43
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@dd32
dd32 / fatal-error-handler.php
Last active January 13, 2023 00:52
A quick WordPress 5.1 shutdown handler to disable the plugin/theme pausing features. Install as wp-content/fatal-error-handler.php. This is needed during development, and on sites which have sensitive plugins enabled which must never be deactivated. You should also consider adding a wp-content/php-error.php template. UPDATE: This is replaced by …
<?php
// UPDATE: This can be replaced by `define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true );` in `wp-config.php`.
// See https://core.trac.wordpress.org/changeset/44674
/**
* Shutdown handler to disable WordPress 5.1's plugin/theme pausing features.
*/
class dd32_Fatal_Error_Handler extends WP_Fatal_Error_Handler {
// Do not store errors, this disables the ability for plugins/themes to be marked 'paused'.

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
// ==UserScript==
// @name Dupe review helper
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Watches out for reviews made by the same IP subnet
// @author anevins12
// @match https://wordpress.org/support/topic/*
// @grant none
// ==/UserScript==
@barryblando
barryblando / .eslintrc
Last active September 26, 2020 13:35
VSCode Setup Prettier + ESLint + StyleLint for React
{
"extends": [
"airbnb",
"prettier",
"prettier/react"
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 8,
"ecmaFeatures": {
@omarreiss
omarreiss / wpjs.md
Last active February 20, 2018 13:59

Setting up your development environment

[better title needed]

[insert table of contents]

System requirements

Node.js and npm

WordPress uses a JavaScript task runner called Grunt to build its files. It requires the most recent LTS version of the Node.js runtime. It also requires dependencies fetched via npm. npm is packaged with Node.js, so if your computer has Node.js installed you are ready to go.

@troyfontaine
troyfontaine / README.md
Last active October 15, 2023 09:58
Ubiquiti USG config.gateway.json Syntax

Ubiquiti USG Advanced Configuration

Overview

Integrated DNS Overview

When using a USG with Ubiquiti's Unifi Controller software (version 5.6 and earlier), the functionality of integrating the hostnames of clients (when they request a DHCP lease) into local DNS does not appear to work as you would find with Consumer grade routers. To work around this limitation, we can add static host mappings to a configuration file that will be provisioned to the USG when either a configuration change is made or we force provisioning to the USG itself.

Non-GUI Supported Dynamic DNS Providers

I've added in the necessary syntax for adding Cloudflare DDNS to the USG for VPN/Services setup courtesy of this post by britannic on the Ubiquiti Forums.

Configuration File

@johnbillion
johnbillion / roles.sh
Created November 22, 2017 00:19
Create a user account for each role on your WordPress site
# wp-cli: http://wp-cli.org/
wp role list --fields=role --format=csv \
| tail -n +2 \
| xargs -I {} wp user create "user-{}" "{}@example.com" --role={}
@westonruter
westonruter / forward-vvv-ssh-command.sh
Last active April 2, 2019 20:18
vvv-ssh: Seamlessly and quickly connect to VVV over SSH
#!/bin/bash
$( dirname $0 )/vvv-ssh $( basename $0 ) $@
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active November 13, 2024 14:50
Hyperlinks in Terminal Emulators