Skip to content

Instantly share code, notes, and snippets.

View Hafiz-Waleed-Hussain's full-sized avatar

Hafiz Waleed Hussain Hafiz-Waleed-Hussain

View GitHub Profile
#!/bin/sh
CMD="./gradlew clean testDebugUnitTest"
# Check if we actually have commits to push
commits=`git log @{u}..`
if [ -z “$commits” ]; then
exit 0
fi
$CMD
RESULT=$?
if [ $RESULT -ne 0 ]; then
@Hafiz-Waleed-Hussain
Hafiz-Waleed-Hussain / Commit Message Hook
Created March 18, 2018 06:32
Commit Message Hook Script
#!/bin/sh
msg=`head -n 1 $1`
if echo $msg | egrep -qv '(Android-\d{3,4}.{20,})'; then
echo "[Message Format] Your message is not formatted correctly. Correct message format\n
#Ticket Number - Minimum 20 or more Character \n
like #Android-123 Bug fixed for login issue"
exit 1;
fi
@Hafiz-Waleed-Hussain
Hafiz-Waleed-Hussain / ArrayOfInteger.java
Created March 12, 2017 12:09
ArrayOfInteger using Rx Java 2 Android.
package async.waleed.rx;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import io.reactivex.Observable;
public class MainActivity extends AppCompatActivity {
@Hafiz-Waleed-Hussain
Hafiz-Waleed-Hussain / build.gradle
Created March 12, 2017 12:06
App level gradle for Android Examples.
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "async.waleed.rx"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
@Hafiz-Waleed-Hussain
Hafiz-Waleed-Hussain / build.gradle
Created March 12, 2017 12:05
Project level gradle for Android Examples
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'me.tatarka:gradle-retrolambda:3.4.0'
@Hafiz-Waleed-Hussain
Hafiz-Waleed-Hussain / HelloWorldStream.java
Created March 12, 2017 11:16
HelloWorldStream using Rx Java 2 Android.
package async.waleed.rx;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.Observable;
@Hafiz-Waleed-Hussain
Hafiz-Waleed-Hussain / HelloWorldStream.java
Created March 12, 2017 11:14
HelloWorldStream using Java8 API example.
import java.util.ArrayList;
import java.util.List;
/**
* Created by waleed on 12/03/2017.
*/
public class HelloWorldStream {
public static void main(String [] args){
@Hafiz-Waleed-Hussain
Hafiz-Waleed-Hussain / WaterStream.java
Last active March 12, 2017 11:11
Water stream example code.
import java.util.ArrayList;
import java.util.function.Function;
import java.util.function.Predicate;
/**
* Created by waleed on 12/03/2017.
*/
public class WaterStream {