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
type Param = string | number | string[] | {[key: string]: boolean}[] | {[key: string]: boolean}; | |
export function classnames(...args: Param[]) { | |
if (args.length === 0) { | |
return ''; | |
} else { | |
return args | |
.map(item => rec(item)) | |
.join(' '); | |
} |
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
export function defaultsDeep(object: object | Array<any>, ...sources: any[]) { | |
return sources.reduce((acc, source) => customDefaultsDeep(acc, source), object); | |
} | |
function customDefaultsDeep(object, source) { | |
if (Array.isArray(source)) { | |
if (object === undefined) { | |
object = [] | |
} |
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 atob = window.atob; | |
function b64DecodeUnicode(str) { | |
return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) { | |
let code = p.charCodeAt(0).toString(16).toUpperCase(); | |
if (code.length < 2) { | |
code = '0' + code; | |
} | |
return '%' + code; | |
})); |
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
type RouteConfig<C extends RouteChildren = {}> = { | |
[P in keyof C]: RouteConfig; | |
} & { | |
(): string; | |
children: RouteChildren; | |
}; | |
type RouteChildren = { | |
[key: string]: RouteConfig; | |
}; |
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
@Entity('checks') | |
export class ChecksEntity { | |
@PrimaryGeneratedColumn('uuid') | |
id: string; | |
@OneToOne(() => SessionsEntity, session => session.check, {onDelete: 'CASCADE'}) | |
@JoinColumn() | |
session_id: string; | |
@CreateDateColumn() |
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
export function cosineMeasure(vectors: number[][]): number[][] { | |
return vectors.reduce<number[][]>((acc, user) => { | |
const weights = vectors.map(item => { | |
return scalarProduct(user, item) / Math.sqrt(scalarProduct(user, user)) / Math.sqrt(scalarProduct(item, item)); | |
}); | |
return [...acc, weights]; | |
}, []); | |
} |
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
set myList to {"target-folder"} | |
set baseUrl to "~/home/user/base-folder" | |
tell application "Terminal" | |
activate | |
do script "cd " & baseUrl & " && docker-compose up" | |
delay 15.0 | |
repeat with theItem in myList | |
my makeTab() | |
set input to "\"\\033]0;" & theItem & "\\007\"" |