Skip to content

Instantly share code, notes, and snippets.

View puf's full-sized avatar

Frank van Puffelen puf

View GitHub Profile
@katowulf
katowulf / extend.js
Created September 17, 2013 18:06
A simple extend function for JavaScript
function extend(base) {
var parts = Array.prototype.slice.call(arguments, 1);
parts.forEach(function (p) {
if (p && typeof (p) === 'object') {
for (var k in p) {
if (p.hasOwnProperty(k)) {
base[k] = p[k];
}
}
}
public class FirebaseDataSnapshotMapper {
public static void map(Object object, DataSnapshot dataSnapshot) {
try {
final Class<?> aClass = object.getClass();
final Field[] fields = aClass.getDeclaredFields();
for (final Field classField : fields) {
if (classField.isAnnotationPresent(Firemapped.class)) {
classField.setAccessible(true);
final Firemapped annotation = classField.getAnnotation(Firemapped.class);
final DataSnapshot child = dataSnapshot.child(annotation.firebasePath());
@CodingDoug
CodingDoug / README.md
Last active August 3, 2023 16:41
Copying Data from a Google Sheet into Firebase Realtime Database in real time via Apps Script
@katowulf
katowulf / enable_debug_logging.java
Last active August 18, 2023 03:15
Enable debug logging in Firestore in Java, Javascript, or Swift.
/******* Android **********/
// See https://firebase.google.com/docs/reference/android/com/google/firebase/firestore/FirebaseFirestore.html#setLoggingEnabled(boolean)
FirebaseFirestore.setLoggingEnabled(true);
/******* Server-side Java **********/
/**
See https://medium.com/@hiranya911/logging-in-java-libraries-for-firebase-and-google-cloud-platform-f8742493b73f
1) Add the slf4j-simple binding to the application classpath
2) Set the -Dorg.slf4j.simpleLogger.defaultLogLevel=debug system property
**/