This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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[]{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); } | |
}); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.*; | |
public class HelloWorld { | |
public static void main(String[] args) { | |
// Double precision issue | |
double d1 = 0.01; | |
print("d1 = " + d1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// By default, Ghost opens links in the existing tab. | |
// Insert this in your Ghost code injection footer | |
// to get all your links to open in a new tab instead! | |
$(document).ready(function() { | |
$('a[href^=http]').each(function() { | |
// Get the current host and replace '.' with '\.' | |
var regex = '/' + window.location.host + '/'; | |
regex = regex.replace(/\./g,'\\\.'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function show($str){ | |
echo $str . "<br/>\n"; | |
flush(); | |
ob_flush(); | |
} | |
$archiveDir = "temp"; |