Skip to content

Instantly share code, notes, and snippets.

View Kurukshetran's full-sized avatar
🎯
Focusing

Kurukshetran Kurukshetran

🎯
Focusing
View GitHub Profile
@Kurukshetran
Kurukshetran / AsyncTaskExecutionHelper.java
Created August 25, 2016 10:43 — forked from markus2610/AsyncTaskExecutionHelper.java
Helper bringing back parallel execution for AsyncTask (you are no serial execution and pseudo threading wimp, right?). Uses level 11 APIs when possible.
package de.greenrobot.util;
import java.util.concurrent.Executor;
import android.os.AsyncTask;
import android.os.Build;
/**
* Uses level 11 APIs when possible to use parallel/serial executors and falls back to standard execution if API level
* is below 11.
@Kurukshetran
Kurukshetran / MainActivity.java
Created August 25, 2016 20:51 — forked from fbis251/MainActivity.java
Android Glide + okhttp progress example
package com.example.glidetest.app;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.ImageView;
import android.widget.ProgressBar;
import com.bumptech.glide.Glide;
import com.bumptech.glide.integration.okhttp.OkHttpUrlLoader;
@Kurukshetran
Kurukshetran / introrx.md
Created August 26, 2016 14:28 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
package com.javaforu.rsync;
import com.javaforu.rsync.Sync.CharRingBuffer.Visitor;
import rollinghash.RabinKarpHash;
import java.util.*;
import java.util.zip.CRC32;
/**
* Author: Ashwin Jayaprakash / [email protected] / http://www.ashwinjayaprakash.com
@Kurukshetran
Kurukshetran / InstagramLikeColorTransition.txt
Created September 1, 2016 15:05 — forked from deepak786/InstagramLikeColorTransition.txt
Instagram Like Gradient Color Transition in Android
/******This Gist explains how to create instagram like Gradient color transition in android.******/
1. Create some gradient color drawables inside drawable Folder.
a) color1.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#c44e4e"
android:endColor="#dcb9b9"
android:angle="0"/>
@Kurukshetran
Kurukshetran / Readme.md
Created September 11, 2016 14:30 — 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:

@Kurukshetran
Kurukshetran / Setup.md
Created September 14, 2016 00:51 — forked from suvozy/Setup.md
Setup AWS EC2 and RDS (php5.5, apache2.4, mysql5.5, phpmyadmin)
@Kurukshetran
Kurukshetran / app.js
Created December 3, 2016 21:47 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authorize from "./authorization"; // middleware for doing authorization
import permit from "./permission"; // middleware for checking if user's role is permitted to make request
let app = express(),
api = express.Router();
// first middleware will setup db connection
@Kurukshetran
Kurukshetran / PinblockTool.java
Created January 9, 2017 15:53 — forked from Gilmor/PinblockTool.java
Pinblock ISO 9564 format 0
package cz.monetplus.mnsp.tools.misc;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.lang.StringUtils;
/**
* Tools for encoding a decoding pinblock
*
* @author Tomas Jacko <tomas.jacko [at] monetplus.cz>
@Kurukshetran
Kurukshetran / gist:fb27d4060e7d8b2d43f9656d444886b1
Created January 26, 2017 06:10 — forked from dirkk0/gist:5967221
Enabling CORS in Angular JS with NodeJS/Express
// in AngularJS (client)
myApp.config(['$httpProvider', function($httpProvider) {
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
}]);
// in Express/nodeJS