Skip to content

Instantly share code, notes, and snippets.

View derekjohnson's full-sized avatar

Derek Johnson derekjohnson

View GitHub Profile
/* Lets not rely on paths in the database, they can be very wrong when moving between dev/stage/live environments */
/* The following two variables are backward to my thinking, but hey, what ya gonna do? */
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . ''); // This is NOT the 'wordpress admin area' home, but the site's home
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/SECRETDIRECTORY'); // This isn't the site's URL but the WordPress admin area URL
/* MySQL settings */
switch($_SERVER['SERVER_NAME']){
// Your local machine's settings
case 'mysite.local':
define('DB_NAME', 'dev_mysite');
@derekjohnson
derekjohnson / nav.css
Last active August 29, 2015 14:04
Small viewport nav
.l-nav {
&--capable {
position: absolute;
right: 0;
top: -500%;
}
&--capable-open {
top: 0;
right: 5.46875%;

Keybase proof

I hereby claim:

  • I am derekjohnson on github.
  • I am derekjohnson (https://keybase.io/derekjohnson) on keybase.
  • I have a public key whose fingerprint is 10B5 B39A E83E B186 C767 87DB 2B08 64C6 F21B C2D1

To claim this, I am signing this object:

@derekjohnson
derekjohnson / nav.js
Created January 14, 2019 11:12
Accessible performant off canvas sliding nav
/* DOM nodes */
var mainNav = document.querySelector('.js-main-nav'),
navigationList = document.querySelector('.js-navigation-list'),
navigationLinks = document.querySelectorAll('.js-navigation-link'),
navDetector = document.querySelector('.js-nav-detection');
/* Let the browser know it might need to help with the paint perf */
var hintBrowser = function() {
navigationList.style.willChange = 'transform';
};