Skip to content

Instantly share code, notes, and snippets.

View markmssd's full-sized avatar
🔥

Mark Massoud markmssd

🔥
View GitHub Profile

Google Cloud CDN with private GCS bucket

How to authenticate Google Cloud CDN to a private GCS bucket

In order to authenticate to a private GCS bucket, we need to connect the Cloud CDN load balancer through a Backend Service, instead of a Backend Bucket. See Configure private origin authentication for more details.

As of April 2024, the

@markmssd
markmssd / useAsyncStorage.ts
Created February 1, 2020 16:55
Helper hook for @react-native-community/async-storage
import { useState, useEffect } from 'react'
import AsyncStorage from '@react-native-community/async-storage'
export const useAsyncStorage = <T>(key: string, initialValue: T) => {
const [storageItem, setStorageItem] = useState<T>(initialValue)
// initialize
useEffect(() => {
AsyncStorage.getItem(key)
.then((value) => {
import { IStorageBackend, EmptyStorageModel, StorageOptions } from '@react-native-community/async-storage'
import firestore, { FirebaseFirestoreTypes } from '@react-native-firebase/firestore'
// UNTESTED
// @react-native-community/async-storage
class FirestoreSettings<T extends EmptyStorageModel = EmptyStorageModel> implements IStorageBackend<T> {
firestore: FirebaseFirestoreTypes.DocumentReference
constructor(firestore: FirebaseFirestoreTypes.DocumentReference) {
@markmssd
markmssd / getObjects.js
Created March 19, 2017 01:27 — forked from Calvein/getObjects.js
Get all objects from a parse class
// Returned promise
var promise = new Parse.Promise()
// Error function
var error = function() {
console.error('Error:', arguments)
// Break it
response.error('Query failed, check logs')
}
@markmssd
markmssd / main.js
Created March 19, 2017 01:27 — forked from clemblanco/main.js
Parse - CloudCode - Retrieve all objects from a specific Parse class without limitation
Parse.Cloud.define("retrieveAllObjects", function(request, status) {
var result = [];
var chunk_size = 1000;
var processCallback = function(res) {
result = result.concat(res);
if (res.length === chunk_size) {
process(res[res.length-1].id);
} else {
status.success(result);
}