Skip to content

Instantly share code, notes, and snippets.

View hiranya911's full-sized avatar

Hiranya Jayathilaka hiranya911

View GitHub Profile
var admin = require('firebase-admin');
admin.initializeApp({
credential: admin.credential.applicationDefault(),
databaseURL: 'https://database-name.firebaseio.com'
});
{
"databaseURL": "https://database-name.firebaseio.com",
"projectId": "my-project-id",
"storageBucket": "bucket-name.appspot.com"
}
var admin = require('firebase-admin');
admin.initializeApp();
import asyncio
import time
from firebase_admin import db
async def get_hero(key):
ref = db.reference('heroes').child(key)
# Calling a blocking method from a coroutine
return ref.get()
import asyncio
import concurrent.futures
import time
from firebase_admin import db
executor = concurrent.futures.ThreadPoolExecutor(max_workers=20)
async def get_hero(key, event_loop):
ref = db.reference('heroes').child(key)
handlers=java.util.logging.ConsoleHandler
.level=INFO
com.google.level=FINE
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s %2$s %5$s%6$s%n
.level=INFO
com.google.firebase.level=FINE
java.util.logging.SimpleFormatter.format='%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s %2$s %5$s%6$s%n'
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>${app.id}</application>
<version>${app.version}</version>
<threadsafe>true</threadsafe>
<runtime>java8</runtime>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>
const admin = require('firebase-admin');
admin.initializeApp();
const message = {
notification: {
title: 'EPA fuel economy stats for new Mazda6',
body: 'New turbo charged 2.5L engine does 23/31/36 mpg.',
},
condition: `'auto-news' in topics && 'green-earth' in topics`,
private static final String ANDROID_NEWS_ICON_RESOURCE = "news_alert_icon";
private static final int APNS_NEWS_BADGE_RESOURCE = 42;
private static final String WEBPUSH_NEWS_ICON_URL = "https://auto.news.url/alert.png";
public String sendAutoNewsAlert(String title, String body) throws Exception {
Message message = Message.builder()
.setNotification(new Notification(title, body))
.setAndroidConfig(AndroidConfig.builder()
.setNotification(AndroidNotification.builder()
.setIcon(ANDROID_NEWS_ICON_RESOURCE)