View gist:40afcf8b0a68e22bbc9bbf3df60d5dd7
"remove-443": "sed -i '' 's/.net:443/.net/g' package-lock.json" |
View pixel-anchor-observer.js
// Res.: https://css-tricks.com/styling-based-on-scroll-position/ | |
let anchor = document.getElementById('pixel-anchor') | |
if (!anchor) { | |
const interval = window.setInterval(() => { | |
anchor = document.getElementById('pixel-anchor') | |
if (anchor) { | |
window.clearInterval(interval) | |
createObserver(anchor) |
View webComponentStyleAddition.js
// target is a web component with an open ShadowDOM | |
const target = document.querySelector(...) | |
target.shadowRoot.styleSheets[0].insertRule(` | |
selector { | |
padding: 8px; | |
} | |
`) |
View waitThenDo.js
const interval = window.setInterval(() => { | |
// Search target element | |
const target = document.querySelector(...) | |
if (target) { | |
window.clearInterval(interval) | |
// Do something with target element | |
target.innerText = 'Meow' | |
} | |
}, 100) |
View findAnchorURLs.js
function recursiveFindAnchors(node) { | |
if (!node) return [] | |
// Find anchors URLs | |
const bareAnchorURLs = [...node.querySelectorAll('a')].map(anchor => formatHref(anchor.href)) | |
// Find all shadow roots | |
const allShadowRoots = [...node.querySelectorAll('*')].filter(node => node.shadowRoot).map(node => node.shadowRoot) | |
// No web components in here |
View sagepay.sh
#!/usr/bin/env bash | |
# Sagepay templates script file | |
# Function to show help with the use of this script | |
help() | |
{ | |
echo "compile Compiles XML/XSLT to HTML" | |
echo "bundle Create bundle to send to Sagepay" | |
echo "help Show this help" | |
echo "" |
View compile_sagepay_templates.sh
#!/usr/bin/env bash | |
# This file is a excerpt of a bigger script | |
# Files lists, they should be matching | |
xml_list=( | |
'authorisation' | |
'card_authentication' | |
'card_details' | |
'error' |