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 / animate.css
Created May 4, 2020 10:58
A cross-browser library of CSS animations. As easy to use as an easy thing.
@charset "UTF-8";
/*!
* animate.css -https://daneden.github.io/animate.css/
* Version - 3.7.2
* Licensed under the MIT license - http://opensource.org/licenses/MIT
*
* Copyright (c) 2019 Daniel Eden
*/
@sagar-gavhane
sagar-gavhane / react-memo-with-react-fast-compare.js
Created May 2, 2020 06:31
#3 React.memo with react-fast-compare
import React from 'react'
import { render } from 'react-dom'
import isEqual from 'react-fast-compare'
function Input(props) {
return <input value={props.value} onChange={props.handleOnChange} />
}
const MemoizedInput = React.memo(Input, isEqual)
@sagar-gavhane
sagar-gavhane / common-fixing-scenarios-2.js
Created May 2, 2020 06:30
#2 Common fixing scenarios for object & function props 2
import React from 'react'
import { render } from 'react-dom'
function Alert(props) {
return (
<div
className="alert-wrapper"
style={{ display: props.showAlert ? 'block' : 'none' }}
>
<div className="alert-close" onClick={props.handleCloseAlert}>
import React from 'react'
import { render } from 'react-dom'
function Avatar(props) {
return (
<div className="avatar-wrapper">
<img className="avatar-img" alt="avatar" src={props.user.image} />
<div className="avatar-name">{props.user.name}</div>
</div>
)
@sagar-gavhane
sagar-gavhane / PULL_REQUEST_TEMPLATE.md
Last active June 9, 2021 14:14
Pull Request Template

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation

Pull request checklist

@sagar-gavhane
sagar-gavhane / Dockerfile
Created April 11, 2020 16:35
simple Dockerfile for refernce
FROM node:latest
WORKDIR /app
COPY . .
RUN npm install
EXPOSE 3000
@sagar-gavhane
sagar-gavhane / picture-in-picture.js
Created April 9, 2020 16:51
Picture in picture API in all browsers that support it
const getPictureInPicture = () => {
if (typeof document === "undefined") return { supported: false };
const video = document.createElement("video");
// if browser is chrome: https://developers.google.com/web/updates/2018/10/watch-video-using-picture-in-picture
if (document.pictureInPictureEnabled && !video.disablePictureInPicture) {
return {
supported: true,
request: (video) => video.requestPictureInPicture(),
@sagar-gavhane
sagar-gavhane / material-design-shadows.css
Created April 9, 2020 16:33 — forked from serg0x/material-design-shadows.css
Google material design elevation system shadows as css. Based on https://material.io/design/environment/elevation.html#default-elevations Exported with Sketchapp from the Google material design theme editor plugin "Baseline" theme.
/* Shadow 0dp */
box-shadow: none;
/* Shadow 1dp */
box-shadow: 0 1px 1px 0 rgba(0,0,0,0.14), 0 2px 1px -1px rgba(0,0,0,0.12), 0 1px 3px 0 rgba(0,0,0,0.20);
/* Shadow 2dp */
box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.20);
/* Shadow 3dp */
@sagar-gavhane
sagar-gavhane / rename-files-js-to-ts
Created April 9, 2020 16:32
Rename files from .js to .ts
find app/src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
@sagar-gavhane
sagar-gavhane / Noctis.itermcolors
Created February 23, 2020 07:43
Noctis iTerm theme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.554656982421875</real>