Skip to content

Instantly share code, notes, and snippets.

View ajaykumar97's full-sized avatar
:octocat:
Committing from home

Ajay Kumar ajaykumar97

:octocat:
Committing from home
View GitHub Profile
@ajaykumar97
ajaykumar97 / Mailer.js
Created July 29, 2019 17:59
This is an example function to pick document from the device, attach it with the email and open in the email application(gmail etc.)
/*
Call pickDocAndSendToMail function on button click
*/
//...other imports
import DocumentPicker from 'react-native-document-picker';
import Mailer from 'react-native-mail';
import RNFS from 'react-native-fs';
@ajaykumar97
ajaykumar97 / SlideAnimation.js
Created September 20, 2019 04:50
Horizontal Search Header swipe example
import React, { Component } from 'react';
import {
View,
Text,
TouchableOpacity,
TextInput,
Animated,
Dimensions,
StyleSheet
} from 'react-native';
@ajaykumar97
ajaykumar97 / ReactHooks.js
Last active November 4, 2019 13:33
React-Hooks example
import React, { useState, useEffect } from 'react';
import { View, StyleSheet, Button, Text } from 'react-native';
// eslint-disable-next-line import/no-extraneous-dependencies
import uuidv4 from 'uuid/v4';
const ReactHooks = () => {
const [count, setCount] = useState(0);
const [users, setUsers] = useState([]);
/*
@ajaykumar97
ajaykumar97 / Logger
Last active December 6, 2019 16:42
Custom React-Native Logger
Hi @everyone
I have created a LoggerJs to log outputs to make debugging easy. Please have a look at it and tell if you find it useful. If not, I would be glad to know your response and your suggestions.
https://gist.github.com/ajaykumar97/d953710618f22a611b2c564f260e741d
It automatically disables the console.log if it is not the production environment.
It has different methods to log the out:
@ajaykumar97
ajaykumar97 / DummyReadme.txt
Last active November 19, 2019 03:10
Dummy request readme
baseUrl: http://0:0:0:0:8888/dummy1/v1/
imagesPath: http://0:0:0:0:8888/dummy1/v1/thumbnail/(image_name)/width/height
Notes:
--> Send token in header in APIs like:
access_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjExLCJpYXQiOjE1MzExMjM3NDAsImV4cCI6MTUzMzcxNTc0MH0.ARupD0Y3bvzvCVDHeZtTFNU_6cFjNmwTMrqsIjD_C7M
=========================== Request Status Codes =======================
ACTION_COMPLETE: 200
@ajaykumar97
ajaykumar97 / Formik.js
Last active December 13, 2019 05:14
Formik + yup example
import React from 'react';
import { Button, TextInput, View, Text, StyleSheet } from 'react-native';
import SplashScreen from 'react-native-splash-screen';
import { Formik } from 'formik';
import * as yup from 'yup';
class MyReactNativeForm extends React.Component {
componentDidMount() {
SplashScreen.hide();
}
@ajaykumar97
ajaykumar97 / GoogleSignin.txt
Last active January 1, 2020 11:33
Google Signin Configuration
1. To generate SHA-1 key for android on Linux:
https://stackoverflow.com/a/34933381
OR
For Debug mode:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
For Release mode:
@ajaykumar97
ajaykumar97 / GiftedChatIssue.js
Created December 19, 2019 09:17
Gifted Chat Small Jerk Issue
import React from 'react';
import { GiftedChat } from 'react-native-gifted-chat';
export default class Example extends React.Component {
state = {
messages: [],
};
componentDidMount() {
this.setState({
@ajaykumar97
ajaykumar97 / post-merge
Created October 17, 2020 14:21 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example