Skip to content

Instantly share code, notes, and snippets.

View shishirarora3's full-sized avatar

shishir arora shishirarora3

  • Microsoft Corporation
  • bangalore, india
View GitHub Profile
Javascript:
No react lifecycle hooks (we can allow some cases in PR).
viz. componentWillReceiveProps(), shouldComponentUpdate(), componentWillUpdate(), componentDidUpdate().
Components should have 90% html.
viz.: only render method, constructor,componentWill/DidMount
Business logic allowed only in Actions (all set logic) and selectors (all get logic).
FLATTEN ARRAY
var flat = (arr)=>arr.reduce((r,a)=>Array.isArray(a)?[...r,...flat(a)]:[...r,a],[]);
console.log(flat([[8,9],7,[1],[8],[]]));
console.log(flat([{f:7},{a:6},[4,2,{}]]));
angular.element($0).scope();
var imgEls = '';
var queueCounter = 0;
var currentCounter = 0;
document.body.innerHTML = '<h1>Results</h1>';
var callIfRequiredConfigured = ({cb,end,step=1,pageURL,pageId='Page'})=>callIfRequired = ()=>{
currentCounter = currentCounter + step;
if (currentCounter > end) {
return;
}
(async(currentCounter)=>{
var imgEls = '';
var queueCounter = 0;
var currentCounter = 0;
document.body.innerHTML = '<h1>Results</h1>';
var callIfRequiredConfigured = ({cb,end,step=1,pageURL,pageId='Page'})=>callIfRequired = ()=>{
currentCounter = currentCounter + step;
if (currentCounter > end) {
return;
}
(async(currentCounter)=>{
@shishirarora3
shishirarora3 / index.html
Created August 27, 2017 21:43
React ToDo Tree
<div id="app"></app>
@shishirarora3
shishirarora3 / index.html
Created December 27, 2017 22:07
AngularJS Tutorials // source https://jsbin.com/diruki
<!DOCTYPE html>
<html>
<head>
<title>AngularJS Tutorials</title>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/foundation/5.4.7/css/foundation.css">
</head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.2/angular.js"></script>
<body>
<div ng-app="myApp">
var providerSelector = document.querySelector("article");
window.FindReact = function(dom) {
for (var key in dom) {
if (key.startsWith("__reactInternalInstance$")) {
var compInternals = dom[key]._currentElement;
var compWrapper = compInternals._owner;
var comp = compWrapper._instance;
return comp;
}
TODO: LEARN:-
Learn about web security csrf etc, express-session, express-jwt-session
Difference between web socket and http
Service-worker
Mongodb
https://codeburst.io/why-you-don-t-need-socket-io-6848f1c871cd
https://blogs.adobe.com/creativecloud/a-primer-to-background-positioning-in-css/
https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch5.md
https://medium.com/@nicknauert/mongooses-model-populate-b844ae6d1ee7 => mongoose
turn_off_js=true
if(!('bind' in Function.prototype)){
Function.prototype.bind = function() {
var fn = this;
var context = arguments[0];
var args = Array.prototype.slice.call(arguments, 1);
return function() {
return fn.apply(context, args.concat([].slice.call(arguments)));
}
}
}
@shishirarora3
shishirarora3 / index.html
Created November 12, 2018 10:54
AngularJS Tutorials // source https://jsbin.com/johaye
<!DOCTYPE html>
<html>
<head>
<title>AngularJS Tutorials</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.2/angular.js"></script>
</head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.3/css/foundation.css">
<body>
<div ng-app="app">