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
| 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 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
| 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 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 * 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 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 React from 'react'; | |
| interface TableProps { | |
| data: any[]; | |
| headings?: string[] | |
| } | |
| function Table(props: TableProps): JSX.Element { | |
| const { data = [], headings } = props; |
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
| Math.floor(Math.random() * 16777215).toString(16) |
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
| // 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 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
| // 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 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 getRandomString(wishedIdLength) { | |
| var result = ''; | |
| var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789=-[]\|'; | |
| var charactersLength = characters.length; | |
| for (let i = 0; i < wishedIdLength; i++ ) { | |
| result += characters.charAt(Math.floor(Math.random() * charactersLength)); | |
| } | |
| return result; | |
| } |
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
| -- delete | |
| drop table message; | |
| drop table email; | |
| drop table product; | |
| drop table feed; | |
| drop table account; | |
| create table account ( | |
| account_id SERIAL PRIMARY KEY not null, | |
| name varchar(255) not 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
| docker run -d -p 49160:22 -p 49162:8080 -p 49161 -v oracledb thebookpeople/oracle-xe-11g |