Skip to content

Instantly share code, notes, and snippets.

<?php
// Function `parse_yturl()` from <http://stackoverflow.com/a/10524505/624466>
/**
* Check if the input string is a valid YouTube URL
* and try to extract the YouTube Video ID from it.
*
* @author Stephan Schmitz <eyecatchup@gmail.com>
* @param $url string The string that shall be checked.
@richaber
richaber / local-dev.php
Last active September 14, 2023 09:40 — forked from pbiron/enable-disable-plugins-when-doing-local-dev.php
MU plugin to enable/disable other plugins during local development.
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
/**
* Plugin Name: RA Local Dev Plugin
* Description: Install as an mu-plugin to enable and disable other plugins during local development.
* Version: 0.1.0
* License: GPL version 2 or any later version
* Author: Mark Jaquith, Andrey Savchenko, Paul Biron, Richard Aber
*
* Inspired by Paul Biron https://gist.github.com/pbiron/52bb63042cf220256ece89bc07fb57b0,
@richaber
richaber / findStyles.js
Created November 22, 2019 01:03 — forked from macbookandrew/findStyles.js
List unique CSS properties for all DOM elements
/**
* List unique CSS properties for all DOM elements
* Initially created to list unique font stacks on a page
* @see {@link http://stackoverflow.com/a/35022690/ Inspired by this StackOverflow answer}
*
* @see {@link https://gist.github.com/macbookandrew/f33dbbc0aa582d0515919dc5fb95c00a/ URL for this file}
*
* @author AndrewRMinion Design (https://andrewrminion.com)
* @version 1.1
*
@richaber
richaber / GIF-Screencast-OSX.md
Created August 17, 2017 21:50 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@richaber
richaber / gitflow-breakdown.md
Created July 7, 2016 22:14 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
git commit --allow-empty -m "Initial commit"
git checkout -b develop master

Connect to the remote repository

@richaber
richaber / replace-zero-width-space.php
Created July 7, 2016 01:07 — forked from ahmadazimi/replace-zero-width-space.php
PHP replace Zero Width Space using preg_replace
<?php
/**
* http://stackoverflow.com/questions/11305797/remove-zero-width-space-characters-from-a-javascript-string
* U+200B zero width space
* U+200C zero width non-joiner Unicode code point
* U+200D zero width joiner Unicode code point
* U+FEFF zero width no-break space Unicode code point
*/
<?php
class StephanisAddition {
public static function add_two_numbers( $number_one, $number_two ) {
if ( ! is_numeric( $number_one ) || ! is_numeric( $number_two ) ) {
return null;
}
return $number_one + $number_two;
}