Skip to content

Instantly share code, notes, and snippets.

View sagar-gavhane's full-sized avatar
🏠
Working from home

Sagar sagar-gavhane

🏠
Working from home
View GitHub Profile
@sagar-gavhane
sagar-gavhane / README-Template.md
Created November 13, 2018 05:01 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
const Joi = require("joi");
const nanoid = require("nanoid");
const value = {
documents: [
{
type: "PAN_CARD",
number: nanoid(10),
expire_date: "2018-11-16T18:46:19-0700",
proof_for: "PROOF_OF_IDENTITY",
@sagar-gavhane
sagar-gavhane / seqExecuteStates.jsx
Created November 24, 2018 11:42
sequentially execute states.
import React from "react";
import { render } from "react-dom";
import "./styles.scss";
class App extends React.Component {
constructor(props) {
super(props);
this.state = { counter: 1 };
}
const FakeModal = ({ children, show }) => (
<Fragment>
<div className="modal" style={{ display: show ? 'block' : 'none' }}>
<div className="modal-content">
<span className="close">&times;</span>
<div className="clearfix" />
<div className="modal-body">{children}</div>
</div>
</div>
</Fragment>
@sagar-gavhane
sagar-gavhane / multipleOfHundred.js
Created January 12, 2019 12:26
Yupjs multipleOfHundred custom validation
import * as Yup from "yup";
const values = 0;
const msg = "value should be multiple of hundred";
Yup.addMethod(Yup.number, "multipleOfHundred", function(msg) {
return this.test("test-name", msg, function(value) {
const { path, createError } = this;
return value % 100 === 0 && value !== 0;
@sagar-gavhane
sagar-gavhane / WithoutFormik.jsx
Created January 13, 2019 10:08
WithoutFormik - Build forms in React, without the tears with Formik and Yup
import React from 'react'
import createRepository from './../services/createRepository'
class WithoutFormik extends React.Component {
state = {
name: '',
desc: '',
type: 'PUBLIC',
license: 'NONE',
errors: {
@sagar-gavhane
sagar-gavhane / disableReactDevTool.jsx
Created January 16, 2019 12:51
Disable react dev tools in production.
if (!window.location.port && typeof window.__REACT_DEVTOOLS_GLOBAL_HOOK__ === 'object') {
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.inject = function() {};
}
@sagar-gavhane
sagar-gavhane / mfa.js
Created March 20, 2019 08:16
AWS Cognito Backend Multi Factor Authentication (MFA)
// mfaSignIn.js
const AWS = require("aws-sdk");
try {
const credentials = {
email: "[email protected]",
password: "xxxxxxxxxxxxxx"
};
const params = {
@sagar-gavhane
sagar-gavhane / embedded-file-viewer.md
Created May 15, 2019 13:17 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links