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 / 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 \
@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 / 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 / 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 / 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 / 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 / inherits.js
Created November 14, 2016 02:04
Javascript Inheritance
/**
* Created by intelligrape on 17/7/14.
*/
Function.prototype.inherits = function (parent) {
"use strict";
this.prototype = new parent();
this.constructor = this;
this.prototype.parent = parent.prototype
}
function User(name) {
@deepakshrma
deepakshrma / PrioritySorting.js
Last active November 12, 2016 07:49
PrioritySorting
//Problem to sort and get port with minimum bandwith, based on switch priority(Select same switch first)
var ports = [{
id: 1,
switch: 'a',
availableBandWidth: 500
},{
id: 2,
switch: 'b',
availableBandWidth: 10
},{
@deepakshrma
deepakshrma / Mapper.js
Last active April 9, 2020 11:19
Mapper.js - A small design pattern to avoid m x n loop back while finding some object from object array
/*
*
The MIT License (MIT)
Copyright (c) 2014 deepakshrma
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@deepakshrma
deepakshrma / .eslintrc.json
Last active December 22, 2020 14:58
.eslintrc.json- Basic configuration for ESLint
{
"env": {
"node": true
},
"globals":{
"anyglobal":true
},
"extends": "eslint:recommended",
"rules": {
"accessor-pairs": "error",