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"/> |
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
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'); | |
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'); | |
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
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
import { ErrorData } from './ErrorData'; | |
abstract class BaseError extends Error { | |
code: number; | |
slug: string; | |
constructor(code: number, message: string, slug: string) { | |
super(message); |
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
import BaseError from './BaseError'; | |
import { ErrorData } from './ErrorData'; | |
export class NotFoundError extends BaseError { | |
constructor(message: string = 'Not found', slug: string = 'not-found') { | |
super(404, message, slug); | |
} | |
getErrorData(): ErrorData { | |
return { |
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
import { NextFunction, Request, Response } from 'express'; | |
import BaseError from './BaseError'; | |
import InternalServerError from './InternalServerError'; | |
const errorHandler = ( | |
error: any, | |
req: Request, | |
res: Response, | |
// eslint-disable-next-line @typescript-eslint/no-unused-vars | |
next: NextFunction, |
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
version: 2 | |
jobs: | |
deploy: | |
steps: | |
- checkout | |
- add_ssh_keys: | |
fingerprints: | |
- "c1:37:bf:df:a7:a1:04:7c:be:d1:46:83:9a:bf:76:73" | |
- run: | |
name: Add to known_hosts |
OlderNewer