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: | |
public interface ILogger { | |
public static void error(String msg, Object obj) { | |
System.out.println(msg + " " + obj.toString()); | |
} | |
public static void warning(String msg, Object obj) { | |
System.out.println(msg + " " + obj.toString()); | |
} | |
public static void info(String msg, Object obj) { |
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: | |
public interface ILogger { | |
public static void error(String msg, Object obj) { | |
System.out.println(msg + " " + obj.toString()); | |
} | |
public static void warning(String msg, Object obj) { | |
System.out.println(msg + " " + obj.toString()); | |
} | |
public static void info(String msg, Object obj) { |
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
Math.floor(Math.random() * 16777215).toString(16) |
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 React from 'react'; | |
interface TableProps { | |
data: any[]; | |
headings?: string[] | |
} | |
function Table(props: TableProps): JSX.Element { | |
const { data = [], headings } = props; |
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 * as fs from 'fs'; | |
import * as ffmpeg from 'fluent-ffmpeg'; | |
class VideoConvertService { | |
public connection: any; | |
public PATH: string = 'videos'; | |
public async saveVideoToMachine(bannerSetId: string, videoBinaryString: any, extention: string, encoding: string = 'utf-8'): Promise<any> { | |
const filename = bannerSetId; | |
const path: string = `${this.PATH}/${filename}.${extention}`; |
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 toSlug = 'every thing you $ want. To b3 eScaped'; | |
const slug = toSlug.toLowerCase() | |
.replace(/[^a-z0-9 -]/g, '') // remove invalid chars | |
.replace(/\s+/g, '-') // collapse whitespace and replace by - | |
.replace(/-+/g, '-'); // collapse dashes |
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
public isColourDarkOrLight(rgb: number[]): 'light' | 'dark' { | |
// RGB to HSP equation: http://alienryderflex.com/hsp.html | |
const [r, g, b] = rgb; | |
const hsp = Math.sqrt( | |
0.299 * (r * r) + | |
0.587 * (g * g) + | |
0.114 * (b * b) | |
); | |
return hsp > 127.5 ? 'light' : 'dark'; | |
} |
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 Logger from "../lib/logger"; | |
import axios from "axios"; | |
import { createCanvas, loadImage, registerFont } from "canvas"; | |
import path from "path"; | |
import ColorThief from "colorthief"; | |
import { uploadImage } from "../resolvers/imgResolver"; | |
import { KeycapsetModel } from "../models"; | |
registerFont(__dirname + "../../../static/Rubik-SemiBold.ttf", { | |
family: "Rubik Semi", |
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
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0} |
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 {promisify} from 'util'; | |
const wait = promisify(setTimeout) | |
await wait(5000); |