Skip to content

Instantly share code, notes, and snippets.

View nsisodiya's full-sized avatar

Narendra Sisodiya nsisodiya

View GitHub Profile
@nsisodiya
nsisodiya / output1.js
Last active May 16, 2017 13:04
async await parallel
$ node run1.js
1 Seconds
2 Seconds
3 Seconds
4 Seconds
detail { cash: 200, online: 100 }
5 Seconds
6 Seconds
7 Seconds
@nsisodiya
nsisodiya / jsbin.yecewaj.js
Last active February 25, 2017 06:51
Promise Based processing with Array. sequentialProcess and parallelProcess
//Author - Narendra Sisodiya - http://narendrasisodiya.com
//WHeN to use ? when async result from One Element is needed in another.
var sequentialProcess = function(arr, callback){
var pp = Promise.resolve();
arr.forEach(function(v, i, A){
pp = pp.then(function(){
return callback(v, i, A);
});
@nsisodiya
nsisodiya / gist:b7aac2f209c9bf03846a2899f9e2539d
Created January 3, 2017 06:50
Problem- Docker ENV variables are not passing up
$ echo "Environment Variable - EMAIL => $EMAIL, APP => $APP"
Environment Variable - EMAIL => narendra@narendrasisodiya.com, APP => chiptest
$ sudo docker run -e EMAIL -e APP -dit --name resin-chip-docker_server1 resin-chip-docker /bin/bash
1d3eb65a4bd7982f633657e693267a542dfbfd3dc82ac0605ad2cfef536a9519
$ sudo docker exec -i --user chip resin-chip-docker_server1 bash ./resin-chip/build.sh
Building Resin-Chip
/home/chip
Checking User
chip
////bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
@nsisodiya
nsisodiya / dmseg
Created December 28, 2016 06:17
dmesg log for Pine64 Ubuntu Linux BSP image by longsleep !
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.10.104-2-pine64-longsleep (longsleep@mose2) (gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.1) ) #113 SMP PREEMPT Thu Dec 15 21:46:07 CET 2016
[ 0.000000] CPU: AArch64 Processor [410fd034] revision 4
[ 0.000000] Machine: sun50iw1p1
[ 0.000000] cma: CMA: reserved 64 MiB at 7c000000
[ 0.000000] On node 0 totalpages: 258048
[ 0.000000] DMA zone: 3528 pages used for memmap
[ 0.000000] DMA zone: 0 pages reserved
@nsisodiya
nsisodiya / README.md
Last active October 22, 2016 17:09
How to make REST calls on Loopback API server with ES6 way + webpack

This is a Pure ES6 way to create XHR calls from client to loopback API server. This implmentation is not perfect but working for me for my app till now.

Ratedata.getLatestRateshopRates is a function and this will generate a POST request !

import React, {Component, PropTypes} from "react";
import FBConnectionObj from "../../services/FireBaseConnectionService";
class RealTimeVariable extends Component {
constructor(props, context) {
super(props, context);
this.state = {
value: null
};
FBConnectionObj.ref(this.props.path).on("value", (snapshot) => {
<RealTimeVariable path="accountsList" render={accountListRender}/>
import React from "react";
import loopObject from "loopobject";
import {CircularProgress} from "material-ui";
var iffun = function (condition, trueRet, falseRet) {
if (condition === true) {
if (typeof trueRet === "function") {
return trueRet();
}
return trueRet;
} else {
Nice presentatation.
1. If we developer a "Reusable React component" then develope outside of your main project repo.
2. https://www.npmjs.com/package/react-json-viewer help a lot to view props and state.
3. Always publish your reusable react components to npm
4. CSS modules are best for isoloating CSS for perticular component.
small blog entry - may be you would like it - https://medium.com/@nsisodiya/best-practices-we-followed-while-developing-web-applications-in-last-4-months-a66a76c65d0e