Skip to content

Instantly share code, notes, and snippets.

View Janoyan's full-sized avatar

Meruzh Janoyan

View GitHub Profile
<!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"/>
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);
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');
bluebird.delay(1000, 'done 1000').then((result) => {
console.log(result);
});
bluebird.delay(1000, 'done 2000').then((result) => {
console.log(result);
});
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}`);
interface Person {
name: string;
age: number;
}
function makeObject(name: string, age: number): Person {
return { name, age };
}
const personObject: Person = makeObject('John', 25);
import { ErrorData } from './ErrorData';
abstract class BaseError extends Error {
code: number;
slug: string;
constructor(code: number, message: string, slug: string) {
super(message);
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 {
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,
mappings=()
while IFS= read -r line; do
mappings+=("$line")
done < mappings.txt
for value in "${mappings[@]}" ; do
prefix=${value#*=};
env_path=${value%=*};
rm -f "$env_path" && for l in $(printenv | grep ^"$prefix"); do echo ${l#$prefix} >> "$env_path"; done
done