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
useEffect(() => { | |
let isSubscribed = true; | |
// declare the async data fetching function | |
const fetchData = async () => { | |
// get the data from the api | |
const data = await fetch(`https://yourapi.com?param=${param}`); | |
// convert the data to json | |
const json = await response.json(); |
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 default connect ( | |
({planeteers}) => console.log(planeteers) || ({capPlanet: planeteers.captain}) | |
) |
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
// Returns a function, that, as long as it continues to be invoked, will not | |
// be triggered. The function will be called after it stops being called for | |
// N milliseconds. If `immediate` is passed, trigger the function on the | |
// leading edge, instead of the trailing. | |
function debounce(func, wait, immediate) { | |
var timeout; | |
return function() { | |
var context = this, args = arguments; | |
var later = function() { | |
timeout = null; |
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() { | |
console.log('loaded!'); | |
var triggerBttn = document.getElementById( 'trigger-overlay' ), | |
overlay = document.querySelector( 'div.overlay' ), | |
closeBttn = overlay.querySelector( 'button.overlay-close' ); | |
transEndEventNames = { | |
'WebkitTransition': 'webkitTransitionEnd', | |
'MozTransition': 'transitionend', | |
'OTransition': 'oTransitionEnd', |
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 isPalindrome(text) { | |
if (text.length <= 1) return true; | |
if (text.charAt(0) != text.charAt(text.length - 1)) return false; | |
return isPalindrome(text.substr(1, text.length - 2)); | |
} |
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
var cycle = setInterval(function() { | |
if(condition) { | |
clearInterval(cycle); | |
}else{ | |
// do something | |
} | |
}, 1000); |
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
wget --limit-rate=600k --no-clobber --convert-links --random-wait -r -p -E -e robots=off -U mozilla https://www.the-site-to-hack.com/ |