Skip to content

Instantly share code, notes, and snippets.

View pyadav's full-sized avatar
🐢
learning new stuff

Praveen Yadav pyadav

🐢
learning new stuff
View GitHub Profile
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var folders = {
APP: path.resolve(__dirname, '../app'),
BUILD: path.resolve(__dirname, '../build'),
BOWER: path.resolve(__dirname, '../bower_components'),
NPM: path.resolve(__dirname, '../node_modules')
};
@pyadav
pyadav / deployUser.md
Last active August 29, 2015 14:27 — forked from learncodeacademy/deployUser.md
Adding a deploy user in Linux

(wherever it says url.com, use your server's domain or IP)

Login to new server as root, then add a deploy user

sudo useradd --create-home -s /bin/bash deploy
sudo adduser deploy sudo
sudo passwd deploy

And Update the new password

@pyadav
pyadav / install-redis.sh
Last active September 4, 2015 07:32 — forked from dstroot/install-redis.sh
Install Redis on Amazon EC2 AMI
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
@pyadav
pyadav / Readme.md
Created December 27, 2015 15:32 — forked from gabrielemariotti/Readme.md
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@pyadav
pyadav / elasticsearch-cheatsheet.txt
Created March 11, 2016 05:22 — forked from stephen-puiszis/elasticsearch-cheatsheet.txt
Elasticsearch Cheatsheet - An Overview of Commonly Used Elasticsearch API Endpoints and What They Do
# Elasticsearch Cheatsheet - an overview of commonly used Elasticsearch API commands
# cat paths
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/indices
/_cat/indices/{index}
@pyadav
pyadav / build.gradle
Created July 31, 2016 16:58 — forked from Takhion/build.gradle
Automatic Java home (7/8) for Retrolambda with Gradle
String getJavaHome(String version)
{
def stdout = new ByteArrayOutputStream()
exec {
commandLine "/usr/libexec/java_home", "-v", version
standardOutput = stdout;
}
return stdout.toString().trim()
}
@pyadav
pyadav / SplashScreen.java
Created August 8, 2016 03:36 — forked from guptasanchit90/SplashScreen.java
Simple Splash screen
public class SplashScreen extends Activity {
private Handler mHandler;
private Runnable myRunnable;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Just create simple XML layout with i.e a single ImageView or a custom layout
app.run(function($window, $rootScope) {
$rootScope.online = navigator.onLine;
/**
Generate event offline when user disconnects from Internet
$scope.$watch('offline', function(newStatus) { ... });
**/
$window.addEventListener("offline", function() {
$rootScope.$apply(function() {
$rootScope.online = false;
@pyadav
pyadav / svgIcons.js
Created August 8, 2016 03:38 — forked from guptasanchit90/svgIcons.js
Directive to load SVG images from withing the code in Angular.js
var app = angular.module('MainApp', ['ngMaterial']);
var icons = {
refresh: "M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6zm6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26z",
share: "M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"
};
app.directive('svgIcon', function() {
function link(scope, element, attrs) {
@pyadav
pyadav / BatteryHelper.java
Created August 8, 2016 03:38 — forked from guptasanchit90/BatteryHelper.java
A wrapper class to provide battery information
import android.content.Intent;
import android.content.IntentFilter;
import android.os.BatteryManager;
import com.mobyta.mobilewebdashboard.ThisApplication;
public class BatteryHelper {
private Intent mBatteryDataIntent;