Skip to content

Instantly share code, notes, and snippets.

package graph;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Stack;
/**
* @author Bazlur Rahman Rokon
* @since 12/27/16.
@zulhfreelancer
zulhfreelancer / first_commit_in_branch.md
Created December 2, 2016 04:11
How to find the first commit in a Git branch?
$ git log <source_branch>..<feature_branch> --oneline | tail -1

Reference

@sczerwinski
sczerwinski / MaterialColor.kt
Created July 22, 2016 14:04
Material Design colors palette in Kotlin
package pl.info.czerwinski
enum class MaterialColor(val tones: Map<Int, Int> = emptyMap(), val accentTones: Map<Int, Int> = emptyMap(), val singleColor: Int? = null) {
RED(
tones = mapOf(
50 to 0xFFEBEE,
100 to 0xFFCDD2,
200 to 0xEF9A9A,
300 to 0xE57373,
400 to 0xEF5350,
@ishu3101
ishu3101 / gist_to_github_repo.md
Created November 24, 2015 08:35
Transfer a gist to a GitHub repository

Transfer a gist to a GitHub repository

clone the gist

git clone https://gist.github.com/ishu3101/6fb35afd237e42ef25f9

rename the directory

mv 6fb35afd237e42ef25f9 ConvertTo-Markdown

change the working directory to the newly renamed directory

cd ConvertTo-Markdown

@hamakn
hamakn / height.java
Created April 6, 2015 02:41
Android: Get height of status, action, navigation bar (pixels)
// status bar height
int statusBarHeight = 0;
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
statusBarHeight = getResources().getDimensionPixelSize(resourceId);
}
// action bar height
int actionBarHeight = 0;
final TypedArray styledAttributes = getActivity().getTheme().obtainStyledAttributes(
@MarthzElena
MarthzElena / gist:4ad056bed9dfa90d57ad
Created January 13, 2015 00:08
IllegalStateException using Volley in Android
private void createComment(final String body, final String reportId, final boolean isAnon) {
Uri.Builder builder = new Uri.Builder();
builder.scheme(Constants.NETWORK_SCHEME)
.authority(Constants.API_ENDPOINT)
.path(Constants.CREATE_COMMENT_PATH);
final StringRequest request = new StringRequest(StringRequest.Method.POST, builder.build().toString(), new Response.Listener<String>() {
@Override
public void onResponse(String s) {
@leighmcculloch
leighmcculloch / Android Screenshot.bat
Created December 5, 2013 10:22
This batch script will take a screenshot on an Android device using ADB, download the screenshot to the directory this script to the current directory and then remove the screenshot file from the device. Screenshots are saved with filename: screenshot-YYYYMMDD-HHMMSS.png. ADB must be connected to a device already.
@echo off
rem configurable parameters
set SCREENCAP_FILE_PREFIX=screenshot
rem the dir on the device where the screenshot will be stored temporarily
set SCREENCAP_WORKING_DIR=/sdcard/
rem adb path, leave blank if adb is already on the user or system path
set SCREENCAP_ADB_PATH=
@ysb33r
ysb33r / RelativePath.groovy
Last active November 4, 2022 14:18
The Groovy way to obtain a relative path given two paths.
def root= new File('/usr/share')
def full= new File('/usr/share/docs/rpm-4.4')
// Print the relative path of 'full' in relation to 'root'
// Notice that the full path is passed as a parameter to the root.
def relPath= new File( root.toURI().relativize( full.toURI() ).toString() )