Skip to content

Instantly share code, notes, and snippets.

View efstathiosntonas's full-sized avatar

Efstathios Ntonas efstathiosntonas

View GitHub Profile
@efstathiosntonas
efstathiosntonas / AudioManager.ts
Created May 17, 2024 07:40
Audio Player Chat Message with react-native-awesome-slider & react-native-audio-player-recorder
import AudioRecorderPlayer, { PlayBackType } from "react-native-audio-recorder-player";
import { isIOS } from "utils/utils";
type Callback = (args: { data?: PlayBackType; status: AudioStatus }) => void;
type Path = string | undefined;
export enum AudioStatus {
PAUSED = "PAUSED",
PLAYING = "PLAYING",
RESUMED = "RESUMED",
@rphlmr
rphlmr / helpers.ts
Last active June 15, 2024 20:31
Drizzle ORM, deep sub queries
/* -------------------------------------------------------------------------- */
/* More here; */
/* -------------------------------------------------------------------------- */
//gist.github.com/rphlmr/0d1722a794ed5a16da0fdf6652902b15
https: export function distinctOn<Column extends AnyColumn>(column: Column) {
return sql<Column["_"]["data"]>`distinct on (${column}) ${column}`;
}
export function jsonBuildObject<T extends SelectedFields>(shape: T) {
@efstathiosntonas
efstathiosntonas / App.tsx
Last active December 19, 2022 19:57
React Native card swiper like iOS iMessage multiple images swiper
import React, {FC} from 'react';
import {Dimensions, StyleSheet, View} from 'react-native';
import {
Gesture,
GestureDetector,
GestureHandlerRootView,
} from 'react-native-gesture-handler';
import Animated, {
Easing,
interpolate,
@uwemneku
uwemneku / NestedScrollView.tsx
Last active December 15, 2022 19:12
Nesting a scrollView in a pangesture handler such that the pangesture is only active at the beginning and end of the scrollview
import React, { useRef, useState } from "react";
import {
ScrollView,
PanGestureHandler,
PanGestureHandlerGestureEvent,
} from "react-native-gesture-handler";
import Animated, {
useAnimatedGestureHandler,
useAnimatedStyle,
useSharedValue,
import AsyncStorage from '@react-native-async-storage/async-storage';
import create from 'zustand';
import { persist } from 'zustand/middleware';
export const useSomthingStore = create<TSomthingStore>(
persist(
(set, get) => ({
isTrue: false,
_hasHydrated: false,
setHasHydrated: state => {
#import "AppDelegate.h"
#import "Swift-Header.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
LocalNetworkPrivacy *local = [LocalNetworkPrivacy new];
@zholmes1
zholmes1 / createCSV.ts
Created September 11, 2021 22:14
React Native Translation System
import { writeFileSync } from 'fs'
import { map } from 'lodash'
import en from './src/localize/en'
const lines = map(en, (text, key) => {
return `"${key}","${text}"`
})
writeFileSync('english.csv', lines.join('\n'))
@mrousavy
mrousavy / MEMOIZE.md
Last active June 28, 2024 17:29
Memoize!!! 💾 - a react (native) performance guide
In computing, memoization or memoisation
is an optimization technique used primarily
to speed up computer programs by storing
the results of expensive function calls and  
returning the cached result when the same
inputs occur again.                                         
                                                     — wikipedia
@myckhel
myckhel / Message.js
Created March 25, 2021 14:43
react native gifted chat swipe to reply
import React, {useRef, useMemo, useState, useCallback} from 'react';
import {Vibration, View, StyleSheet} from 'react-native';
import {Button, Text, Row} from '../../theme';
import {Send as SendIcon} from '../../Icons';
import {useMessage, useConversationEventType} from '../../../redux/msg/hooks';
import Animated, {
useAnimatedStyle,
useSharedValue,
} from 'react-native-reanimated';
import {SwipeRow} from 'react-native-swipe-list-view';
@GavinRay97
GavinRay97 / auth.module.ts
Last active February 22, 2024 10:57
Hasura Nest.js JWT Auth utils (REST + GQL)
import { Module } from '@nestjs/common'
import { AuthService } from './auth.service'
@Module({
providers: [AuthService],
exports: [AuthService],
})
export class AuthModule {}