Skip to content

Instantly share code, notes, and snippets.

kirtan403

Block or report user

Report or block kirtan403

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
View FirebaseDatabaseConnectionHandler.java
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import com.google.firebase.database.FirebaseDatabase;
public class FirebaseDatabaseConnectionHandler implements Application.ActivityLifecycleCallbacks {
@kirtan403
kirtan403 / ContactUtils.java
Last active Dec 30, 2016
List android contacts quickly
View ContactUtils.java
// load the list of contacts with name, email and display photo of contacts
// who have either phone numebr or an email address stored on the device's
// contact book
public void loadContacts() {
// map to store and update the data as we loop through all type of data
HashMap<Integer, Friend> tempContacts = new LinkedHashMap<>();
// Loading All Contacts
final String[] PROJECTION = new String[]{
View android_material_design_colours.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
@kirtan403
kirtan403 / firebase_copy.js
Last active Sep 30, 2016 — forked from katowulf/firebase_copy.js
Move or copy a Firebase path to a new location
View firebase_copy.js
function copyFbRecord(oldRef, newRef) {
oldRef.once('value', function(snap) {
newRef.set( snap.val(), function(error) {
if( error && typeof(console) !== 'undefined' && console.error ) { console.error(error); }
});
});
}
@kirtan403
kirtan403 / HelloWorld.java
Last active Sep 17, 2016
Understanding the precision in Java and solving it with BigDecimal
View HelloWorld.java
import java.math.*;
public class HelloWorld {
public static void main(String[] args) {
// Double precision issue
double d1 = 0.01;
print("d1 = " + d1);
@kirtan403
kirtan403 / SubsetSumProblem.java
Last active Dec 11, 2016
Solving Subset Sum Problem
View SubsetSumProblem.java
public static boolean findSumFromList (ArrayList<Integer> set, Integer sum, ArrayList<Integer> result) {
// if sum=0, we have found a solution
if (sum == 0) {
System.out.println(result);
return true;
}
// Sum < 0. No point going forward in the path
if (sum < 0)
return false;
@kirtan403
kirtan403 / ghost-link
Last active Feb 9, 2018 — forked from hidrees/ghost-link
Ghost: Open links in new tab
View ghost-link
@kirtan403
kirtan403 / unzip.php
Last active Oct 18, 2019 — forked from jonmaim/zip.php
PHP script to remotely zip/unzip archives of your FTP
View unzip.php
<?php
function show($str){
echo $str . "<br/>\n";
flush();
ob_flush();
}
$archiveDir = "temp";
You can’t perform that action at this time.