Skip to content

Instantly share code, notes, and snippets.

View deepakshrma's full-sized avatar
🎯
Focusing

Deepak Vishwakarma deepakshrma

🎯
Focusing
View GitHub Profile
@deepakshrma
deepakshrma / oracledb.js
Created May 2, 2017 02:54
Node Oracledb Wrapper
"use strict";
var oracledb = require('oracledb');
var Promise = require('bluebird');
var _ = require('lodash');
var EventEmitter = require('events');
var util = require('util');
var async = require('async');
var NodeDBConnection = require('./NodeDBConnection');
var log ;
function validateConfig(config) {
@deepakshrma
deepakshrma / Awesome Libs.sh
Last active June 20, 2018 17:04
Android Studio
## Networking
https://loopj.com/android-async-http/
https://github.com/koush/ion
https://github.com/square/okhttp
https://github.com/square/retrofit
## Images:
https://github.com/bumptech/glide
https://github.com/koush/ion
http://square.github.io/picasso/
@deepakshrma
deepakshrma / React Awesome Tools.sh
Last active November 20, 2018 18:19
React Awesome Tools
## Testing
https://www.sitespeed.io/
https://docs.cypress.io
## Guideline
https://github.com/airbnb/javascript/tree/master/react
## Performace
https://building.calibreapp.com/debugging-react-performance-with-react-16-and-chrome-devtools-c90698a522ad
https://www.keycdn.com/blog/react-performance
@deepakshrma
deepakshrma / async-design-pattern.js
Last active January 13, 2019 16:39
JS_Problem_1: Read files in parallel and print result sequentially(Async Thunk/Promise Pattern: JS Advance)
/**
* Fake read file function
* @param {*} name : name of file to read
* @param {data} cb : content of the file
*/
const readFile = (type, name, cb) => {
const time = Math.floor(Math.random() * 10 * 1000);
const fn = cb.bind(null, `{ type: ${type}, name: ${name}, data: "${name + '_' + time}ms"}`);
console.log(`fetching file: ${name} of ${type} in ${time}ms...`)
setTimeout(fn, time)
@deepakshrma
deepakshrma / shell.sh
Created April 13, 2019 04:42
My Shell command, Run continuous commands in given shell.
#!/bin/bash
COMMAND=$1
RESET="\033[0m"
BOLD="\033[1m"
YELLOW="\033[38;5;11m"
echo "running in $COMMAND shell mode"
while read -r -p "$(echo -e $BOLD$YELLOW"$COMMAND>"$RESET)"
do
if [ "$REPLY" == "quit" ]; then
echo "Quiting $COMMAND shell"
@deepakshrma
deepakshrma / Dockerfile
Last active December 8, 2019 21:00
Dockerfile
FROM gradle:latest
# FROM openjdk:8-jre-alpine
USER root
# RUN apk --no-cache add curl
ENV SDK_URL="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip" \
ANDROID_HOME="/usr/local/android-sdk" \
ANDROID_VERSION=28 \
ANDROID_BUILD_TOOLS_VERSION=29.0.2
# Download Android SDK
RUN mkdir "$ANDROID_HOME" .android \
const http = require("http");
const fs = require("fs");
function main() {
const server = http.createServer((req, res) => {
// console.time("START:NODE");
fs.createReadStream("./test1.txt")
.pipe(res)
// .on("finish", () => {
// console.timeEnd("START:NODE");
package main
import (
"io"
"net/http"
"os"
)
func check(e error) {
if e != nil {
@deepakshrma
deepakshrma / traditional_for_while_loop.js
Created January 20, 2020 15:00
Weird Part: How to break the LOOP in JavaScript
// For
function howMany(selectObject) {
let numberSelected = 0;
for (let i = 0; i < selectObject.options.length; i++) {
if (selectObject.options[i].selected) {
numberSelected++;
}
}
return numberSelected;
}
@deepakshrma
deepakshrma / labeledLoop.js
Created January 20, 2020 15:05
[labeledLoop] Weird Part: How to break the LOOP in JavaScript
function labeledLoop() {
let x = 0;
let z = 0;
outer: while (true) {
console.log("Outer loops: " + x);
x += 1;
z = 1;
while (true) {
console.log("Inner loops: " + z);
z += 1;