Skip to content

Instantly share code, notes, and snippets.

View DaveyJake's full-sized avatar
🎯
Focusing

Davey Jacobson DaveyJake

🎯
Focusing
View GitHub Profile
@DaveyJake
DaveyJake / wp-rss2-image-enclosure.php
Last active January 12, 2024 16:28 — forked from supermethod/Wordpress RSS 2.0 image enclosure
WP RSS 2.0 Image Enclosure with File Size
<?php
/**
* Wordpress RSS Image Enclosure
*
* Wrap ONLY the featured image inside 'enclosure' tags.
*
* @author Davey Jacobson
* @link https://www.daveyjake.dev
*
* @package DJ_Dev
@DaveyJake
DaveyJake / 0_reuse_code.js
Created December 3, 2015 02:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@DaveyJake
DaveyJake / rn-i18n-locale-identifiers.csv
Created September 9, 2017 09:46 — forked from kiwicopple/rn-i18n-locale-identifiers.csv
React Native i18n Locale Identifiers
Locale Identifier Description
af Afrikaans
af-NA Afrikaans (Namibia)
af-ZA Afrikaans (South Africa)
agq Aghem
agq-CM Aghem (Cameroon)
ak Akan
ak-GH Akan (Ghana)
am Amharic
am-ET Amharic (Ethiopia)
@DaveyJake
DaveyJake / nginx.conf
Created May 11, 2018 04:38 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@DaveyJake
DaveyJake / body-has-class.php
Last active May 19, 2018 06:31
Custom WordPress Function: body_has_class
<?php
/**
* Custom WordPress function to check if the HTML body `class` attribute
* contains one or many specified `className` values.
*
* @author Davey Jacobson <djacobson@usarugby.org>
* @version 1.0.0
*/
if ( ! function_exists( 'body_has_class' ) ) {
/**
<?php
/**
* Constants for the exact number of seconds in any given year and in any given
* month on the Gregorian calendar. Meant to be used in place of the current
* 'YEAR_IN_SECONDS' and 'MONTH_IN_SECONDS' integrations found in
* {@link https://codex.wordpress.org/Easier_Expression_of_Time_Constants|WordPress}.
*
* @author Davey Jacobson <djacobson@usarugby.org>
* @package DJ_Exact_Year_Month_Time_Constants
*/
@DaveyJake
DaveyJake / matt-hardy-must.php
Last active April 5, 2019 17:17
Matt Hardy Must...
<?php
/**
* From the vessel that was this author...
*
* "Why this is simply... WONDERFUL! I have now entered this vessel known as
* 'GEETHUB' and, yes, my reign is now uponeth your precious CODE! We
* now begin the FINAL DELETION!"
*
* From the vessel that is, once again, this author...
*
@DaveyJake
DaveyJake / class-dj-use-lodash.php
Last active August 4, 2019 09:36
[WP] Replace Underscore with Lodash
<?php
/**
* Use `Lodash` as the drop-in replacement for Underscore in WordPress.
*
* This script uses the `CDNJS` API to ensure the latest version of Lodash is
* always retrieved. By default, Lodash will run only on the WordPress frontend
* unless the `$sitewide` parameter is set to `true`.
*
* @author Davey Jacobson <djacobson@usarugby.org>
* @package Davey_Jacobson
@DaveyJake
DaveyJake / check-for-leap-year.php
Last active April 5, 2019 17:16
Check For Leap Year
<?php
/**
* Simple function to check if it's currently a 'leap year'.
*
* @return bool True if it is. False if not.
*/
function is_leap_year() {
// Ensure that '0' isn't read as boolean.
$zero = (int) 0;
@DaveyJake
DaveyJake / core-getExtIP.js
Last active May 21, 2020 15:35
iStat Pro Widget 4.9.2: Restore External IP Support
/**
* Get your current external IP address for the iStat Pro dashboard widget.
*
* For those of us who refuse to let go of the iStat Pro dashboard widget (version 4.9.2),
* this function is located inside of `~/Library/Widgets/iStat\ Pro.wdgt/scripts/core.js`
* beginning at line 243. As of when this Gist was published, Bjango killed the endpoint
* that powered their external IP address service. Thankfully, there's
* {@link https://www.ipify.org}, a free public IP API endpoint. Simply copy and paste the
* function below over the predecessor inside the core.js file and the IP service is
* restored (once again).