Skip to content

Instantly share code, notes, and snippets.

View night-fury-rider's full-sized avatar

Yuvraj Patil night-fury-rider

View GitHub Profile
@night-fury-rider
night-fury-rider / react-native-component-props-interface.ts
Created July 4, 2024 05:53
Interface for React Native Component Props
import {StyleProp, ViewStyle} from 'react-native';
interface IInputProps {
inputValue: string | number;
handleChange?: (updatedValue: string) => void;
inputLabel?: string;
customStyle?: StyleProp<ViewStyle>;
}
export type {IInputProps};
@night-fury-rider
night-fury-rider / rare-contacts-screenshot-data.json
Created June 14, 2024 17:59
Rare Contacts Screenshot Data
[
{
"id": "dadawa-dagdhwaj",
"displayName": "Arya Stark",
"jobTitle": "Warrior",
"contactStr": "",
"imageBase64Path": "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wgARCAEAAQADASIAAhEBAxEB/8QAGwAAAQUBAQAAAAAAAAAAAAAAAAECAwQFBgf/xAAZAQEBAQEBAQAAAAAAAAAAAAAAAQIDBAX/2gAMAwEAAhADEAAAAfKgAACeKxvLGrLZDK6SyokyTULXGK2Vsiyb/O2ZrUz235rIfdhWpDerswituYxzUAAAAAACSVk/TCPRmsvVjJQLCVHXSapt1bGemMnVWMdOPi9K1MvIZe54TWdGrDuTeHW0a15wMe25QAAAABzX2Pngl3lkiNRrFizu7cgt9/M981ydDqcnpfP6rVtLfLcMN2HNyec6ujnfkOhe57vwv1rdUr171TWIwEAAACaGbUc5j9Zs15qljGkvPd2eOf0+W3pVNbn3s7ePteb161ita56ssnVjOh06vPfJeVe2eWdFWk9nbjJVliuYxUQAAAWSN2o5zVsmrSRQl6lY1nVt5V7v5dW9iv5ejptrluo8/r0refZ570pcepcb9TjuXX0bzufIbwJGr14QjkZYioAAACvjksVVi1Bo7NLddms6FTRqbxUOnz86pdrw/bc+vVcp23Cc+/Nt6el145/X8k2XpeOj6PO+bbLV1zuRPqkaAyAAACoVNE51kTkIvNdc9Hmq21drNtZW655ffcJ6R4/odNTuQefvn529zfS5eD0vRaz
@night-fury-rider
night-fury-rider / react-jest-with-enzyme-deep.test.ts
Created February 6, 2024 17:05
React - Jest with Enzyme_Deep
import React from 'react';
import { mount } from 'enzyme';
import UVModal from './UVModal';
let modalShow = true,
project = {
title: 'Test title',
logoUrl: 'Test',
desciption: 'Test desciption',
@night-fury-rider
night-fury-rider / react-jest-with-enzyme-shallow.test.ts
Last active February 6, 2024 17:04
React - Jest with Enzyme_Shallow
import React from 'react';
import { shallow } from 'enzyme';
import Timeline from './Timeline';
let componentToTest = {
title: 'Timeline: ',
html: <Timeline />,
noOfCompanies: 4,
noOfColleges:3
@night-fury-rider
night-fury-rider / react-export-all.ts
Created January 14, 2024 08:56
React - Export All
const getTotal = ()=>{}
const saveData = ()=>{}
export {
getTotal,
saveData
}
@night-fury-rider
night-fury-rider / react-export-individually.ts
Created January 14, 2024 08:55
React - Export Individually
export const getTotal = ()=>{}
export const saveData = ()=>{}
@night-fury-rider
night-fury-rider / jest-mocking-partial-mock-own-methods.test.tsx
Last active December 28, 2023 08:21
Jest - Partially Mocking Own Methods
jest.mock("$dashboard/ContactService", ()=> {
const actualModule = jest.requireActual("../dashboard/ContactService");
return {
__esModule: true,
...actualModule,
size: 100,
deleteContact: jest.fn()
}
open: jest.fn()
});
@night-fury-rider
night-fury-rider / jest-mocking-library-methods.test.tsx
Last active December 27, 2023 06:02
Jest - Mocking Library Methods
jest.mock("react-native-share", ()=> {
open: jest.fn()
});
@night-fury-rider
night-fury-rider / use-memo.tsx
Last active March 23, 2021 07:13
React - Hook useMemo
import React, { useMemo } from 'react';
function App() {
const arr = [1, 2, 33, 4];
// Memorize output as long as dependency array elements are not changed.
const memiozedValue = useMemo(() => getLargestValue(), [arr]);
function getLargestValue() {
return Math.max(...arr);
const routes = [
{
path: "/sandwiches",
component: Sandwiches
},
{
path: "/tacos",
component: Tacos,
routes: [
{