Skip to content

Instantly share code, notes, and snippets.

Davey Jacobson DaveyJake

Block or report user

Report or block DaveyJake

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@DaveyJake
DaveyJake / settings.js
Last active May 23, 2020
VSCode Default Settings (JSON but named JS for syntax)
View settings.js
// Complete List of VSCode Defaults: https://vscode.readthedocs.io/en/latest/getstarted/settings
{
// Most Commonly Used
// Controls auto save of dirty files. Accepted values: 'off', 'afterDelay', 'onFocusChange' (editor loses focus), 'onWindowChange' (window loses focus). If set to 'afterDelay', you can configure the delay in 'files.autoSaveDelay'.
"files.autoSave": "off",
// Controls the font size in pixels.
"editor.fontSize": 14,
@DaveyJake
DaveyJake / acf-fallback-functions.php
Last active May 21, 2020
Retrieve ACF data if plugin is ever deactivated or uninstalled.
View acf-fallback-functions.php
<?php
/**
* Should ACF ever become disabled or deactivated for any reason
* these functions will ensure that nothing dies in the process.
*
* These functions were inspired by {@author Steve Grunwell} and
* {@author Bill Erickson}. Their work can be viewed, respectively,
* at {@link https://stevegrunwell.com} and
* {@link https://www.billerickson.net}.
*
@DaveyJake
DaveyJake / class-dj-register-custom-taxonomy-post-type.php
Created Jan 25, 2020
[WP] An elongated file showing how to register a custom taxonomy and custom post type.
View class-dj-register-custom-taxonomy-post-type.php
<?php
/**
* Developer API: Snippets for common WordPress configuration setups.
*
* IMPORTANT: You MUST defined the `const` variables in this file before
* implementing it into your current project.
*
* @link https://codex.wordpress.org/Function_Reference/register_taxonomy
* @link https://codex.wordpress.org/Function_Reference/register_post_type
*
@DaveyJake
DaveyJake / .htaccess
Last active Sep 12, 2019 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
View .htaccess
# 301 Redirects for .htaccess
# Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
# Redirect an entire site:
Redirect 301 / http://www.domain.com/
# Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
View daveyjacobson-widget-template.php
<?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,
@DaveyJake
DaveyJake / davey-jacobson-custom-nav-walker.php
Last active Jul 12, 2019
Add custom ID attribute to all WordPress submenus. Great for building mega menus.
View davey-jacobson-custom-nav-walker.php
<?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 / core-getExtIP.js
Last active May 21, 2020
iStat Pro Widget 4.9.2: Restore External IP Support
View core-getExtIP.js
/**
* 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).
View check-for-leap-year.php
<?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 / class-dj-use-lodash.php
Last active Aug 4, 2019
[WP] Replace Underscore with Lodash
View class-dj-use-lodash.php
<?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 / matt-hardy-must.php
Last active Apr 5, 2019
Matt Hardy Must...
View matt-hardy-must.php
<?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...
*
You can’t perform that action at this time.