Skip to content

Instantly share code, notes, and snippets.

View irfaan008's full-sized avatar

Irfan Raza irfaan008

View GitHub Profile
@irfaan008
irfaan008 / EnableGpsAutomaticallyInAndroid.java
Last active June 25, 2020 10:26
Enable Gps automatically if it is turned off. Similar to what OLA cab does. However to comply with policy it shows a popup to user with OK and CANCEL button. Still its better than showing location setting screen to user
package com.irinnovative.enablegps;
import android.app.Activity;
import android.content.Intent;
import android.content.IntentSender;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.android.gms.common.api.GoogleApiClient;
@irfaan008
irfaan008 / Android Privacy Policy Template
Last active February 13, 2017 10:07 — forked from alphamu/Android Privacy Policy Template
A template for creating your own privacy policy for Android apps. Look for "[" and "<!--" to see where you need to edit this app in order to create your own privacy olicy.
<html>
<body>
<h2>Privacy Policy</h2>
<p>[Individual or Company Name] built the [App Name] app as a [open source | free | freemium | ad-supported | commercial] app. This SERVICE is provided by [Individual or company name] [at no cost] and is intended
for use as is.</p>
<p>This page is used to inform app users regarding [my|our] policies with the collection, use, and
disclosure of Personal Information if anyone decided to use [my|our] Service.</p>
<p>If you choose to use [my|our] Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that [I|we] collect are used for providing and
improving the Service. [I|We] will not use or share your information with anyone except as described
@irfaan008
irfaan008 / deepClone.js
Created August 17, 2018 20:44
Deep Copying javascript objects/properties
// Problem Statement :
// Write a function called deepClone which takes an object and creates a copy of it.
// e.g. {name: "Paddy", address: {town: "Lerum", country: "Sweden"}} -> {name: "Paddy", address: {town: "Lerum", country: "Sweden"}}
// Solution
// This file shows ability of multiple approach with their advantages and disadvantages and 2 fully tested and working approach.
// One has been written by me and another has been received from community to showcase that self written code is more concise and readable.
// Just run this file in Node Js environment to get the result.
// To run test cases, un comment method named test() in the bottom of file