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 / sls-api-serverless.yaml
Created October 22, 2018 06:16
This code snippets is created during writting article on "Build a RESTful API with the Serverless Framework". article link is here => https://medium.com/@sgavhane70/build-a-restful-api-with-the-serverless-framework-d8cc548f8e0f
# serverless.yml
service: pokemon-service
provider:
name: aws
runtime: nodejs8.10
stage: dev
region: us-east-1
memorySize: 512
@sagar-gavhane
sagar-gavhane / sls-api-serverless.yml
Created October 22, 2018 06:14
This code snippets is created during writting article on "Build a RESTful API with the Serverless Framework". article link is here => https://medium.com/@sgavhane70/build-a-restful-api-with-the-serverless-framework-d8cc548f8e0f
# serverless.yml
service: pokemon-service
provider:
name: aws
runtime: nodejs8.10
stage: dev
region: us-east-1
memorySize: 512
@sagar-gavhane
sagar-gavhane / sls-api-serverless.yml
Created October 22, 2018 06:08
This code snippets is created during writting article on "Build a RESTful API with the Serverless Framework". article link is here => https://medium.com/@sgavhane70/build-a-restful-api-with-the-serverless-framework-d8cc548f8e0f
# serverless.yml
service: pokemon-service
provider:
name: aws
runtime: nodejs8.10
stage: dev
region: us-east-1
memorySize: 512
@sagar-gavhane
sagar-gavhane / cs-module-path.js
Created October 21, 2018 08:17
This code snippet is written during publishing article on "Code Splitting in React". article link: https://dev.to/sagar/increase-user-interactions-by-implementing-code-splitting-in-react-5a1e
const modulePath = './someFile.js'; // path of module
// dynamic import() module
import(modulePath).then(module => {
return module.default; // return default function of es module
});
@sagar-gavhane
sagar-gavhane / pokemon.js
Created October 20, 2018 13:23
pokemon app
const express = require('express')
const serverless = require('serverless-http')
const bodyParser = require('body-parser')
const pool = require('./configs/dbConfig')
const app = express()
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: true }))
@sagar-gavhane
sagar-gavhane / AppPropTypes.jsx
Created October 10, 2018 17:00
prop types and default props types inside <App /> components.
class App extends Component {
static propTypes = {
title: propTypes.string,
};
static defaultProps = {
title: 'app works from default props',
}
render() {
@sagar-gavhane
sagar-gavhane / react-render-props-pattern.jsx
Created October 9, 2018 17:09
React render props pattern
class App extends Component {
render() {
return (
<React.Fragment>
<h1>Currency Converter</h1>
<Amount
render={data => {
return (
<React.Fragment>
<Euro amount={data.amount} />
@sagar-gavhane
sagar-gavhane / enzyme-testing.js
Created October 4, 2018 13:26
Enzyme testing
import React from 'react';
import EnzymeConfig from './../../../enzyme';
import { shallow } from 'enzyme';
import Alert from './Alert';
EnzymeConfig();
describe('Alert component testing', () => {
// 1. alert-primary
@sagar-gavhane
sagar-gavhane / utils.js
Created October 2, 2018 17:06
javascript utility functions
'use strict';
function bind(fn, thisArg) {
return function wrap() {
var args = new Array(arguments.length);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i];
}
return fn.apply(thisArg, args);
};
@sagar-gavhane
sagar-gavhane / introrx.md
Created September 20, 2018 12:57 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing