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
// log the `rnd` result in the console using all three async techniques. | |
// You can only call console.log inside the `main` function. | |
const randomNumber = () => { | |
return Math.random(); | |
} | |
// 1. Make it wait for 1 sec. with `setTimeout` and log it on main function | |
const timeoutRandomNumber = (func, cb) => { | |
return setTimeout(() => func(), 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
https://graph.facebook.com/{facebookId}/picture?type=large&width=720&height=720 | |
source: https://developers.facebook.com/docs/graph-api/reference/user/picture/ |
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 promisify = (fn) => (...args) => new Promise((resolve, reject) => { | |
fn.apply(insight, [...args, (err, ...args) => { | |
if (err) return reject(err); | |
resolve.apply(this, args); | |
}]); | |
}); | |
// example: | |
// insight.getUnspentUtxosPromise = promisify(insight.getUnspentUtxos); |
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
// Go to a profile, open javascript console (cmd + alt + j) and paste the following code | |
// or you can save it in handy snippet https://developers.google.com/web/tools/chrome-devtools/javascript/snippets | |
// Update this selectors as LinkedIn's layout is updated | |
const endorseBtnSelector = '.pv-skill-entity__featured-endorse-button-shared'; | |
const openSkillsSectionBtnSelector = '.pv-skills-section__additional-skills'; | |
const body = document.body, | |
html = document.documentElement; |
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
Imagination is the key to painting. If you don't think every day is a good day - try missing a few. You'll see. And just raise cain. Any little thing can be your friend if you let it be. | |
This present moment is perfect simply due to the fact you're experiencing it. And that's when it becomes fun - you don't have to spend your time thinking about what's happening - you just let it happen. That's the way I look when I get home late; black and blue. | |
I'm gonna start with a little Alizarin crimson and a touch of Prussian blue Just make little strokes like that. You are only limited by your imagination. Very easy to work these to death. Get away from those little Christmas tree things we used to make in school. | |
If you hypnotize it, it will go away. Put light against light - you have nothing. Put dark against dark - you have nothing. It's the contrast of light and dark that each give the other one meaning. Now we don't want him to get lonely, so we'll give him a little friend. Trees get lonely too, so we'll give h |
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
async function printFiles () { | |
const files = await getFilePaths(); | |
await Promise.all(files.map(async (file) => { | |
const contents = await fs.readFile(file, 'utf8') | |
console.log(contents) | |
})); | |
} | |
/// koa 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
// If you wanted to get between 1 and 6, you would calculate: | |
Math.floor(Math.random() * 6) + 1 | |
// 1 is the start number | |
// 6 is the number of possible results (1 + start (6) - end (1)) |
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 sliceExtra = (str, limit) => str.length < limit ? str : str.slice(0, limit) + '...' |
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
// To push branch 'deploy' | |
git push heroku deploy:master |
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
document.addEventListener ("keydown", function (e) { | |
if (e.ctrlKey && e.key === "1") { | |
alert('pressed ctrl + 1') | |
} | |
} ); |
OlderNewer