Skip to content

Instantly share code, notes, and snippets.

View emfluenceindia's full-sized avatar
📖
Working...

Subrata Sarkar emfluenceindia

📖
Working...
View GitHub Profile
@emfluenceindia
emfluenceindia / es6-class-and-inheritance-example.js
Created November 19, 2018 07:26
ES6 - A basic example of JavaScript class and inheritance
/**
Declaring Person class, its constructor and methods.
This class will be inherited by GetPerson class later to access its properties and methods.
*/
class Person {
constructor(person) {
this.name = person.name;
this.jobTitle = person.jobTitle;
@emfluenceindia
emfluenceindia / es6-map-and-keys-in-a-complex-jsvascript-object.js
Last active November 19, 2018 10:59
ES6 - Simple example of how to use Object.keys and Array.map in a complex JavaScript object
/**
The following example is a simple use case of Object.keys and Array.map functions
to loop through a nested JavScript array with object nested into it.
Steps:
1. Used a map() method on the main array, i.e. examResult
2. Started looping through the mapped object
3. If the loop encounters a JavaScript Object (marks in this case) it applied Object.keys method on it
Structure of examResult array:
@emfluenceindia
emfluenceindia / hall-column-builder.js
Last active February 13, 2019 13:52
Gutenberg Custom Block for adding columns
/**
* Custom Column control
* Reference: https://github.com/WordPress/gutenberg/blob/master/packages/block-library/src/columns/index.js
*/
import { times } from 'lodash';
import classnames from 'classnames'
import memoize from 'memize';
/**