Skip to content

Instantly share code, notes, and snippets.

View Orlandster's full-sized avatar
😃
fulfilled, like a resolved promise

Orlandster Orlandster

😃
fulfilled, like a resolved promise
  • Zürich, Switzerland
View GitHub Profile
ssh {{server}}
cd {{folder}}
wp db export export.sql
tar -czf db.tar.gz export.sql
rsync -i -avz {{server}}/{{folder}}/db.tar.gz ./
tar -xzf db.tar.gz
// if flywheel -> start ssh shell from UI
@Orlandster
Orlandster / gist:fbefbb13e3470c3895663ac146ad6fd3
Last active November 2, 2018 08:41
Mac Kill process on a specific port
sudo lsof -i tcp:3000
kill -9 <PID>
@Orlandster
Orlandster / gist:33498d9fa2d6cae9812143eaa437c5a0
Last active October 17, 2018 13:05
Git remove untracked files
// check what will be affected
git clean -n
// remove untracked files
git clean -d
// remove untracked files and folders
git clean -f -d
@Orlandster
Orlandster / gallery.js
Created September 25, 2018 13:28
WooCommerce Twig Single Proudct Gallery with variations
@Orlandster
Orlandster / gist:07e6771b04124c356d5e451b70a37634
Created September 13, 2018 09:51
Change content of Pseudo Element (::before, ::after) - ES6
const setPseudoElContent = (selector, value) => {
document.styleSheets[0].addRule(selector, `content: "${value}";`);
}
setPseudoElContent('.class::after', 'Hello World!');
@Orlandster
Orlandster / gist:38b54962ba49e769add0b6330ca1d4dc
Created July 27, 2018 12:43
Git: merge branch from different repositories
mkdir joinSamples
cd joinSamples
git init
git remote add sample1 git.yourserver.local/sample1.git
git remote add sample2 git.yourserver.local/sample2.git
git fetch sample1
git fetch sample2
git branch sample1_master sample1/master
git branch sample2_master sample2/master
@Orlandster
Orlandster / gist:c1cf4975e4c7f766905b4d1bab5382b8
Created May 3, 2018 09:17
Git: Merge with other repository
cd path/to/project-b
git remote add project-a path/to/project-a
git fetch project-a
git merge --allow-unrelated-histories project-a/master # or whichever branch you want to merge
git remote remove project-a
@Orlandster
Orlandster / snippet.js
Last active February 23, 2018 19:35
requestAnimationFrame - Snippets
// smooth to top scroll
(function smoothscroll(){
var currentScroll = document.documentElement.scrollTop || document.body.scrollTop;
if (currentScroll > 0) {
window.requestAnimationFrame(smoothscroll);
window.scrollTo (0,currentScroll - (currentScroll/5));
}
})();
// scroll event
/* text */
'my-field-1' => array(
'type' => 'text',
'label' => __( 'Text Field 1', 'fl-builder' ),
),
/* textarea */
'my_textarea_field' => array(
'type' => 'textarea',
@Orlandster
Orlandster / gist:4e2cf44829d9a413530b42782c0cdd17
Last active September 27, 2018 08:58
jQuery: scroll to top
(function ($) {
// display button after 60px scrolled
const showAtOffset = 60;
const $backToTop = $('.scroll-top-wrapper');
// Show and hide the Button
$(document).on( 'scroll', function(){
($(window).scrollTop() > showAtOffset) ? $backToTop.addClass('show'): $backToTop.removeClass('show');
});