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 / 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 / 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 / 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 / davey-jacobson-custom-nav-walker.php
Last active July 12, 2019 00:50
Add custom ID attribute to all WordPress submenus. Great for building mega menus.
<?php
/**
* Nav Menu API: DJ_NavWalker class.
*
* I cloned & modified this class to help improve compatibility for
* WordPress and the Foundation 5.5.3 `dropdown` module.
*
* @author Davey Jacobson <djacobson@usarugby.org>
*
* @package Davey_Jacobson
@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 / daveyjacobson-widget-template.php
Created September 5, 2019 06:26
Basic WP Widget Template
<?php
/**
* This is just a widget template file. Be sure to change everything your
* reading to suit your website's needs.
*
* IF YOU'RE A WORDPRESS NEWB AND DO NOT KNOW WHAT YOU'RE DOING...
*
* This entire file, with the exception of the lines that contain
* `public [static] function` can be modified to whatever you wish. Just be sure
* to NOT rename any of the methods contained in this class. For more information,