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
interface Person { | |
name: string; | |
age: number; | |
} | |
function makeObject(name: string, age: number): Person { | |
return { name, age }; | |
} | |
const personObject: Person = makeObject('John', 25); |
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 bluebird = require('bluebird'); | |
function echo(text, callback) { | |
callback(null, text); | |
} | |
const echoPromise = bluebird.promisify(echo); | |
echo('Hello', (err, result) => { | |
console.log(`From callback: ${result}`); |
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 bluebird = require('bluebird'); | |
bluebird.delay(1000, 'done 1000').then((result) => { | |
console.log(result); | |
}); | |
bluebird.delay(1000, 'done 2000').then((result) => { | |
console.log(result); | |
}); |
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 bluebird = require('bluebird'); | |
async function task(data, ms = 500) { | |
console.log(data); | |
await bluebird.delay(ms); | |
return data; | |
} | |
bluebird.each(['A', 'B', 'C', 'D', 'E', 'F'], async (item) => { | |
return task(item); |
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 bluebird = require('bluebird'); | |
async function task(data, ms = 500) { | |
console.log(data); | |
await bluebird.delay(ms); | |
return data; | |
} | |
bluebird.map(['A', 'B', 'C', 'D', 'E', 'F'], async (item) => { | |
return task(item); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Test my meta tags</title> | |
<meta property="og:image" content="https://author.am/lee.jpeg"/> | |
<meta property="og:title" content="Bruce Lee"/> | |
<meta property="og:description" content="Lee Jun-fan known professionally as Bruce Lee , was a Hong Kong and American actor, film director, martial artist"/> | |
<meta property="og:url" content="https://author.am/test.html"/> | |
<meta property="og:site_name" content="Bruce Lee Blog"/> |
NewerOlder