Skip to content

Instantly share code, notes, and snippets.

View jgcarlson's full-sized avatar
Probably drinking coffee.

Jonathan Carlson jgcarlson

Probably drinking coffee.
View GitHub Profile
@jgcarlson
jgcarlson / install-zsh-windows-git-bash.md
Created September 23, 2021 08:59 — forked from fworks/install-zsh-windows-git-bash.md
Zsh / Oh-my-zsh on Windows Git Bash
@jgcarlson
jgcarlson / product_min.liquid
Created November 6, 2019 18:44
Shopify - Minimum Product Quantity
<!-- From https://community.shopify.com/c/Shopify-Discussion/How-to-set-up-minimum-order-quantities-for-each-product/td-p/99243 -->
{% assign show_checkout_button = true %}
{% for item in cart.items %}
{% if item.product.tags contains 'SampleTag' and item.quantity <= 49 %}
{% assign show_checkout_button = false %}
<p>You will need to purchase more than 50 of the product "{{ item.product.title }}"</p>
{% endif %}
{% endfor %}
{% if show_checkout_button %}
<!-- show checkout button -->
@jgcarlson
jgcarlson / cpu-intensive.js
Created November 4, 2019 20:01 — forked from sorenlouv/cpu-intensive.js
A CPU intensive operation. Use to test imitate blocking code, test WebWorkers etc.
function mySlowFunction(baseNumber) {
console.time('mySlowFunction');
let result = 0;
for (var i = Math.pow(baseNumber, 7); i >= 0; i--) {
result += Math.atan(i) * Math.tan(i);
};
console.timeEnd('mySlowFunction');
}
mySlowFunction(8); // higher number => more iterations => slower
@jgcarlson
jgcarlson / gist:79097f42159321eb29f20c1b04a97626
Created October 3, 2019 01:08
Split, faux-container layout with CSS Grid and Flexbox
https://hankchizljaw.com/wrote/create-a-split-faux-container-layout-with-css-grid-and-flexbox/
@jgcarlson
jgcarlson / reset.css
Created October 3, 2019 01:05
Modern, Minimal CSS Reset
/* Thanks to Andy Bell (https://hankchizljaw.com/wrote/a-modern-css-reset/) */
/* Box sizing rules */
*,
*::before,
*::after {
box-sizing: border-box;
}
/* Remove default padding */
@jgcarlson
jgcarlson / base64
Created July 30, 2019 17:50
Single Pixel Base64 PNG
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVQYV2P4DwABAQEAWk1v8QAAAABJRU5ErkJggg==
@jgcarlson
jgcarlson / .vimrc
Created May 8, 2019 20:41
Vim Settings
" Make Vim more useful
set nocompatible
" Use the OS clipboard by default (on versions compiled with `+clipboard`)
set clipboard=unnamed
" Enhance command-line completion
set wildmenu
" Allow cursor keys in insert mode
set esckeys
" Allow backspace in insert mode
set backspace=indent,eol,start
@jgcarlson
jgcarlson / _variables.scss
Created March 14, 2019 16:14
SCSS Media Queries
/* MEDIA QUERIES */
$breakpoints: ( xs: 576px, sm: 768px, md: 992px, lg: 1200px);
$bp-xs: map-get($breakpoints, xs); // < 576px
$bp-sm: map-get($breakpoints, sm); // < 768px
$bp-md: map-get($breakpoints, md); // < 992px
$bp-lg: map-get($breakpoints, lg); // < 1200px
$bp-xl: map-get($breakpoints, xl); // > 1200px
// from 0 -> 575px
@mixin mobile() {
@jgcarlson
jgcarlson / .editorconfig
Last active February 28, 2019 18:00
.editorconfig
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
@jgcarlson
jgcarlson / title-style.css
Created January 22, 2019 15:37
Title Border Style
// From https://codepen.io/trys/pen/vjRzPa
h2 {
display: grid;
width: 100%;
align-items: center;
text-align: center;
grid-template-columns: minmax(20px, 1fr) auto minmax(20px, 1fr);
grid-gap: 20px;
}