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
@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
function log( change ) {
// Note that |change.object| is actually a reference to the
// target object.
if ( change.type === "read" ) {
console.log( "What was accessed? ", change.name );
console.log( "What value was given? ", change.oldValue );
}
else {
@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
@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.
@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)));
}
@markjaquith
markjaquith / plugin-deploy.sh
Created November 16, 2012 05:04 — forked from scribu/plugin-deploy.sh
Plugin deploy script
#!/bin/bash
# args
MSG=${1-'deploy from git'}
BRANCH=${2-'trunk'}
# paths
SRC_DIR=$(git rev-parse --show-toplevel)
DIR_NAME=$(basename $SRC_DIR)
DEST_DIR=~/svn/wp-plugins/$DIR_NAME/$BRANCH
@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"
@thefuxia
thefuxia / hide-dead-menu-metaboxes.php
Last active September 17, 2021 15:25
T5 Hide dead menu metaboxesWordPress Plugin to improve the menu management screen.
<?php
/**
* Plugin Name: T5 Hide dead menu metaboxes
* Description: Do not show menu metaboxes when no nav menu exists.
* Plugin URI: https://gist.github.com/thefuxia/4432959
* Version: 2013.01.02
* Author: Fuxia Scholz
* Author URI: https://fuxia.me
* Licence: MIT
* License URI: http://opensource.org/licenses/MIT
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
@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]}"