// In Chrome console javascript: googletag.openConsole()
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
split -b 3m Wireframes.fig Wireframes.fig |
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
// example findNextPageBreak(startElement, "page-class") | |
function findNextPageBreak(startElement, classElement) { | |
let currentElement = startElement; | |
while (currentElement) { | |
if (currentElement.nextElementSibling && currentElement.nextElementSibling.classList.contains(classElement)) { | |
return currentElement.nextElementSibling; | |
} | |
currentElement = currentElement.nextElementSibling || currentElement.parentNode; | |
if (currentElement.tagName === 'BODY') { |
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
// Data validation and input sanitization. | |
// Logging and debugging to track object interactions. | |
// Implementing access control and security checks. | |
// Creating virtual objects or interfaces. | |
// Implementing lazy loading for properties or data. | |
// Implementing change detection and reactivity (e.g., for UI frameworks). | |
// Caching expensive operations or results. | |
// Implementing object persistence and serialization. | |
// Implementing version control for objects or data. | |
// Intercepting method calls and customizing behavior. |
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 isElementVisible(elem) { | |
const rect = elem.getBoundingClientRect(); | |
return ( | |
rect.top >= 0 && | |
rect.left >= 0 && | |
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && | |
rect.right <= (window.innerWidth || document.documentElement.clientWidth) | |
); | |
} |
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
**Upload a file to a remote server:** | |
```sh | |
scp /path/to/local/file username@remotehost:/path/to/remote/directory | |
``` |
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
fetch('https://sttcdn.site.com/').then(response=>{ | |
const country = response.headers.get('x-user-country'); | |
const countryCodes = ['US', 'CA', 'JP', 'AU', 'SG', 'KR', 'TH', 'MY', 'NZ', 'BR', 'MX'] | |
if (country && country.length === 2 && countryCodes.includes(country)) { | |
// Country in list | |
} else { | |
// Country not in list or no country value | |
} | |
} | |
).catch(error=>{ |
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
// If URL not finished on "/" - to add this "/" at the end without reload | |
if (window.location.href.charAt(window.location.href.length - 1) !== "/") { | |
window.history.replaceState({}, document.title, window.location.href + "/"); | |
} |
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 observer = new IntersectionObserver(handleIntersection, { threshold: 0 }); | |
function handleIntersection(entries, observer) { | |
entries.forEach(entry => { | |
if (entry.isIntersecting) { | |
entry.target.style.backgroundColor = "#e74c3c"; | |
} else { | |
entry.target.style.backgroundColor = "#3498db"; | |
} | |
}); |
For SSH agent forwarding in Termux, you can try the following steps:
Start the SSH agent by running: eval $(ssh-agent)
Add your SSH private key to the agent using: ssh-add /path/to/your/private_key
Check if your SSH agent is running and has your key by using: ssh-add -l
If you encounter the passphrase prompt, enter your passphrase to add the key to the agent.
NewerOlder