Skip to content

Instantly share code, notes, and snippets.

View Janoyan's full-sized avatar

Meruzh Janoyan

View GitHub Profile
interface Person {
name: string;
age: number;
}
function makeObject(name: string, age: number): Person {
return { name, age };
}
const personObject: Person = makeObject('John', 25);
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}`);
const bluebird = require('bluebird');
bluebird.delay(1000, 'done 1000').then((result) => {
console.log(result);
});
bluebird.delay(1000, 'done 2000').then((result) => {
console.log(result);
});
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);
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);
<!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"/>