Skip to content

Instantly share code, notes, and snippets.

:octocat:
Busy in a long-due side project. Coming along great now 😄

Wajahat Karim wajahatkarim3

:octocat:
Busy in a long-due side project. Coming along great now 😄
Block or report user

Report or block wajahatkarim3

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wajahatkarim3
wajahatkarim3 / ConstraintLayoutLiveTemplates.csv
Last active Aug 29, 2019
A table for ConstraintLayout live templates
View ConstraintLayoutLiveTemplates.csv
Abbrevation Description
center Centers any view in the parent horizontally and vertically
centerh Centers any view horizontally in the parent
centerv Centers any view vertically in the parent
vertical Centers any view vertically in any other view
horizontal Centers any view horizontally in any other view
fill Fills any view on all edges to parent
over Puts any view over an other view by setting same constrains as the original view. Works like fill but for any other view
above Puts any view above another view
below Puts any view below another view
@wajahatkarim3
wajahatkarim3 / ActivitiesLaunchingWay.kt
Last active Sep 12, 2019
Kotlin Extensions for simpler, easier and funw way of launching of Activities
View ActivitiesLaunchingWay.kt
/**
* Kotlin Extensions for simpler, easier and funw way
* of launching of Activities
*/
inline fun <reified T : Any> Activity.launchActivity (
requestCode: Int = -1,
options: Bundle? = null,
noinline init: Intent.() -> Unit = {})
{
@wajahatkarim3
wajahatkarim3 / bintrayv1.gradle
Created Aug 16, 2018
JCenter Uploading Scripts
View bintrayv1.gradle
apply plugin: 'com.jfrog.bintray'
version = libraryVersion
if (project.hasProperty("android")) { // Android libraries
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
View splash_drawable.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/colorPrimary"/>
<item
android:drawable="@drawable/bg_watermark" />
<item android:bottom="@dimen/_70sdp"
@wajahatkarim3
wajahatkarim3 / root build.gradle
Last active Jun 28, 2018
Publishing your Android, Kotlin or Java library to jCenter from Android Studio
View root build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// Add These Bintray and Maven Gradle Classpaths
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
}
View LogCodeDebugTree.java
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import timber.log.Timber;
public class LinkingDebugTree extends Timber.DebugTree {
private static final int CALL_STACK_INDEX = 4;
private static final Pattern ANONYMOUS_CLASS = Pattern.compile("(\\$\\d+)+$");
View MainActivity.java
package com.wajahatkarim3.chipsdemo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.MultiAutoCompleteTextView;
import com.android.ex.chips.RecipientEditTextView;
import com.tokenautocomplete.TokenCompleteTextView;
public class MainActivity extends AppCompatActivity {
@wajahatkarim3
wajahatkarim3 / KIntent.kt
Created Feb 27, 2018 — forked from passsy/KIntent.kt
Kotlin extension functions to start a generic Activity
View KIntent.kt
package com.pascalwelsch.extensions
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
/**
* Extensions for simpler launching of Activities
@wajahatkarim3
wajahatkarim3 / MainActivity.kt
Created Jan 22, 2018
The onDisconnect() hook to make user offline
View MainActivity.kt
fun makeUserOnline(user: UserModel)
{
// Adding on disconnect hook
FirebaseDatabase.getInstance().getReference("/status/" + user.userId)
.onDisconnect() // Set up the disconnect hook
.setValue("offline");
}
@wajahatkarim3
wajahatkarim3 / index.js
Created Jan 22, 2018
Firebase Cloud Function for User Presence Demo
View index.js
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
const firestore = functions.firestore;
exports.onUserStatusChange = functions.database
.ref('/status/{userId}')
.onUpdate(event => {
You can’t perform that action at this time.