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 handleCommand = async ({ | |
channel, | |
from, | |
func, | |
to, | |
}: { | |
from: string; | |
to: string; | |
func: (args: any) => any; | |
channel: amqp.Channel; |
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 const getKeys = <T extends {}>(o: T): Array<keyof T> => | |
o ? (Object.keys(o) as Array<keyof T>) : []; |
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 AnyFunction = (...args: any[]) => any; | |
type GetReturnType<T extends AnyFunction> = T extends (...args: any[]) => infer R ? R : any; | |
export const timeCacheResult = <T extends AnyFunction>( | |
cache: Map<any, { until: number; value: any }>, | |
cacheTime: number, | |
func: T, | |
): T => { | |
return function(...args: any[]) { | |
const curTime = new Date().getTime(); |
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 findItemAndIndexById = <T extends { id: string }>( | |
id: string, | |
tabWithId: T[] | |
): | |
| { | |
item: T; | |
index: number; | |
} | |
| undefined => { | |
let itemIndex = -1; |
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 Props { | |
if: boolean; | |
} | |
const Conditionnal: React.FC<Props> = props => { | |
if (props.if) { | |
return <React.Fragment>{props.children}</React.Fragment>; | |
} else { | |
return null; |
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 bills = createStore([{id: 0, state: 0}, {id: 1, state: 2}]); | |
const selected = createStore(0); | |
const cheatersStore = createStoreObject({ | |
bills, | |
selected | |
}) | |
const validate = createEvent('validate') | |
bills.on(validate, (bills, idBill) => { |
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 ShopModel { | |
date: string; | |
} | |
class Shop extends ShopModel { | |
constructor(shop: ShopModel){ | |
this.date = shop.date; | |
} | |
get formattedDate() { |
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 const logAction = (name: string) => { | |
return (target, key, descriptor) => { | |
if(descriptor === undefined){ | |
descriptor = Object.getOwnPropertyDescriptor(target, key); | |
} | |
const originalMethod: Function = descriptor.value; | |
descriptor.value = async function() { | |
const args: Array<any> = []; |
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"; | |
import { View, TouchableOpacity } from "react-native"; | |
class MyChildComponent extends React.Component { | |
render(){ | |
} | |
} |
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
node_modules | |
.env | |
.ebextensions | |
error.log | |
dist |
NewerOlder