Skip to content

Instantly share code, notes, and snippets.

View kalpeshsingh's full-sized avatar
life, philosophy and front-end

Kalpesh Singh kalpeshsingh

life, philosophy and front-end
View GitHub Profile
kalpeshsingh / test_format.js
Created August 7, 2021 02:10
AAA Pattern in Writing Test Cases
describe('test cases for Button component', () => {
it('should call callback fn when onPress is fired', () => {
/** Arrange **/
const handleClick = jest.fn()
const { getByTestId, toJSON } = render(
<Button onPress={handleClick}>
<Text>Test Button</Text>
<meta data-rh="true" name="twitter:label1" content="Reading time">
<meta data-rh="true" name="twitter:data1" content="6 min read">
<h1>Hello Test! 🎉 </h1>


  • What is your document all about?
  • What is the objective it achieves? Or write an object in a separate section.


  • ARR? What's that? Help readers with the meaning of terms.


  • So you have made a few assumptions? List them down here.
kalpeshsingh / .mdx
Created June 26, 2021 11:55

Functions (directly in the codebase)

 * @description Renders a custom heading component for font and localization usage
 * Note- The style will take precedence over any custom style props to enable control to the consumer
 * @param props {object} {children, color, fontStyle,} - some more description if required
 * @returns {JSX.Element}
 * @author Name Surname <>
kalpeshsingh / webpack-extract-css-demo
Created October 14, 2019 09:51
/** native nodejs packages **/
const path = require("path");
const fs = require("fs");
/** post css import css **/
const postCssImport = require("postcss-import");
/** extract css plugin **/
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
kalpeshsingh / pre-push
Last active April 26, 2024 04:31
A pre-push git hook that notify Amazon Chime group
branch="$(git rev-parse --abbrev-ref HEAD)"
# get computer name to append in Chime message
# a branch name where you want to prevent git push. In this case, it's "master"
if [ "$branch" = "master" ]; then
echo "You can't commit directly to '"${branch}"' branch" # webstorm or intellij will show this as popup