Skip to content

Instantly share code, notes, and snippets.

View schalkburger's full-sized avatar
💪
eat sleep code repeat

Schalk Burger schalkburger

💪
eat sleep code repeat
View GitHub Profile
@schalkburger
schalkburger / bookmarklet-debug-horizontal-scroll.js
Created July 22, 2018 18:44
Bookmarklet - Debug horizontal scroll
javascript:(function(d){var w=d.documentElement.offsetWidth,t=d.createTreeWalker(d.body,NodeFilter.SHOW_ELEMENT),b;while(t.nextNode()){b=t.currentNode.getBoundingClientRect();if(b.right>w||b.left<0){t.currentNode.style.setProperty('outline','1px dotted red','important');console.log(t.currentNode);}};}(document));
@schalkburger
schalkburger / bookmarklet-edit-website.js
Created July 22, 2018 18:30
Bookmarklet - Edit Website
javascript:document.body.contentEditable = 'true'; document.designMode='on'; void 0
@schalkburger
schalkburger / bookmarklet-toggle-css.js
Created July 22, 2018 18:11
Bookmarklet - Toggle CSS
javascript:(function(){function d(a,b){a.setAttribute("data-css-storage",b)}function e(a){var b=a.getAttribute("data-css-storage");a.removeAttribute("data-css-storage");return b}var c=[];(function(){var a=document.body,b=a.hasAttribute("data-css-disabled");b?a.removeAttribute("data-css-disabled"):a.setAttribute("data-css-disabled","");return b})()?(c=document.querySelectorAll("[data-css-storage]"),[].slice.call(c).forEach(function(a){"STYLE"===a.tagName?a.innerHTML=e(a):"LINK"===a.tagName?a.disabled=!1:a.style.cssText=e(a)})):(c=document.querySelectorAll("[style], link, style"),[].slice.call(c).forEach(function(a){"STYLE"===a.tagName?(d(a,a.innerHTML),a.innerHTML=""):"LINK"===a.tagName?(d(a,""),a.disabled=!0):(d(a,a.style.cssText),a.style.cssText="")}))})();
@schalkburger
schalkburger / timed-debugger.js
Created March 20, 2018 14:17
Timed debugger
javascript:setTimeout(function() { debugger; }, 1000);
@schalkburger
schalkburger / install-php7-scotbox-3.txt
Last active December 28, 2017 12:06
Install PHP 7 on Scotch Box 3 Free
List of PHP 7 Packages: https://launchpad.net/ubuntu/+source/php7.0
Disclaimer: I get unreliable results when I don't run these commands seperately and in order.
vagrant ssh
sudo apt-get update
sudo add-apt-repository ppa:ondrej/php
sudo apt-get install php7.0
sudo apt-get update
sudo apt-get install php7.0-mysql libapache2-mod-php7.0 php7.0-fpm php7.0-json php7.0-xmlrpc php7.0-cgi php7.0-opcache php7.0-zip php7.0-imap php7.0-curl php7.0-xml php7.0-gd php-mbstring php7.0-mbstring php-gettext libapache2-mod-php7.0
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php7.0-fpm
@schalkburger
schalkburger / scotch-box-30-vagrant-up-error.txt
Created December 22, 2017 07:55
Fix Scotch Box 3.0 authentication issue with vagrant up
If you are getting the following error after you've upgraded to version 3.0 of Scotch Box:
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
This sometimes happens with the upgrade. Try this in the Vagrantfile:
config.ssh.username = "vagrant"
@schalkburger
schalkburger / scroll-position.js
Created September 29, 2017 09:37
Output the Scroll Position on Console
$(window).scroll(example);
function example() {
var tempScrollTop = $(window).scrollTop();
console.log("Scroll from Top: " + tempScrollTop.toString());
};
@schalkburger
schalkburger / sage_favicons.php
Last active January 16, 2020 01:33
Roots Sage Favicons
/**
* Load favicons
* Place icons in the theme images directory. Want more? http://realfavicongenerator.net/
*/
function sage_favicons() {
echo '<link rel="apple-touch-icon" sizes="57x57" href="'. get_template_directory_uri() .'/dist/images/apple-touch-icon-57x57.png">';echo "\n";
echo '<link rel="apple-touch-icon" sizes="60x60" href="'. get_template_directory_uri() .'/dist/images/apple-touch-icon-60x60.png">';echo "\n";
echo '<link rel="apple-touch-icon" sizes="72x72" href="'. get_template_directory_uri() .'/dist/images/apple-touch-icon-72x72.png">';echo "\n";
echo '<link rel="apple-touch-icon" sizes="76x76" href="'. get_template_directory_uri() .'/dist/images/apple-touch-icon-76x76.png">';echo "\n";
echo '<link rel="apple-touch-icon" sizes="114x114" href="'. get_template_directory_uri() .'/dist/images/apple-touch-icon-114x114.png">';echo "\n";
@schalkburger
schalkburger / sql-mass-search-replace.sql
Created March 8, 2016 10:38
WordPress database mass search and replace
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
@schalkburger
schalkburger / wordpress-remove-cssjs-ver.php
Last active August 4, 2017 19:54
Wodrdpress remove CSS and JS version number that is appended
function remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );