-
Create New Project
-
Select Java and Web from the Option
-
You will be asked to provide GroupID and ArtifactID
- GroupID: it will identify your project uniquely across all projects. (E.g. com.project.model | com.project.plugins)
type SharedWithInviteRequest { | |
........ | |
createdDate: RateLimiting | |
} | |
// in order to write a message, I must first make an entry in users/${uid}/rate_limiting/{feature} is Number | |
// additionally, that message must be within 500ms of now, which means I can't | |
// just re-use the same one over and over, thus, we've effectively required messages | |
// to be 5 seconds apart | |
type RateLimiting extends Number { |
function upload(file) { | |
var imageLink =""; | |
/* Is the file an image? */ | |
if (!file || !file.type.match(/image.*/)) return; | |
var fd = new FormData(); | |
fd.append("image", file); // Append the file | |
fd.append("key", "<Imgur API key>"); |
exports.updateFeed = functions.database.ref('/stories/{userId}/{storyId}').onWrite(event => { | |
const userId = event.params.userId; | |
const storyId = event.params.storyId; | |
let followersRef = admin.database().ref('/followers/'+userId); | |
if(!event.data.val()){ | |
//post was deleted | |
followersRef.once("value", function(snap) { | |
snap.forEach(function(childSnapshot) { | |
let followerId = childSnapshot.key; |
const functions = require("firebase-functions") | |
const cors = require("cors") | |
const express = require("express") | |
/* Express with CORS & automatic trailing '/' solution */ | |
const app3 = express() | |
app3.use(cors({ origin: true })) | |
app3.get("*", (request, response) => { | |
response.send( | |
"Hello from Express on Firebase with CORS! No trailing '/' required!" |
@Override | |
public boolean onPrepareOptionsMenu(Menu menu) { | |
MenuItem settingsMenuItem = menu.findItem(R.id.action_settings); | |
SpannableString s = new SpannableString(settingsMenuItem.getTitle()); | |
s.setSpan(new ForegroundColorSpan(yourColor), 0, s.length(), 0); | |
settingsMenuItem.setTitle(s); | |
return super.onPrepareOptionsMenu(menu); | |
} |
//author: laoyur | |
//inspired of http://stackoverflow.com/a/31021154 | |
package com.laoyur.test; | |
import java.util.List; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.graphics.Rect; | |
import android.os.Bundle; | |
import android.view.MotionEvent; | |
import android.view.View; |
var db = firebase.firestore(); | |
var content = require("./sourceData.json"); | |
content && | |
Object.keys(content).forEach(contentKey => { | |
const nestedContent = content[contentKey]; | |
if (typeof nestedContent === "object") { | |
Object.keys(nestedContent).forEach(docTitle => { | |
firebase | |
.firestore() |
import androidx.compose.animation.animatedFloat | |
import androidx.compose.animation.core.AnimationConstants | |
import androidx.compose.animation.core.LinearEasing | |
import androidx.compose.animation.core.repeatable | |
import androidx.compose.animation.core.tween | |
import androidx.compose.foundation.Canvas | |
import androidx.compose.material.MaterialTheme | |
import androidx.compose.runtime.Composable | |
import androidx.compose.runtime.onActive | |
import androidx.compose.ui.Modifier |
const service = 'firestore.googleapis.com'; | |
// Note: We avoid importing firebase-functions because we don't want to slow down startup times. | |
type Change<T> = any; | |
type DocumentSnapshot = any; | |
type EventContext = any; | |
type CloudFunction<T> = any; | |
/** | |
* Creates an onWrite function for use as a Firestore onWrite callback. Replaces functions.firestore.document().onWrite(). | |
* @param projectId the Firebase project id for the entire project (e.g. "foo-123"). | |
* @param path a Firestore path such as "usernames/{username}" |