Skip to content

Instantly share code, notes, and snippets.

View joshuacoda's full-sized avatar

Joshua William Coda joshuacoda

View GitHub Profile
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
class Event {
const Event({
required this.id,
required this.creatorId,
required this.attendeeIds,
});
@abhishek0196
abhishek0196 / index.ts
Last active July 5, 2022 20:39
Copying data from Firebase Firestore to a Google Sheet in real time via Cloud Functions
import * as functions from 'firebase-functions'
import * as _ from 'lodash'
import { google } from 'googleapis'
const sheets = google.sheets('v4')
import * as admin from 'firebase-admin';
admin.initializeApp();
const spreadsheetId = '' // Your Sheets ID
@quangnd
quangnd / reduceExamples.js
Last active November 24, 2023 19:57
Some examples about reduce() in Javascript
//Example 1 - Calculate average value of an array (transform array into a single number)
var scores = [89, 76, 47, 95]
var initialValue = 0
var reducer = function (accumulator, item) {
return accumulator + item
}
var total = scores.reduce(reducer, initialValue)
var average = total / scores.length
/*Explain about function
@jonlabelle
jonlabelle / string-utils.js
Last active May 5, 2024 19:44
Useful collection of JavaScript string utilities.
// String utils
//
// resources:
// -- mout, https://github.com/mout/mout/tree/master/src/string
/**
* "Safer" String.toLowerCase()
*/
function lowerCase(str) {
return str.toLowerCase();