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 re | |
| import string | |
| import networkx as nx | |
| from nltk import pos_tag | |
| from nltk.corpus import stopwords | |
| from nltk.stem import WordNetLemmatizer | |
| from textblob.wordnet import NOUN, VERB, ADJ, ADV | |
| from sklearn.metrics.pairwise import cosine_similarity | |
| _WORD_PAT = r"\w[\w']{3,}" |
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 { useCallback, useState } from 'react'; | |
| // Usage | |
| function App() { | |
| // Call the hook which returns, current value and the toggler function | |
| const [isTextChanged, setIsTextChanged] = useToggle(); | |
| return ( | |
| <button onClick={setIsTextChanged}>{isTextChanged ? 'Toggled' : 'Click to Toggle'}</button> |
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 { | |
| DatabaseInterface, | |
| ConnectionInformations, | |
| CreateUser, | |
| User as AccountsUser, | |
| } from '@accounts/types'; | |
| import { | |
| PrismaClient, | |
| Prisma, | |
| User, |
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 {Dimensions} from 'react-native'; | |
| const {height: SCREEN_HEIGHT, width: SCREEN_WIDTH} = Dimensions.get('window'); | |
| const designSize = {width: 390, height: 844}; | |
| const CURRENT_RESOLUTION = Math.sqrt( | |
| SCREEN_HEIGHT * SCREEN_HEIGHT + SCREEN_WIDTH * SCREEN_WIDTH, | |
| ); | |
| const DESIGN_RESOLUTION = Math.sqrt( | |
| designSize.height * designSize.height + designSize.width * designSize.width, |
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 {PhoneNumberUtil} from 'google-libphonenumber'; | |
| export const isPhoneNumber = (number?: string) => { | |
| try { | |
| if (!number) { | |
| throw new Error('Phone number is required'); | |
| } | |
| if (number.length < 4) { | |
| throw new Error('Phone number is too short'); | |
| } |
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, { useCallback } from "react"; | |
| import { ListRenderItem } from "react-native"; | |
| type BaseProps<T extends unknown> = { | |
| item: T; | |
| }; | |
| type UseRenderItemProps<T, P extends BaseProps<T>> = { | |
| Component: React.ComponentType<P>; | |
| componentProps: Omit<P, "item">; |
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 { | |
| useSharedValue, | |
| useAnimatedScrollHandler, | |
| } from 'react-native-reanimated'; | |
| const useScrollHandler = () => { | |
| const scrollY = useSharedValue(0); | |
| const onScroll = useAnimatedScrollHandler(event => { | |
| scrollY.value = event.contentOffset.y; | |
| }); |
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 {Platform, StyleSheet, TextStyle} from 'react-native'; | |
| import {getDesignSize} from '@utils'; | |
| type Weight = '700' | '600' | '500' | '400'; | |
| const fonts = new Map<Weight, string>([ | |
| ['700' as const, Platform.select({default: '700' as const, android: 'Bold'})], | |
| [ | |
| '500' as const, |
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 {StatusBar} from 'react-native'; | |
| import {useCallback} from 'use-memo-one'; | |
| import {useFocusEffect} from '@react-navigation/native'; | |
| import Animated, {runOnJS, useDerivedValue} from 'react-native-reanimated'; | |
| const updateStatusBarStyle = ( | |
| shared: Animated.SharedValue<number>, | |
| maxNo: number, | |
| ) => { | |
| 'worklet'; |
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 {useCallback} from 'react'; | |
| import {useFocusEffect} from '@react-navigation/native'; | |
| import {ColorValue, StatusBar, StatusBarStyle, Platform} from 'react-native'; | |
| const useFocusStatusBar = ( | |
| barStyle: StatusBarStyle = 'dark-content', | |
| translucent: boolean = true, | |
| backgroundColor: ColorValue = 'transparent', | |
| ): void => { | |
| useFocusEffect( |
OlderNewer