Skip to content

Instantly share code, notes, and snippets.

body {
background: rgb(204, 204, 204);
font-family: 'Droid Serif', sans-serif;
margin: 0;
}
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
opacity: 1;
}
.details {
const scrollTop = () => {
const scrollPos = document.documentElement.scrollTop || document.body.scrollTop;
if (scrollPos > 0) {
window.requestAnimationFrame(scrollTop);
window.scrollTo(0, scrollPos - scrollPos / 8);
}
};
// How2use?
scrollToTop();
// Take a pics.
const findImages = (el, withDuplicates = false) => {
const images = [...el.getElementsByTagName('img')].map(img => img.getAttribute('src'));
return withDuplicates ? images : [...new Set(images)];
};
// Examples
findImages(document); // ['image1.jpg', 'image2.png']
findImages(document, true); // ['image1.jpg', 'image1.png']
// Detect device
const detectDeviceType = () =>
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
? 'mobile'
: 'desktop';
// How2use?
detectDeviceType();
const foo = 'name'
const videos = [...document.querySelectorAll('.label.style-scope.ytcp-thumbnail')];
const pattern = /[0-9]:../gi
const time = videos.map(item => item.textContent.match(pattern)[0]);
const pageTime = time.reduce((acc, curr) => acc += curr.split(':').reduce((acc,time) => (60 * acc) + +time), 0);
console.log(`Total time on page ${pageTime} seconds`);
function christmas(x) {
if(x < 3) {
return "";
}
let tree = "";
for(let i = 1; i <= x; i++) {
for(let j = 1; j <= x + x - 1; j++) {
if(j <= x - i || j >= x + i) {
tree += " ";
} else {
codesign --remove-signature /Applications/Visual\ Studio\ Code.app/Contents/Frameworks/Code\ Helper\ \(Renderer\).app
<div class="creative">
<!-- column-left -->
<div class="column-left">
<div class="copy">
<div class="moveable"><div class="text-first">{{ copy1 }}</div></div>
<div class="moveable">
<div class="text-second"><span class="line-wrapper">{{ copy2 }}</span></div>
</div>
</div>
</div>
set JSSnippet to "snippet"
tell application "Keyboard Maestro Engine"
set JSSnippet to getvariable "snippet"
end tell
tell application "Arc"
set JSResult to execute front window's active tab javascript JSSnippet
end tell