Skip to content

Instantly share code, notes, and snippets.

View huzaifaaak's full-sized avatar
🎯
Focusing

Huzaifa Khan huzaifaaak

🎯
Focusing
View GitHub Profile
@rokkoo
rokkoo / sticky text input
Created May 10, 2023 08:50
Reanimated sticky text input on react native
View sticky text input
import React, { useCallback, useState } from 'react';
import {
Pressable,
StyleSheet,
TextInput,
useWindowDimensions,
} from 'react-native';
import { useReanimatedKeyboardAnimation } from 'react-native-keyboard-controller';
import Animated, {
interpolate,
@mrousavy
mrousavy / MEMOIZE.md
Last active November 20, 2023 10:43
Memoize!!! 💾 - a react (native) performance guide
View MEMOIZE.md
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
View account.jsx
import React, { useCallback, useEffect, useState } from 'react'
import {
StyleSheet,
View,
Text,
TouchableOpacity,
Button,
Image,
} from 'react-native'
@edvinasbartkus
edvinasbartkus / android.yml
Created November 20, 2019 14:45
Running Detox tests for Android on Github Actions Workflow
View android.yml
name: Android
on: [push]
jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout
@edvinasbartkus
edvinasbartkus / .github-workflows-main.yml
Created November 16, 2019 10:06
Github Action for React Native Detox
View .github-workflows-main.yml
name: Detox
on: [push]
jobs:
build:
runs-on: macOS-latest
timeout-minutes: 15
env:
@jmoz
jmoz / rsi.py
Created September 27, 2019 07:41
RSI calculation to match Tradingview
View rsi.py
import pandas as pd
def rsi(ohlc: pd.DataFrame, period: int = 14) -> pd.Series:
"""See source https://github.com/peerchemist/finta
and fix https://www.tradingview.com/wiki/Talk:Relative_Strength_Index_(RSI)
Relative Strength Index (RSI) is a momentum oscillator that measures the speed and change of price movements.
RSI oscillates between zero and 100. Traditionally, and according to Wilder, RSI is considered overbought when above 70 and oversold when below 30.
Signals can also be generated by looking for divergences, failure swings and centerline crossovers.
@mcousillas6
mcousillas6 / gestureExamples.js
Last active August 9, 2023 07:38
react-native-gesture-handler + react-native-reanimate example
View gestureExamples.js
import React, { useMemo, useRef } from 'react';
import { View } from 'react-native';
import { node } from 'prop-types';
import { PanGestureHandler, State, PinchGestureHandler } from 'react-native-gesture-handler';
import Animated from 'react-native-reanimated';
import styles from './styles';
/** styles.js
import { StyleSheet } from 'react-native';
@axemclion
axemclion / JSIObject.cpp
Last active October 4, 2023 19:36
React Native JSI Example
View JSIObject.cpp
// This sample is a Work in Progress for JSI , and specific functions may change.
#pragma once
#include <string>
#include <unordered_map>
#include <jsi/jsi.h>
// This SameplJSIObject needs to inheric from HostObject, and this is the object that will be exposed to JS.
@johnmarinelli
johnmarinelli / app.js
Last active August 17, 2021 19:25
Cavy + React Navigation (TabNavigator)
View app.js
import { TabNavigator } from 'react-navigation'
import Ionicons from 'react-native-vector-icons/Ionicons'
import { hook } from 'cavy'
class Icon extends Component {
render() {
const { navigation, generateTestHook, routeName... } = this.props
return <Ionicons ref={generateTestHook(`Navigation.${routeName}`)} onPress={() => navigation.navigate(routeName)} .../>
}
}
@mkjiau
mkjiau / axios-interceptors-refresh-token.js
Last active November 28, 2023 03:16
Axios interceptors for token refreshing and more than 2 async requests available
View axios-interceptors-refresh-token.js
let isRefreshing = false;
let refreshSubscribers = [];
const instance = axios.create({
baseURL: Config.API_URL,
});
instance.interceptors.response.use(response => {
return response;
}, error => {