Skip to content

Instantly share code, notes, and snippets.

View AntsiferovMaxim's full-sized avatar
🌴

Antsiferov Maxim AntsiferovMaxim

🌴
View GitHub Profile
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(' ');
}
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 = []
}
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;
}));
type RouteConfig<C extends RouteChildren = {}> = {
[P in keyof C]: RouteConfig;
} & {
(): string;
children: RouteChildren;
};
type RouteChildren = {
[key: string]: RouteConfig;
};
@AntsiferovMaxim
AntsiferovMaxim / airbnb-phone-input
Last active April 3, 2020 23:49
Airbnb phone input
We couldn’t find that file to show.
@Entity('checks')
export class ChecksEntity {
@PrimaryGeneratedColumn('uuid')
id: string;
@OneToOne(() => SessionsEntity, session => session.check, {onDelete: 'CASCADE'})
@JoinColumn()
session_id: string;
@CreateDateColumn()
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];
}, []);
}
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\""