Skip to content

Instantly share code, notes, and snippets.

@benomatis
benomatis / backupFirestoreDaily.js
Created May 30, 2023 20:08
Firebase PubSub function to create a daily backup of all firestore collections, taken from https://firebase.google.com/docs/firestore/solutions/schedule-export
import functions from 'firebase-functions'
import firestore from '@google-cloud/firestore'
// noinspection JSUnresolvedVariable
const client = new firestore.v1.FirestoreAdminClient()
const bucket = 'gs://backup_firestore_daily'
export const scheduledFirestoreExport = functions.pubsub
.schedule('0 0 * * *')
.timeZone('America/Toronto')
"dependencies": {
"@react-native-community/async-storage": "^1.12.1",
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/native": "^5.9.2",
"@react-navigation/stack": "^5.14.2",
"@rematch/core": "^2.0.0",
"@rematch/loading": "^2.0.0",
"@rematch/persist": "^2.0.0",
"@tttstudios/react-native-carousel": "^1.1.0",
"add": "^2.0.6",
[ 0.016s] [diagnostic]
********************************************************
[TEST 1/7: webchannel.googleapis.com with default options] STARTING at 2021-03-25T18:39:14.050Z]
********************************************************
[ 0.382s] [diagnostic] >>> [TEST 1/7: webchannel.googleapis.com with default options] createWebChannel("https://webchannel.googleapis.com/staging/channel/generator", {"backgroundChannelTest":true,"httpSessionIdParam":"gsessionid","initMessageHeaders":{},"sendRawJson":true,"supportsCrossDomainXhr":true,"internalChannelParams":{"forwardChannelRequestTimeoutMs":600000},"httpHeadersOverwriteParam":"$httpHeaders","disableRedact":true})
[ 0.388s] [diagnostic] >>> [TEST 1/7: webchannel.googleapis.com with default options] open()
[ 0.391s] [goog.labs.net.webChannel.WebChannelDebug] connect()
[ 0.392s] [goog.labs.net.webChannel.WebChannelDebug] Origin Trials enabled.
[ 0.396s] [goog.labs.net.webChannel.WebChannelDebug] connectChannel_()
[ 0.405s] [goog.labs.net.webChannel.WebChann
[ 0.015s] [diagnostic]
********************************************************
[TEST 1/6: webchannel.googleapis.com with default options] STARTING at 2021-03-22T11:22:49.174Z]
********************************************************
[ 0.336s] [diagnostic] >>> [TEST 1/6: webchannel.googleapis.com with default options] createWebChannel("https://webchannel.googleapis.com/staging/channel/generator", {"backgroundChannelTest":true,"httpSessionIdParam":"gsessionid","initMessageHeaders":{},"sendRawJson":true,"supportsCrossDomainXhr":true,"internalChannelParams":{"forwardChannelRequestTimeoutMs":600000},"httpHeadersOverwriteParam":"$httpHeaders","disableRedact":true})
[ 0.344s] [diagnostic] >>> [TEST 1/6: webchannel.googleapis.com with default options] open()
[ 0.345s] [goog.labs.net.webChannel.WebChannelDebug] connect()
[ 0.347s] [goog.labs.net.webChannel.WebChannelDebug] Origin Trials enabled.
[ 0.352s] [goog.labs.net.webChannel.WebChannelDebug] connectChannel_()
[ 0.363s] [goog.labs.net.webChannel.WebChann
@benomatis
benomatis / HamburgerCross.js
Last active January 26, 2021 14:35
React Native Two (2) Lines Hamburger Cross Animated, Functional Component With Hooks
/**
* Hamburger Cross animation with 2 lines only
* Functional component with hooks
* Borrowed from https://github.com/GeekyAnts/react-native-hamburger
*/
import React, { useState, useEffect } from 'react'
import { Animated, TouchableWithoutFeedback } from 'react-native'
const Hamburger = ({ active, color, onPress = () => {} }) => {
const [internalActive, setInternalActive] = useState(false)
@benomatis
benomatis / automatically_generate_loopback_models_from_MySQL_README.md
Last active July 11, 2017 08:56
Automatically generate loopback models from existing MySQL schema (all at once)

Prerequisites

When using this script I'm assuming the following things are true:

  1. You have a working LoopBack application created.
  2. You have loopback-connector-mysql installed.
  3. You have a datasources.json file created inside the LoopBack application root folder server and have set up connection to your MySQL database. Basic example:
    "mydb": {
      "name": "mydb",
      "connector": "mysql",
      "host": "localhost",
@benomatis
benomatis / list_localStorage.js
Created February 27, 2016 21:33
List key => value pairs of localStorage (JavaScript)
for (var i = 0; i < localStorage.length; i++) {
console.log(Object.keys(localStorage)[i] + ' => ' + localStorage.getItem(localStorage.key(i)));
}
@benomatis
benomatis / Flexslider_randomize_slideshow_speed_of_multiple_slideshows.css
Last active February 27, 2016 21:35
Flexslider: randomize slideshow speed of multiple slideshows
.slider_wrapper {
float:left;
width:33%;
}