Skip to content

Instantly share code, notes, and snippets.

View bhatmand's full-sized avatar

Mandeep Singh Bhatia bhatmand

View GitHub Profile
body {
border: none !important;
}
.kineticjs-content {
background-color: #282c34;
}
td {
background-color: #282c34;
@bhatmand
bhatmand / git tutorials.md
Created April 5, 2019 02:04 — forked from jaseemabid/git tutorials.md
Awesome git tutorials I am finding here and there
@bhatmand
bhatmand / better-nodejs-require-paths.md
Created June 13, 2019 09:55 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@bhatmand
bhatmand / js-concepts.md
Created July 9, 2019 14:23 — forked from ericelliott/js-concepts.md
Seven JS Concepts You Must Understand Before Your Next Job Interview

Here are seven JavaScript concepts you must understand before you go into your next JavaScript job interview:

  1. Prototypes - JavaScript is a prototype-based language. Even more, it's a delegation-based system, which means that each object has a prototype chain. When you try to access a property on an object, and that property is not found, JavaScript looks at the object's prototype. The prototype is a delegate object, which means that the property lookup is delegated to the prototype object. That object, in turn, may have its own prototype. The search continues up the prototype chain until it reaches the root prototype, which is usually Object.prototype. The best feature of this system is that many object instances can share the same methods on a prototype object, which conserves memory and enables easy code reuse. To assign a prototype to a new object, you can use Object.create(prototypeObject). Prototypal OO is the first course being offered in the "Learn JavaScript" series.

  2. Functional Programming

@bhatmand
bhatmand / essential-javascript-links.md
Created July 9, 2019 14:25 — forked from rsperberg/essential-javascript-links.md
A fork that adds descriptions to Eric Elliott’s 142 essential JS links
@bhatmand
bhatmand / fp-lingo.md
Created July 9, 2019 14:30 — forked from ericelliott/fp-lingo.md
A Guide to Functional Programming Lingo for JavaScripters

A Guide to Functional Programming Lingo for JavaScripters

Functional programming gets a bad wrap about being too hard for mere mortals to comprehend. This is nonsense. The concepts are actually quite simple to grasp.

The jargon is the hardest part. A lot of that vocabulary comes from a specialized field of mathematical study called category theory (with a liberal sprinkling of type theory and abstract algebra). This sounds a lot scarier than it is. You can do this!

All examples using ES6 syntax. wrap (foo) => bar means:

function wrap (foo) {
@bhatmand
bhatmand / lambda-not-anon.md
Created July 9, 2019 14:33
The distinction between anonymous functions and lambdas in JavaScript.

TL;DR - Lambda means "function used as data".

Anonymous function means "function without a name".

This is one of the relatively few cases where the Wikipedia definition of a word, while not entirely wrong, is misleading. Lambdas and anonymous functions are distinct ideas.

These ideas are commonly confused because in many programming languages (and lambda calculus) all lambdas are anonymous or vise verse.

In JavaScript, not all lambdas are anonymous, and not all anonymous functions are lambdas, so the distinction has some practical meaning.

@bhatmand
bhatmand / git.migrate
Created August 19, 2019 20:24 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@bhatmand
bhatmand / .block
Created September 3, 2019 12:29 — forked from kerryrodden/.block
Sequences sunburst
license: apache-2.0
@bhatmand
bhatmand / README.md
Created September 9, 2019 11:09 — forked from jocki84/README.md
scrollIntoViewIfNeeded 4 everyone!!!

Polyfill for scrollIntoViewIfNeeded()

This gist provides polyfill code for the [scrollIntoViewIfNeeded()][SIVIN] Element method found on WebKit browsers.

Features

There is no particular requirement on the position in the hierarchy of the