Skip to content

Instantly share code, notes, and snippets.

Avatar
🇨🇦

Benjamin Sehl benjaminsehl

🇨🇦
View GitHub Profile
@benjaminsehl
benjaminsehl / formatters.js
Created Aug 19, 2020
Typography Formatting Function
View formatters.js
const formatters = [
{ pattern: /'/g, replacement: '’' }, // Replace straight quotes with smart quotes
// { pattern: /\s([^\s<]+)\s*$/g, replacement: '\u00A0$1' }, // Add non breaking spaces before the last word
]
const formatted = (a) =>
formatters.reduce(
(a, f) => a?.toString().replace(f.pattern, f.replacement),
a,
)
@benjaminsehl
benjaminsehl / scripts
Last active Aug 6, 2020
Zsh alias to print the scripts from a package.json file
View scripts
alias scripts="pcregrep -M '(?<=scripts\":\s)(.|\n)*?(?=\n\s*},)' package.json"
@benjaminsehl
benjaminsehl / handleize.js
Created Apr 22, 2020
Turn a string into a slug
View handleize.js
export function handleize (str) {
return str
.toLowerCase()
.replace(/[^\w\u00C0-\u024f]+/g, '-')
.replace(/^-+|-+$/g, '')
}
@benjaminsehl
benjaminsehl / adopt.js
Last active Mar 20, 2020
An ES6 function for fixing Orphans
View adopt.js
export function adopt(str) {
return str.replace(/\s([^\s<]+)\s*$/g, '\u00A0$1');
}
@benjaminsehl
benjaminsehl / cloudSettings
Last active Aug 28, 2020
VS Code Settings
View cloudSettings
{"lastUpload":"2020-08-28T21:31:48.308Z","extensionVersion":"v3.4.3"}
View original-orders.js
const shopifyStores = [
{name: 'Canada Web', tablePrefix: 'ca_ecomm'},
{name: 'Canada Retail', tablePrefix: 'ca_retail'},
{name: 'Intl. Web', tablePrefix: 'us_ecomm'},
{name: 'Intl. Retail', tablePrefix: 'us_retail'}
];
let KotnEmailsArray = [
"kotn",
"ordinarysupply",
@benjaminsehl
benjaminsehl / shopify-cleanslate.css
Last active Jun 22, 2020
Shopify Dynamic Checkout Buttons
View shopify-cleanslate.css
/*
Shopify Dynamic Checkout Buttons on Cart Page
Examples of where broken:
https://homesick.com/cart
https://ca.kotn.com/cart
On Safari it breaks and wraps (see screenshot), in Chrome, since there are just two active, the buttons don’t take up the full space.
@benjaminsehl
benjaminsehl / .eslintrc
Created Aug 14, 2019 — forked from cletusw/.eslintrc
My default ESLint configs
View .eslintrc
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
View Blur on Scroll + Simple Parallax.markdown
You can’t perform that action at this time.