Skip to content

Instantly share code, notes, and snippets.

View dgaidula's full-sized avatar

Dan Gaidula dgaidula

  • Type Wranglers, LLC
  • Philadelphia
  • 12:13 (UTC -05:00)
View GitHub Profile
@ollyollyollyltd
ollyollyollyltd / PHP-8.4-compatibility.patch
Created August 28, 2025 10:11
Patch for `voku/stringy` PHP 8.4 compatibility issues
From b9f33d8fe48e7f46c9c7c5d815a82e49f415e907 Mon Sep 17 00:00:00 2001
From: Tom Arbesser-Rastburg <[email protected]>
Date: Sat, 7 Dec 2024 22:55:49 +1100
Subject: [PATCH] Fix PHP 8.4 deprecation warnings
---
composer.json | 2 +-
src/Create.php | 2 +-
src/StaticStringy.php | 170 +++++++++++++++++++++---------------------
src/Stringy.php | 38 +++++-----
@dgaidula
dgaidula / makewpsuck.sh
Created June 15, 2024 18:39 — forked from kennyeliason/makewpsuck.sh
Make WP Suck Less or More
#!/bin/bash
# Make sites into bedrock or normal WordPress
# Version 2.0
# Copyright (c) Kenny Eliason
set -a
source .env
set +a
#!/usr/bin/env bash
function firefox2cookiejar() {
# http://fileformats.archiveteam.org/wiki/Netscape_cookies.txt
# https://www.codejam.info/2021/10/bypass-sqlite-exclusive-lock.html
sqlite3 -separator ' ' "file:$1?immutable=1" <<- EOF
.mode tabs
.header off
select host,
case substr(host,1,1)='.' when 0 then 'FALSE' else 'TRUE' end,
path,
@jxxe
jxxe / Cache.php
Last active September 25, 2024 20:51
A quick and dirty PHP class to cache JSON data
<?php
const MONTH = "Y-m"; // 2000-01
const DAY = "Y-m-d"; // 2000-01-01
const HALF_DAY = "Y-m-d-A"; // 2000-01-01-AM
const HOUR = "Y-m-d-H"; // 2000-01-01-24
const MINUTE = "Y-m-d-H-i"; // 2000-01-01-24-60
class Cache {
@sindresorhus
sindresorhus / esm-package.md
Last active December 10, 2025 13:22
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.
@zsimic
zsimic / linode-ddns.sh
Last active November 20, 2023 02:39
Linode dynamic dns on ubiquiti edge router
#!/bin/bash
# See https://gist.github.com/zsimic/c39dd9686c6d6b0d149a67ff23286b99 for docs on how to use
# Note: you can invoke with LOGFILE= for troubleshooting
[ -z "$LOGFILE" ] && LOGFILE=/var/log/messages
if [ -z "$1" -a -f $LOGFILE ]; then # Pass any command line arg to avoid the logging redirect
exec $0 run 1>> $LOGFILE 2>&1
fi
@kennyeliason
kennyeliason / makewpsuck.sh
Last active April 29, 2025 19:43
Make WP Suck Less or More
#!/bin/bash
# Make sites into bedrock or normal WordPress
# Version 2.0
# Copyright (c) Kenny Eliason
set -a
source .env
set +a
@nevermosby
nevermosby / build-curl-with-c-ares.sh
Last active April 4, 2024 00:40
build curl with c ares for custom dns server
## for some distributions of Linix, like ubuntu 18.04
## `curl` does not include `c-ares` module so that you cannot do `curl --dns-servers 8.8.8.0 www.example.com`
## you will get error message as below:
## curl: (4) A requested feature, protocol or option was not found built-in in this libcurl due to a build-time decision.
# build curl from source code
# You can do that with building `curl` from souce code. below is tested against ubuntu 18.04
# download the code from git repo
git clone https://github.com/curl/curl.git && cd curl
@iridiumcao
iridiumcao / check_git_branch_exists.sh
Created March 22, 2020 13:57
How to check if a git branch exists in the local/remote repository?
# Local:
# https://stackoverflow.com/questions/21151178/shell-script-to-check-if-specified-git-branch-exists
# test if the branch is in the local repository.
# return 1 if the branch exists in the local, or 0 if not.
function is_in_local() {
local branch=${1}
local existed_in_local=$(git branch --list ${branch})
if [[ -z ${existed_in_local} ]]; then
echo 0
@cyberwani
cyberwani / wordpress-upload-base64.php
Created September 13, 2019 10:19
Upload a base64 string as image to the WordPress media library
<?php
/**
* Save the image on the server.
*/
function save_image( $base64_img, $title ) {
// Upload dir.
$upload_dir = wp_upload_dir();
$upload_path = str_replace( '/', DIRECTORY_SEPARATOR, $upload_dir['path'] ) . DIRECTORY_SEPARATOR;