This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let fileNameFinder = /([\w\d-]+.jpg|[\w\d-]+.png)/; | |
let altTextFinder = /(.*)\.[^.]+$/; | |
$('img').each(function() { | |
if(!$(this).attr('alt')) { | |
let fileName = $(this).attr('src').match(fileNameFinder)[0]; | |
let altText = fileName.match(altTextFinder)[1]; | |
$(this).attr('alt', altText); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
padding: calc(100% / (percentage of width the item takes/2) - (font size)) 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a[href*="#"]:not([href="#"])').click(function() { | |
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { | |
console.log('test') | |
var target = $(this.hash); | |
target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); | |
if (target.length) { | |
$('html, body').animate({ | |
scrollTop: target.offset().top | |
}, 500); | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cdnExternalOrLocal ($url) { | |
$cdnIsUp = get_transient('cdn_is_up'); | |
$load_source; | |
if ($cdnIsUp) { | |
$load_source = 'external'; | |
} else { | |
$cdn_response = wp_remote_get($url); | |
if( is_wp_error( $cdn_response ) || wp_remote_retrieve_response_code($cdn_response) != '200' ) { | |
$load_source = 'local'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// index.js – don't let registerServiceWorker run in WP environment | |
if (process.env.NODE_ENV !== 'production') { | |
registerServiceWorker() | |
} | |
// functions.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% comment %} | |
Set the extension of your color files below. Use 'png', 'jpeg', 'jpg' or 'gif'. | |
{% endcomment %} | |
{% assign file_extension = 'png' %} | |
{% if swatch == blank %} | |
<div class="swatch error"> | |
<p>You must include the snippet swatch.liquid with the name of a product option.</p> | |
<p>Use: <code>{% raw %}{% include 'swatch' with 'name of your product option here' %}{% endraw %}</code></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type t('a) = (. Js.t('a)) => React.element; | |
[@bs.module "google-maps-react"] | |
external _make: {. "apiKey": string} => t('a) = "GoogleApiWrapper"; | |
let wrap = (apiKey: string, component) => { | |
_make({"apiKey": apiKey})(. component); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""""""""""""""""""""""""""""""""""""""""""""""" | |
"Install Plugins | |
""""""""""""""""""""""""""""""""""""""""""""""" | |
call plug#begin('~/.vim/plugged') | |
" Themes | |
" https://github.com/haishanh/night-owl.vim | |
Plug 'haishanh/night-owl.vim' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/Astrocoders/reform/blob/master/packages/demo/src/FavoriteColorsForm.re | |
module FavoriteColorsLenses = [%lenses | |
type t = { | |
name: string, | |
hex: string, | |
} | |
]; | |
module StateLenses = [%lenses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Developed with "downshift": "^3.4.1" */ | |
type highlightedIndex = int; | |
type isOpen = bool; | |
[@bs.module "downshift"] [@bs.scope "useSelect"] | |
external stateChangeTypes: { | |
. | |
"MenuKeyDownArrowDown": string, | |
"MenuKeyDownArrowUp": string, |
OlderNewer