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
kalpeshsingh / pre-push
Last active April 26, 2024 04:31
A pre-push git hook that notify Amazon Chime group
#!/bin/sh
branch="$(git rev-parse --abbrev-ref HEAD)"
# get computer name to append in Chime message
username=$USER
# 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
@kalpeshsingh
kalpeshsingh / webpack-extract-css-demo
Created October 14, 2019 09:51
webpack-extract-css-demo
/** 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
kalpeshsingh / .mdx
Created June 26, 2021 11:55
documentation_examples

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, ...rest} - some more description if required
 * @returns {JSX.Element}
 * @author Name Surname <youremail@company.com>

Overview

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

Glossary

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

Assumptions

  • So you have made a few assumptions? List them down here.
<html>
<head>
<meta data-rh="true" name="twitter:label1" content="Reading time">
<meta data-rh="true" name="twitter:data1" content="6 min read">
</head>
<body>
<h1>Hello Test! 🎉 </h1>
</body>
@kalpeshsingh
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>