Skip to content

Instantly share code, notes, and snippets.

View artokun's full-sized avatar
😼
Always learning

Arthur R Longbottom artokun

😼
Always learning
View GitHub Profile
@jdnichollsc
jdnichollsc / storage.ts
Last active July 27, 2024 19:53
Upload Base64/Blob files to Google Cloud Storage
import { join } from 'path'
import { get } from 'lodash'
import { Storage } from '@google-cloud/storage'
import { BUCKET_NAME } from '../constants'
import { base64MimeType } from '../utils'
const gcloudPathKey = join(__dirname, '../gcloud-key.json')
const storage = new Storage({
projectId: 'my-project-id',
@simenbrekken
simenbrekken / schema.js
Created December 21, 2016 14:06
Firebase backed GraphQL schema
import firebase from 'firebase'
import { filter, map } from 'lodash'
import { makeExecutableSchema } from 'graphql-tools'
firebase.initializeApp({
databaseURL: 'https://grafire-b1b6e.firebaseio.com',
})
const mapSnapshotToEntity = snapshot => ({ id: snapshot.key, ...snapshot.val() })
const mapSnapshotToEntities = snapshot => map(snapshot.val(), (value, id) => ({ id, ...value }))