last update: Dec 4, 2020
- macOS >= 10.14 (Mojave); tested with 10.15 (Catalina)
- homebrew properly installed
/** | |
* A script that: | |
* 1. loads Google Sheets API keys and spreadsheet IDs (see GOOGLE_API_KEY) | |
* 2. connects to the identifed Google Sheet | |
* 3. grabs the data from a named Worksheet (see SHEET_TO_GET) | |
* 4. iterates over each row (see processUserRows()) | |
* 5. puts them into a JSON structure | |
* 6. and writes that out to a file (see FILE_NAME) | |
* | |
* To run this script, I have this in my package.json: |
/** | |
* load_json_to_firstore.js | |
* | |
* This code is a "node script" used to load data into your Firestore database, either in "the cloud" or the emulator. | |
* | |
* The script is a "client app", so it logs in with Firebase Auth using email/password from the variable USER1. | |
* | |
* The USER1 user ([email protected]) must exist in your Firebase project and have write access | |
* to the collection(s) you are populating. You can create that account via Firebase Console >> Authentication. | |
* |
const admin = require('firebase-admin'); | |
const fs = require('fs'); | |
const serviceAccount = require('../../../../../../Private/myschool-data_transfer-key.json'); | |
admin.initializeApp({ credential: admin.credential.cert(serviceAccount) }); | |
const schema = require('./schema').schema; | |
const firestore2json = (db, schema, current) => { |
last update: Dec 4, 2020
[ | |
{ "city": "Abbeville", "state": "Louisiana" }, | |
{ "city": "Aberdeen", "state": "Maryland" }, | |
{ "city": "Aberdeen", "state": "Mississippi" }, | |
{ "city": "Aberdeen", "state": "South Dakota" }, | |
{ "city": "Aberdeen", "state": "Washington" }, | |
{ "city": "Abilene", "state": "Texas" }, | |
{ "city": "Abilene", "state": "Kansas" }, | |
{ "city": "Abingdon", "state": "Virginia" }, | |
{ "city": "Abington", "state": "Massachusetts" }, |
const firebase = require('firebase-admin'); | |
var serviceAccountSource = require("./source.json"); // source DB key | |
var serviceAccountDestination = require("./destination.json"); // destiny DB key | |
const sourceAdmin = firebase.initializeApp({ | |
credential: firebase.credential.cert(serviceAccountSource) | |
}); | |
const destinyAdmin = firebase.initializeApp({ |
import Foundation | |
/** | |
A swift protocol to make any Int enum able to count its cases. | |
Super-useful for making enums to help you deal with sections in tableviews without having to maintain a case for the count of the enum. | |
Originally developed by Logan Wright for Swift 2.0 here: | |
https://gist.github.com/LoganWright/c8a26b1faf538e40f747 | |
// | |
// Convenience extensions to read images into textures. | |
// | |
import UIKit | |
import OpenGLES | |
extension DrawContext { | |
/// Make texture with an image in it. | |
public func makeTexture(id: TextureId? = nil, width: Int? = nil, height: Int? = nil, fromFileContents filename: String) -> TextureId { |
// Router.swift | |
import Alamofire | |
enum Router: URLRequestConvertible { | |
static let baseURLString = "https://private-85a46-routable.apiary-mock.com/" | |
case readUsers | |
case createUser(parameters: Parameters) |