Skip to content

Instantly share code, notes, and snippets.

@jbasoo
jbasoo / svg-to.liquid.sh
Last active December 7, 2023 12:10
Convert SVG files to a Shopify Liquid Snippet
#!/bin/bash
# USAGE: svg-to-liquid.sh iconSourcePath icons.liquid
# Add the icons.liquid file to your theme snippets then output the icon using {% render 'icons', icon: 'icon-name' %}
echo "Converting SVGs to Shopify Liquid Snippet"
liquid=$'{% case icon %}\n';
for svg in $1/*.svg; do
file="$(basename $svg)";
@jbasoo
jbasoo / m2-widget-refresh.sh
Created July 24, 2020 11:08
Magento 2 Widget cache refresh
while sleep 10;
do for f in $(find $1 -print | grep -i global__widget_config);
do
rm $f;
echo $(date +'%T') Deleted $f;
done;
done;
@jbasoo
jbasoo / style.css
Last active February 12, 2018 18:00
Cap Web CSS
*, *:before, *:after {
box-sizing: border-box;
}
html {
width: 100%;
height: 100%;
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu;
color: white;
background-color: hsl(210, 27%, 13%);
@jbasoo
jbasoo / m2less.cson
Created June 5, 2017 12:50
Magento 2 Less file Atom scaffold snippet
'.less':
'm2less':
'prefix': 'm2less'
'body': """
/**
* _$1.less
*/
/* ==========================================================================
$1
@jbasoo
jbasoo / Gruntfile.js
Last active August 29, 2015 14:13
Convert Sass breakpoints to JS
// Convert
// $window_s: 768px;
// $window_m: 960px;
// $window_l: 1200px;
// to
// window.window_s = 768;
// window.window_m = 960;
// window.window_l = 1200;
replace: {
@jbasoo
jbasoo / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jbasoo
jbasoo / rAF.js
Last active August 29, 2015 14:03 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@jbasoo
jbasoo / vtSmoothScroll.js
Last active August 29, 2015 14:02
Variable time smooth scroll
/**
*
* In real life your time taken to complete a journey = distance/speed.
* This emulates that, longer journeys actually take more time, shorter journeys take less time.
*
* Forked from http://css-tricks.com/snippets/jquery/smooth-scrolling/
* Demo http://codepen.io/jbasoo/pen/LEovc
*
* Requires jQuery and jQuery Easing
*