Skip to content

Instantly share code, notes, and snippets.

Schalk Burger schalkburger

View GitHub Profile
View bookmarklet-debug-css.js
javascript:(function(d,i,l){l=d.getElementById(i);if(l){l.parentNode.removeChild(l);return;}l=d.createElement('link');l.id=i;l.rel='stylesheet';l.type='text/css';l.href='//imbrianj.github.io/debugCSS/debugCSS.css';d.getElementsByTagName('head')[0].appendChild(l);}(document,'debugCSS'))
View bookmarklet-svg-crowbar.js
javascript:javascript: (function () { var e = document.createElement('script'); e.setAttribute('src', 'https://nytimes.github.io/svg-crowbar/svg-crowbar-2.js'); e.setAttribute('class', 'svg-crowbar'); document.body.appendChild(e); })();
@schalkburger
schalkburger / bookmarklet-debug-horizontal-scroll.js
Created Jul 22, 2018
Bookmarklet - Debug horizontal scroll
View bookmarklet-debug-horizontal-scroll.js
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));
View bookmarklet-edit-website.js
javascript:document.body.contentEditable = 'true'; document.designMode='on'; void 0
View bookmarklet-toggle-css.js
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="")}))})();
View timed-debugger.js
javascript:setTimeout(function() { debugger; }, 1000);
@schalkburger
schalkburger / install-php7-scotbox-3.txt
Last active Dec 28, 2017
Install PHP 7 on Scotch Box 3 Free
View install-php7-scotbox-3.txt
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 Dec 22, 2017
Fix Scotch Box 3.0 authentication issue with vagrant up
View scotch-box-30-vagrant-up-error.txt
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 Sep 29, 2017
Output the Scroll Position on Console
View scroll-position.js
$(window).scroll(example);
function example() {
var tempScrollTop = $(window).scrollTop();
console.log("Scroll from Top: " + tempScrollTop.toString());
};
View sage_favicons.php
/**
* 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";
You can’t perform that action at this time.