Skip to content

Instantly share code, notes, and snippets.

View gregfenton's full-sized avatar

Greg Fenton gregfenton

View GitHub Profile

PROMPT TO CHAT_GPTS_THINGY:

(as a followup to this question):

But the Firebase SDK for Unity does not support Windows. I need to support Windows.

RESPONSE:

You're correct that the Firebase SDK for Unity does not natively support Windows Desktop. To implement Firebase Authentication with Epic's OpenID on Windows in Unity, you'll need a workaround that leverages Firebase's REST API for authentication instead. Here’s how you can set this up.

QUESTION ASKED OF THE CHAT-GPT-THINGY:


How can i get a unity game to log into Firebase Authentication that has an integration to Epic's OpenID connector?

RESPONSE FROM THE CHAT-GPTs:


To integrate Firebase Authentication with Epic Games’ OpenID connector in a Unity game, you'll need to set up Firebase Authentication for custom authentication and use Epic Games as an external identity provider. Here’s a step-by-step guide on how to do it.

@gregfenton
gregfenton / restore-uistate.jsx
Created March 8, 2024 21:46
Algolia react-instantsearch code not working correctly
<InstantSearch
indexName={ALGOLIA_INDEX_PROJECT}
searchClient={searchClient}
routing={routing}
future={{
preserveSharedStateOnUnmount: true,
}}
onStateChange={({uiState, setUiState}) => {
if (firstRender.current) {
firstRender.current = false;
@gregfenton
gregfenton / create-alerts.js
Created February 10, 2024 17:57
Failing attempt at using @google-cloud/monitoring to add LogEvent policies -- API does not currently support it
// This code fails with the error described in:
// https://github.com/googleapis/google-cloud-node/issues/4361
//
// The Node/JS version of the SDK currently does not support adding LogEvent policies.
//
//
// To run this code:
// - save to a file (e.g. "create-alerts.js")
// - be logged into your gcloud account (`gcloud auth login`)
// - set the env var `PROJ_ID` with your project ID
@gregfenton
gregfenton / functions--index.ts
Last active February 7, 2024 16:43
`index.ts` for my Cloud Functions project that load other CF files dynamically from the directory structure
/*
* This file is used to dynamically import and export functions from the `fs`, `http`, `sched`, and `storage` directories.
* The exported functions are then used in the `index.ts` file to define the Cloud Functions.
*
* Only files with the extension `.f.ts` are imported and exported (well, `.f.js` after `tsc` has run).
*
* Concept for this is inspired by https://codeburst.io/organizing-your-firebase-cloud-functions-67dc17b3b0da
* -- Thank you @TarikHuber !!
*/
import * as fs from 'fs';
@gregfenton
gregfenton / create_firebase_project.bash
Last active June 16, 2023 23:04
Shell script for creating a Firebase project
#!/bin/bash
red=$(tput setaf 1)
green=$(tput setaf 2)
blue=$(tput setaf 6)
yellow=$(tput setaf 3)
reset=$(tput sgr0)
ROOT=$(pwd)
echo ""
@gregfenton
gregfenton / i18NextFirestoreProvider.js
Created May 15, 2022 01:28
An example Context API provider for use with the i18next-node-firestore-backend
import React, {createContext, useEffect, useState} from "react";
import i18next from "i18next";
import {initReactI18next} from "react-i18next";
import Backend from "i18next-node-firestore-backend";
import {FIRESTORE} from "../myFirebase";
// export const I18NEXT_FS_BKEND_LANGUAGE_LIST_FIELD_NAME = 'languages';
const I18NEXT_DEFAULT_NAMESPACE = "core";
const I18NEXT_FS_BKEND_COLLECTION_NAME = "config/type/i18n";
@gregfenton
gregfenton / UploadToFirebaseStorageFromReactNative.js
Last active August 1, 2024 00:08
JavaScript to upload a file/URL from React-Native (Expo) to Firebase Storage -- updated to the Firebase "modular API" syntax
//
// `npx expo install cuid firebase`
//
import { myStorage } from './firebase.js';
import { ref, getDownloadURL, uploadBytesResumable } from 'firebase/storage';
import cuid from 'cuid';
/**
* Uploads data from given `uri` to Firebase Storage and returns
@gregfenton
gregfenton / versionForAppConfig.js
Last active April 25, 2022 06:05
Expo - generate iOS buildNumber and Android versionCode from SemVer
// version.json:
//
// {
// "version": "3.0.23"
// }
let VERSION_JSON = `${PROJECT_CONFIG_DIR}/version.json`;
versionString = getVersionString(VERSION_JSON);
@gregfenton
gregfenton / firestore_add_doc.js
Last active April 3, 2022 16:15
A super simple command-line Node script to add a document to Firestore
/**
* firestore_add_doc.js
*
* This script is assumed to live in an existing Javascript project that has its own package.json.
* I store this script in <PROJECT_ROOT>/tools/misc/.
*
* To use:
* 1. npm init -y
* 2. npm install firebase esm
* 3. Edit this code to set for USER1 and FIREBASE_CONFIG