Skip to content

Instantly share code, notes, and snippets.

View dnaber-de's full-sized avatar
🏠
Working from home

David Naber dnaber-de

🏠
Working from home
View GitHub Profile
@tyrann0us
tyrann0us / gist:2231b4af0a47f8b79cf873d1ba2c7e68
Last active June 8, 2020 09:27
All WooCommerce order status with German translation (and slug)
"Pending payment" (pending) = "Zahlung ausstehend"
"Processing" (processing) = "In Bearbeitung"
"On hold" (on-hold) = "In Wartestellung"
"Completed" (completed) = "Abgeschlossen" ("Fertiggestellt" in some places for Swiss German)
"Cancelled" (cancelled) = "Storniert/Abgebrochen"
"Refunded" (refunded) = "Rückerstattet"
"Failed" (failed) = "Fehlgeschlagen"
@dbu
dbu / CacheWarmerCompilerPass.php
Last active March 4, 2024 15:13
Conditionally tag a service in Symfony
<?php
// src/DependencyInjection/CacheWarmerCompilerPass.php
namespace App\DependencyInjection;
use App\Cache\MyCacheWarmer;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\EnvNotFoundException;
anonymous
anonymous / provisioner-php5.5.sh
Created November 20, 2016 13:59
Scotch Box Change PHP Repository
#!/usr/bin/env bash
# Update PHP Repo
sudo rm /etc/apt/sources.list.d/ondrej-php5-5_6-trusty.list
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get -y update
# Remove PHP 5.6
sudo apt-get --remove purge -y php5 php5-cli php5-curl php5-gd php5-intl php5-mcrypt php5-memcached php5-mysqlnd php5-readline php5-sqlite php5-cgi php5-common php5-fpm php5-imagick php5-json php5-memcache php5-mongo php5-pgsql php5-redis php-pear
sudo apt-get -y autoremove
@frankdejonge
frankdejonge / example.php
Last active May 21, 2017 17:41
Mirco-time precise DateTime(Immutable) instances.
<?php
function mirco_time_precise_date_time_immutable()
{
return DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', microtime(true)));
}
@stephenharris
stephenharris / flush-permalink.sh
Last active July 20, 2016 18:40
Can be used to flush the rewrite rules of all sites in a multisite network.
@gmazzap
gmazzap / AutoPaginatedQuery.php
Last active April 8, 2016 21:49
`WP_Query` subclass that takes a non-paginated query and split into different paginated queries offering a transparent interface to "standard loop" usage.
<?php
namespace GM;
/**
* `WP_Query` subclass that takes a non-paginated query and split into different
* paginated queries offering a transparent interface to "standard loop" usage.
*
* The class is not 100% transparent:
* - the var `$posts` and the method `get_posts()`, that are not used directly
* in standard loop usage, here don't return array of all posts, but only posts
@subfuzion
subfuzion / curl.md
Last active April 26, 2024 09:43
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@tvlooy
tvlooy / unit.sh
Last active February 4, 2024 04:20
Bash test: get the directory of a script
#!/bin/bash
function test {
MESSAGE=$1
RECEIVED=$2
EXPECTED=$3
if [ "$RECEIVED" = "$EXPECTED" ]; then
echo -e "\033[32m✔︎ Tested $MESSAGE"
else
@mishal
mishal / html5-validator
Created December 4, 2014 14:16
Init.d script for validator.nu service
#!/bin/sh
### BEGIN INIT INFO
# Provides: html5-validator
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: HTML5 validator service
# Description: HTML5 validator service using validator.nu engine
@henriquemoody
henriquemoody / phpunit.bash
Last active May 10, 2023 02:52
PHPUnit Bash Completion. sudo curl -L https://gist.githubusercontent.com/henriquemoody/5014805/raw/phpunit.bash -o /etc/bash_completion.d/phpunit && source /etc/bash_completion.d/phpunit
# Bash-Completion script for PHPUnit
#
# Created by Henrique Moody <henriquemoody@gmail.com>
#
_phpunit()
{
COMPREPLY=()
local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}"