View compile_sagepay_templates.sh
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
#!/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' |
View sagepay.sh
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
#!/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 findAnchorURLs.js
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 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 waitThenDo.js
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
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 webComponentStyleAddition.js
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
// target is a web component with an open ShadowDOM | |
const target = document.querySelector(...) | |
target.shadowRoot.styleSheets[0].insertRule(` | |
selector { | |
padding: 8px; | |
} | |
`) |
View pixel-anchor-observer.js
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
// 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 gist:40afcf8b0a68e22bbc9bbf3df60d5dd7
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
"remove-443": "sed -i '' 's/.net:443/.net/g' package-lock.json" |
View customElementDedupe.ts
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
export function customElementDedupe(): void { | |
const define: Function = window.customElements.define.bind(window.customElements); | |
window.customElements.define = ( | |
name: string, | |
constructor: Function, | |
options: object, | |
): void => { | |
if (!window.customElements.get(name)) define(name, constructor, options); | |
}; | |
} |
View ffmpeg example
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
# With a specific codec | |
-i input | |
-codec:v video codec to use, most modern is libx265 | |
# libx265 is slower but provides a smaller file size output, by default is usually | |
# libx264 which is the most compatible, faster than x265 but with a bigger file output | |
$ ffmpeg -i video.mov -codec:v libx265 video.mp4 | |
# Simplest version |