Skip to content

Instantly share code, notes, and snippets.

View davidegreenwald's full-sized avatar

David Greenwald davidegreenwald

View GitHub Profile
@hyperupcall
hyperupcall / settings.jsonc
Last active May 13, 2024 22:21
VSCode config to disable popular extensions' annoyances (telemetry, notifications, welcome pages, etc.)
// I'm tired of extensions that automatically:
// - show welcome pages / walkthroughs
// - show release notes
// - send telemetry
// - recommend things
//
// This disables all of that stuff.
// If you have more config, leave a comment so I can add it!!
{
@jbrinley
jbrinley / opcache.preload.php
Created December 22, 2019 20:16
WordPress core opcache.preload
<?php
declare( strict_types=1 );
$wp_dir = '/application/www/wp/';
$preload_patterns = [
$wp_dir . "wp-includes/Text/Diff/Renderer.php",
$wp_dir . "wp-includes/Text/Diff/Renderer/inline.php",
$wp_dir . "wp-includes/SimplePie/**/*.php",
$wp_dir . "wp-includes/SimplePie/*.php",
<?php
namespace YourPlugin\Blocks;
abstract class Block{
/**
* Block title
*
* @var string
@rohenaz
rohenaz / stripParamsWorker.js
Created April 22, 2019 15:36
cloudflare worker - strip referral query parameters such as fbclid
/**
* Define regular expressions at top to have them precompiled.
*/
const urlRegex = new RegExp('^(refreshce|gclid|cx|ie|cof|siteurl|zanpid|origin|utm_[a-z]+|fbid|fbclid|mr:[A-z]+|ref(id|src))$');
addEventListener('fetch', event => {
event.passThroughOnException()
event.respondWith(handleRequest(event.request))
})
@OliverJAsh
OliverJAsh / README.md
Last active February 24, 2022 05:26
Flexbox gutters

Flexbox gutters

Problem

  • We use flexbox for our layout.
  • We want to add horizontal and vertical gutters inbetween these items.
  • Items wrap according to contents (flex-wrap: wrap), therefore we can't decide when/where to apply gutters using breakpoints.

Solution

@ryanshoover
ryanshoover / wpengine-stop-htaccess-rewrites.php
Created February 4, 2019 20:02
WP Plugin Stop htaccess rewrites
<?php
/**
* Stop htaccess rewrites
*
* @package wpengine-stop-htaccess-rewrites
* @author wpengine
* @license Proprietary
*
* @wordpress-muplugin
* Plugin Name: Stop htaccess rewrites
@bradtraversy
bradtraversy / docker-help.md
Last active May 15, 2024 05:31
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@kierzniak
kierzniak / functions.php
Last active July 24, 2018 06:21
Get category related posts published before given post
<?php
/**
* Class provided to get category related posts published before given post
*
* @author Motivast motivast.com
* @copyright 2018 - present, Motivast
*
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt GPL-2.0-or-later
*
@cecilemuller
cecilemuller / 2019-https-localhost.md
Last active May 23, 2024 16:23
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@dobesv
dobesv / dev_signed_cert.sh
Last active March 21, 2024 07:47
Script to create (1) a local certificate authority, (2) a host certificate signed by that authority for the hostname of your choice
#!/usr/bin/env bash
#
# Usage: dev_signed_cert.sh HOSTNAME
#
# Creates a CA cert and then generates an SSL certificate signed by that CA for the
# given hostname.
#
# After running this, add the generated dev_cert_ca.cert.pem to the trusted root
# authorities in your browser / client system.
#