Skip to content

Instantly share code, notes, and snippets.

mdawaffe /
Created Dec 5, 2013
Express the Current Approximate Phase of the Moon as an Emoji Character in UTF-8
# Approximates the phase of the moon using a known new-moon time and a fixed lunar phase of 2551443 seconds.
# Outputs the phase as an emoji in UTF-8
"\xf0\x9f\x8c\x91" # 0 - NEW
"\xf0\x9f\x8c\x91" # 1 - NEW
"\xf0\x9f\x8c\x92" # 2 - WAXING CRESCENT
Viper007Bond / whatissoslow.php
Last active Aug 10, 2022
WordPress: Times how long it takes each filter and action to run and displays results at the end of the page. Quick and dirty.
View whatissoslow.php
* This little class records how long it takes each WordPress action or filter
* to execute which gives a good indicator of what hooks are being slow.
* You can then debug those hooks to see what hooked functions are causing problems.
* This class does NOT time the core WordPress code that is being run between hooks.
* You could use similar code to this that doesn't have an end processor to do that.
markjaquith / gist:4500280
Last active Sep 7, 2016
Bash command to fix a quirk with Sublime Text 2's "subl" command. Sometimes, when using it, under hard-to-pinpoint circumstances, it will open up Sublime Text 2 completely blank (i.e. the file you asked it to open will not be open). This snippet fixes that by essentially kicking subl under the table to wake it up and then passing on the command …
View gist:4500280
function subl() {
if [[ ! -p /dev/stdin ]]; then
command subl > /dev/null 2>&1
command subl "$@"
mjangda / ajaxurl.php
Created Aug 18, 2011
Get a domain-mapping safe admin-ajax URL on
View ajaxurl.php
* Generates a domain-mapping safe URL on
* Core's ajaxurl uses admin_url() which returns * which doesn't work for the front-end on domain-mapped sites.
* This works around that and generates the correct URL based on context.
function my_admin_ajax_url( $path = '' ) {
if ( is_admin() )
$url = admin_url( 'admin-ajax.php' );