Skip to content

Instantly share code, notes, and snippets.

View Zulqurnain's full-sized avatar
🎯
Focusing

Zulqurnain Haider Zulqurnain

🎯
Focusing
  • Rave Business Systems LLC
  • Lahore, Pakistan
View GitHub Profile
@Zulqurnain
Zulqurnain / StreamMusicPlayerService.kt
Last active September 7, 2021 08:30
Simple music service using native music player and play any kind of online stream url
import android.app.Service
import android.content.Intent
import android.media.AudioManager
import android.media.MediaPlayer
import android.media.MediaPlayer.OnPreparedListener
import android.os.IBinder
import androidx.annotation.Nullable
import java.io.IOException
/**
@Zulqurnain
Zulqurnain / image_text_item.xml
Created March 27, 2018 04:49
Simple Image and Text list item , because you know very common code is uncommon on github ;)
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.AppCompatImageView
@Zulqurnain
Zulqurnain / Truss.java
Created March 19, 2018 00:56 — forked from JakeWharton/Truss.java
Extremely simple wrapper around SpannableStringBuilder to make the API more logical and less awful. Apache 2 licensed.
import android.text.SpannableStringBuilder;
import java.util.ArrayDeque;
import java.util.Deque;
import static android.text.Spanned.SPAN_INCLUSIVE_EXCLUSIVE;
/** A {@link SpannableStringBuilder} wrapper whose API doesn't make me want to stab my eyes out. */
public class Truss {
private final SpannableStringBuilder builder;
private final Deque<Span> stack;
@Zulqurnain
Zulqurnain / RiseNShine.java
Last active March 19, 2018 00:43 — forked from JakeWharton/gist:f50f3b4d87e57d8e96e9
Rise and Shine™, unlock and wake up your device automatically when you deploy from the IDE. Put this somewhere in your `src/debug/` code and run it when the application or main activity starts. Apache 2.
/**
* Show the activity over the lockscreen and wake up the device. If you launched the app manually
* both of these conditions are already true. If you deployed from the IDE, however, this will
* save you from hundreds of power button presses and pattern swiping per day!
*/
public static void riseAndShine(Activity activity) {
activity.getWindow().addFlags(FLAG_SHOW_WHEN_LOCKED);
PowerManager power = (PowerManager) activity.getSystemService(POWER_SERVICE);
PowerManager.WakeLock lock =
@Zulqurnain
Zulqurnain / YoutubeUtils.java
Last active March 19, 2018 00:25
Play Youtube Video Using WebView
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
/**
* Created by Zulqurnain on 19/03/2018.
*/
public class YoutubeUtils {
@Zulqurnain
Zulqurnain / RxFirebase.java
Created November 14, 2016 12:07 — forked from TinasheMzondiwa/RxFirebase.java
RxFirebase implementation. Fork from https://gist.github.com/gsoltis/86210e3259dcc6998801 with my improvements.
import com.google.android.gms.tasks.Task;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import rx.Observable;
import rx.Subscriber;
package rx.android.observables;
import rx.Observable;
import rx.Observable.OnSubscribe;
import rx.Subscriber;
import rx.android.subscriptions.AndroidSubscriptions;
import rx.functions.Action0;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@Zulqurnain
Zulqurnain / C++: Find matrix is Symmetricor not
Created August 5, 2014 19:58
C++ program to find that given N*M matrix is symmatric or anti symmetric.
#include <stdio.h>
#include<iostream>
#include <Windows.h>
using namespace std;
int main(){
int rows, col, i, j;
cout << "Enter Number of Rows of Matrix :=:"; cin >> rows; cout << "\n";
cout << "Enter Number of coloumns of Matrix :=:"; cin >> col; cout << "\n";
@Zulqurnain
Zulqurnain / C++ : BinaryTree.h
Created May 31, 2014 12:27
BinaryTree.h template type class containing functionalities of binary tree
#include <iostream>
#include <conio.h>
using namespace std;
/*******************************************************************************************************/
/*******************************************************************************************************/
/******************************** Node of Template Type ********************************************/
/*******************************************************************************************************/
/*******************************************************************************************************/
template<typename T>
@Zulqurnain
Zulqurnain / [Assembly] Finding Largest Number In Array
Created April 6, 2014 19:59
[Assembly] Write a procedure in Assembly Language that finds a largest number in an array and store it in AX, assume that array offset is in BX and array length is in CX.
.model small ;preprocessors
data_seg segment 'data'
vargaye dw 1,0,5,8,3
data_seg ends
stack_seg segment 'stack'
db 100h dup(?)