Skip to content

Instantly share code, notes, and snippets.

View swissspidy's full-sized avatar
🌴
On vacation

Pascal Birchler swissspidy

🌴
On vacation
View GitHub Profile
<?php
/**
* Plugin Name: AMP Schema.org Meta Image Content Fallback
* Description: Promote content image as Schema.org image when no featured image is supplied.
* Plugin URI: https://gist.github.com/westonruter/7358d6669e09cfa15a99021204208a67
* Author: Weston Ruter
* Author URI: https://weston.ruter.net/
* Gist Plugin URI: https://gist.github.com/westonruter/7358d6669e09cfa15a99021204208a67
*/
@westonruter
westonruter / amp-auto-ads.php
Last active July 8, 2023 13:48
Plugin code to add <amp-auto-ads> on WordPress sites powered by the official AMP plugin. Installation instructions: https://gist.github.com/westonruter/6110fbc4bef0c4b8c021a112012f7e9c
<?php
/**
* AMP Auto Ads for AdSense (WordPress Plugin)
*
* @package AMP_Auto_Ads
* @author Weston Ruter, Google
* @license GPL-2.0-or-later
* @copyright 2019 Google Inc.
*
* @wordpress-plugin
@malcolmgreaves
malcolmgreaves / git-largest-files
Last active January 10, 2024 12:44 — forked from nk9/largestFiles.py
Python script to find the largest files in a git repository.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Updated to use Python 3 by Malcolm Greaves.
#
# Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post:
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
#
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch
@felixarntz
felixarntz / wp-scoped-mu-plugin-loader.php
Last active August 10, 2017 10:21
WP Scoped MU Plugin Loader
<?php
/*
Plugin Name: WP Scoped MU Plugin Loader
Plugin URI: https://gist.github.com/felixarntz/9b3bed66099641a45ce437b067fea547
Description: Loads scoped MU plugins for specific sites or networks for an improved organization of those more specific tweaks.
Version: 1.0.0
Author: Felix Arntz
Author URI: https://leaves-and-love.net
License: GNU General Public License v2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@hikari-no-yume
hikari-no-yume / example.php
Created March 20, 2017 20:02
function chaining for PHP 7
<?php declare(strict_types=1);
require_once "✨.🐘";
✨($_)->strlen("foo")->var_dump($_);
@johnbillion
johnbillion / install-all-languages.sh
Created February 18, 2017 20:12
Install all available languages on a WordPress site with WP-CLI
wp core language list --field=language | xargs -n 1 wp core language install
@samyranavela
samyranavela / traefik.sh
Created November 9, 2016 13:47
Start a traefik container & connect to all network
#!/bin/sh
#set -ex
# The daemon's name (to ensure uniqueness and for stop, restart and status)
name="traefik"
# The path of the client executable
command="$HOME/traefik/traefik.sh"
# Any command line arguments for the client executable
command_args=""
# The path of the daemon executable
@Rarst
Rarst / RoboFile.php
Last active December 1, 2019 19:41
Robo command to build a release zip for Composer package.
<?php
class RoboFile extends \Robo\Tasks {
/**
* Creates release zip
*
* @param string $package Composer package in vendor/name format.
* @param string $version Version to build.
*/
vagrant plugin update $(vagrant plugin list |awk '/^[:alnum:]/i {print $1}')
@bueltge
bueltge / wp-i18n-cheatsheet.md
Last active April 2, 2022 13:57
WordPress i18n Cheatsheet

WordPress i18n CheatSheet

Whenever I write plugins or themes, there is one thing that needs a little extra attention and is quite frankly hard to get right: Translatable text. This list should helps me to find the right way fast.

Props to Alex Kirk, there list it inside a quiz.

You want to output the username in a sentence.

Assume that the $username has been escaped using esc_html().