Skip to content

Instantly share code, notes, and snippets.

@webmasterMeyers
webmasterMeyers / gist:6c810fb92ae4ffaa44d824a3cc2503dd
Last active December 2, 2020 16:22
disable current php and enable php with passed version, usage `$ switch-php 7.4` save this in your ~/.bashrc
#disable current php and enable php with passed version
function switch-php {
sudo a2dismod php$(php -v | grep -o -E '[0-9.]+' -m 1 | cut -c 1-3 | head -n 1);
sudo a2enmod php$1;
sudo update-alternatives --set php /usr/bin/php$1;
sudo update-alternatives --set phar /usr/bin/phar$1;
sudo update-alternatives --set phar.phar /usr/bin/phar.phar$1;
sudo update-alternatives --set phpize /usr/bin/phpize$1;
sudo update-alternatives --set php-config /usr/bin/php-config$1;
sudo service apache2 restart;
@webmasterMeyers
webmasterMeyers / scrollToAnchor.js
Last active April 1, 2021 18:27
Add this script file to either the `<head>` section or before the `</body>` tag. It will automatically smooth scroll to your anchor tags (id's) when clicking a link targeting them in the `href=""`. Insparation, and original scripts taken from https://gist.github.com/benjamincharity/6058688 and https://gist.github.com/madrobby/8507960
;(function($){
$.fn.scrollToTop = function(position){
var $this = this,
targetY = position || 0,
initialY = $this.scrollTop(),
lastY = initialY,
delta = targetY - initialY,
speed = Math.min(1500, Math.min(2000, Math.abs(initialY-targetY))),
start, t, y, frame = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||