Skip to content

Instantly share code, notes, and snippets.

View jhanstra's full-sized avatar
🏔️

Jared Hanstra jhanstra

🏔️
View GitHub Profile
<!DOCTYPE html><html lang="en" dir="ltr"><head><script>(function(){function k(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}};(function(a){a.dradispt={e:[],s:{},v:{}};var b=a.dradispt,e=b.s,g=b.v;if("PerformanceObserver"in a){g.fh="hidden"===a.document.visibilityState?0:Infinity;if(0!==g.fh)try{a.document.addEventListener("visibilitychange",function d(f){"hidden"===a.document.visibilityState&&(g.fh=Math.min(g.fh,null!=f.timeStamp&&0<=f.timeStamp?f.timeStamp:Infinity),a.document.removeEventListener("visibilitychange",d,!0))},!0)}catch(c){setTimeout(function(){throw c;},0)}try{var l=b.e;"PerformanceLongTaskTiming"in a&&(e.l=
1);"PerformanceNavigationTiming"in a&&(e.n=1);"PerformancePaintTiming"in a&&(e.p=1);var h=new a.PerformanceObserver(function(c){a.__tti=[];var f=a.__tti;c=c.getEntries();var d="undefined"!=typeof Symbol&&Symbol.iterator&&c[Symbol.iterator];c=d?d.call(c):{next:k(c)};for(d=c.next();!d.done;d=c.next())d=d.value,l.push(d),"longtask"===d.entryType&&f.push(d)});
<script>(function(w,l,c){w[l]=w[l]||[];w[l].push({'locale':c});})(window,'dataLayer','en_US');</script><noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-M9QWHN" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><script id="gtmscript" src="//www.googletagmanager.com/gtm.js?id=GTM-M9QWHN" async></script><script>(function(w,l){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});})(window, 'dataLayer');</script></div><input type="hidden" id="data-tn-dummy-time" data-tn-section="dradis-time" data-tn-element="-dradis-time" /><div id="sec-account-modal_wrapper" class="fixed_overlay modal_wrapper" role="dialog" tabindex="-1"><table id="sec-account-modal_table" data-tn-section="sec-account-modal" class="modal_table" role="presentation"><tr class="modal_row"><td class="modal_col" data-tn-action-click data-tn-element="sec-account-modal_grey_background"><div id="sec-account-modal_box" class="modal_box modal_border" role="dialog" tabindex="-1"aria-labell
<script type="text/javascript">window.indeedPluginInitializers = [];</script><script type="text/javascript" src="//t.qa.indeed.net/s/6b964c2/turnstile-compiled.js"></script><script type="text/javascript" src="//t.qa.indeed.net/s/ddc6ebd/heatmap-compiled.js"></script><title>Employers | Indeed.com</title><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><meta name="robots" content="noindex" /><link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin /><link href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet" /><link rel="stylesheet" type="text/css" href="https://d3l2aiuysuvlk2.cloudfront.net/j/s/d533b89/lean-styles-compiled.css" media="all" /><link rel="stylesheet" type="text/css" href="https://d3l2aiuysuvlk2.cloudfront.net/j/s/a7cd6ad/jobs-management-react-internalplugin-compiled.css" media="all" /><link rel="stylesheet" type="text/css" href="https://d3l2aiuysuvlk2.cloudfront.net/j/s/8c0dae2/lean-jobs-styles-comp
@jhanstra
jhanstra / gist:889db59e1ab14b07241223b587320969
Created January 18, 2020 23:25
NVM script from Brian Han + Indeed Stuff
# From Brian Han. Should use the node version specified in an .nvmrc file in a project.
# place this after nvm initialization!
autoload -U add-zsh-hook
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
@jhanstra
jhanstra / gist:dffddf02df0a9088c7c03a9044d9687f
Created July 25, 2019 03:33
attempt #1 at testing hooks
import { useApiData } from '../index';
// import CandidateInterviewScheduler from '../../components/CandidateInterviewScheduler';
// import React from 'react';
// import { render, cleanup, waitForElement } from '@testing-library/react';
// describe('API integration', () => {
// afterEach(cleanup);
// it('loads interview data based on applicationId and interviewId', async () => {
// const applicationId = '01014aeb3e7ed57f8d274ddd75e280e9be239c45e3';
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
{% assign klaviyo_code = settings.klaviyo_newsletter_code %}
<div class="waitdontgo position-foreground" style="display:none;">
<div class="overlay"></div>
<div class="popup">
<div class="step one">
<div class="layer">
{% include 'popup-step-1' %}
</div>
</div>
<!--
This file contains the HTML, scripts, and styles for an unobtrusive exit-intent newsletter pop-up for Velour Lashes.
Instructions:
1. Place the contents of this file on the page(s) you'd like the pop-up to show on. If there is a base theme file for the store, it will likely go there. Place at the bottom of the page inside the <body> tag.
2. Test thoroughly. I tried to make this work for any environment, but there may be issues I couldn't test for. I worked with Helvetica rather than Proxima Nova, so some of the styles may need to be adjusted.
3. Before publishing, remove the 'aggressive: true' line from the desktop trigger on line 263. This will allow the cookie to set on desktop.
-->
<div class="exit-intent position-foreground" style="display:none;">

Automatic Discounts

Goal: Be able to add ?discount=yourDiscountCode to any shop url and have that discount added to checkout automatically.

How it works

This code uses regex to parse the url and extract the urlParams into an object. It then uses local storage to store the discount code until the user reaches the cart page, then adds it to the cart form action.

If the user loads a new url with a different discount code, the new code will replace the old one. This allows stringing queries, so for example http://yourstore.com?someOtherQuery=thisValue&discount=yourDiscount will still add yourDiscount.

I chose to use localStorage rather than sessionStorage, so that if the user accidentally closes the tab and reopens it, they will still have their discount kept and applied. The localStorage discount is removed after two hours of non-use.