Skip to content

Instantly share code, notes, and snippets.

View kashishgrover's full-sized avatar
I like coffee

Kashish Grover kashishgrover

I like coffee
View GitHub Profile
@kashishgrover
kashishgrover / gist:5696a5aa50fd18cc6216ffe12500f564
Last active January 27, 2023 08:06
Merge a remote repo into a subdirectory of another repo
git remote add <remote-name> <remote-url>

git fetch <remote-name> --tags

git subtree add --prefix <subdirectory> <remote-name> <sha>
import React from 'react';
import theme from 'leaf-ui/theme/native';
import Text from 'leaf-ui/Text/native';
import Card from 'leaf-ui/Card/native';
import Space from 'leaf-ui/Space/native';
import Flex from 'leaf-ui/Flex/native';
import { getIcon } from '../../utils/Icon';
class ExampleBanner extends React.Component {
state = {};
@kashishgrover
kashishgrover / index.js
Created November 30, 2018 19:31
React Native index.js with default props example
import { Text, TouchableOpacity } from 'react-native';
Text.defaultProps = {
...Text.defaultProps,
allowFontScaling: false,
};
// In other news, we do this as well because 0.6 is too weird
TouchableOpacity.defaultProps = {
...TouchableOpacity.defaultProps,
@kashishgrover
kashishgrover / ExampleBanner.js
Last active November 30, 2018 19:55
Example of a banner using LeafUI
import React from 'react';
import theme from 'leaf-ui/theme/native';
import Text from 'leaf-ui/Text/native';
import Card from 'leaf-ui/Card/native';
import Space from 'leaf-ui/Space/native';
import Flex from 'leaf-ui/Flex/native';
import { getIcon } from '../../utils/Icon';
class ExampleBanner extends React.Component {
state = {};
@kashishgrover
kashishgrover / scalingStylesExample.js
Created November 30, 2018 19:12
React Native Component Scaling Example
const styles = StyleSheet.create({
container: {
borderRadius: scale(4),
borderWidth: scale(0.5),
borderColor: '#d6d7da',
paddingHorizontal: scale(16),
},
title: {
fontSize: scale(19),
fontWeight: 'bold',
@kashishgrover
kashishgrover / reactNativeScaler.js
Last active December 1, 2018 06:27
Centralized scaling algorithm for React Native
const { width, height } = Dimensions.get('window');
const heightAspect = 568;
const widthAspect= 320;
const verticalScale = height / heightAspect;
const horizontalScale = width / widthAspect;
export const scale = (size) => (verticalScale / horizontalScale) * size;
export const scalePx = (sizePx) => {
Verifying my Blockstack ID is secured with the address 1NLfpGW1B4BkpnE1uFS6ED75pxH19n3dgH https://explorer.blockstack.org/address/1NLfpGW1B4BkpnE1uFS6ED75pxH19n3dgH
@kashishgrover
kashishgrover / MyComponent.js
Last active February 27, 2018 09:16
Writing Stateless Components in React Native
// Consider a situation where you pass data, a state, and your navigation as props to your child component.
const MyComponent = ({ loadingImages, data, navigation }) => {
const loadNextPage = () => {
navigation.navigate('NextPage');
}
return (
<View>