This file contains hidden or 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
export function getUserFromToken(token): ITokenUser { | |
const cert = readFileSync(join(__dirname, "../../keys/public.pem")); | |
if (token) { | |
const decoded = jwt.verify(token, cert, { algorithms: ["RS256"] }); | |
return decoded["user"] as ITokenUser; | |
} | |
return null; | |
} |
This file contains hidden or 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
<template> | |
<div class="o-data-placeholder text-center" :class="{ '--center': center }"> | |
<div> | |
<div class="__content"> | |
<v-icon :size="191 * scale" color="primary">{{ icon }}</v-icon> | |
<h1 class="primary--text" :style="{ fontSize: `${34 * scale}px` }"> | |
<slot></slot> | |
</h1> | |
</div> |
This file contains hidden or 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 low from "lowdb"; | |
import LocalStorage from "lowdb/adapters/LocalStorage"; | |
const adapter = new LocalStorage("app-settings"); | |
const storage = low(adapter); | |
storage | |
.defaultsDeep({ | |
session: { |
This file contains hidden or 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 "winston-daily-rotate-file"; | |
import { join } from "path"; | |
import { createLogger, format, transports } from "winston"; | |
const serverFormat = format.printf(info => { | |
return `${info.timestamp} [${info.label}] ${info.level}: ${info.message}`; | |
}); | |
function createCustomLogger(label: string, level: string) { |
This file contains hidden or 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
export default function sleep(ms: number): Promise<void> { | |
return new Promise(resolve => { | |
setTimeout(resolve, ms); | |
}); | |
} |
This file contains hidden or 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
<template> | |
<!-- Slider main container --> | |
<div | |
class="ok-swiper" | |
:class="{ | |
'--fill-height': fillHeight, | |
'--pagination': pagination, | |
'--navigation': navigation, | |
'--navigation-ex': navigationEx | |
}" |
This file contains hidden or 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
function propertyAccess(object, key) { | |
if (isFunction(object[key])) return object[key](); | |
if (object[key] instanceof Date) return object[key].toISOString(); | |
if (key in object) return object[key]; | |
const conn = getConnection(); | |
if (conn.hasMetadata(object.constructor.name)) { |
This file contains hidden or 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 MarkdownIt from "markdown-it"; | |
const markdown = new MarkdownIt({ | |
breaks: true, | |
xhtmlOut: true | |
}); | |
export default { | |
install(Vue) { | |
Vue.filter("markdown", function(text) { |
This file contains hidden or 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
<template> | |
<v-snackbar | |
:timeout="4000" | |
left | |
bottom | |
:value="!empty" | |
@input="pop" | |
:color="current.type" | |
light | |
> |
This file contains hidden or 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 currency from "currency.js"; | |
function formatCurrency(value, formatWithSymbol = true) { | |
return currency(value, { | |
symbol: "DA", | |
pattern: "# !", | |
formatWithSymbol, | |
separator: " ", | |
decimal: ",", | |
precision: 0, |