Skip to content

Instantly share code, notes, and snippets.

View CodeOfficer's full-sized avatar

Russell Jones CodeOfficer

View GitHub Profile
@katowulf
katowulf / pseudo_code.js
Last active June 16, 2021 19:29
Convert Cloud Storage json file to event stream and store output in Firestore
JSONStream = require('JSONStream');
es = require('event-stream');
fileStream = storage.bucket('your-bucket').file('your-JSON-file').createReadStream();
db = admin.firestore();
return new Promise( (resolve, reject) => {
batchPromises = [];
batchSize = 0;
batch = db.batch();
@keimlink
keimlink / nvm_vs_volta.md
Last active June 3, 2024 09:57
nvm vs Volta

nvm vs Volta

A comparison of nvm and Volta to manage Node.js projects (without Yarn).

Bootstrapping a Project

Bootstrapping a Project with nvm

nvm install
{"lastUpload":"2020-08-13T16:51:00.817Z","extensionVersion":"v3.4.3"}
echo code --install-extension
code --install-extension aaron-bond.better-comments
code --install-extension alefragnani.project-manager
code --install-extension ardenivanov.svelte-intellisense
code --install-extension cbuelter.vscode-toggle-max-editor
code --install-extension christian-kohler.path-intellisense
code --install-extension DavidAnson.vscode-markdownlint
code --install-extension dbaeumer.vscode-eslint
code --install-extension donjayamanne.githistory
code --install-extension dracula-theme.theme-dracula
@vasind
vasind / ember-cli-build.js
Last active August 15, 2024 15:13
Ember CLI performance improvements and tips
// Credits to the following posts that helps me to reduce build times drastically
// https://discuss.emberjs.com/t/tips-for-improving-build-time-of-large-apps/15008/12
// https://www.gokatz.me/blog/how-we-cut-down-our-ember-build-time/
//ember-cli-build.js
let EmberApp = require('ember-cli/lib/broccoli/ember-app');
let env = EmberApp.env(),
name: Test, Build and Deploy
on:
pull_request:
types: [closed]
jobs:
build-test-release:
if: github.event.action == 'closed' && github.event.pull_request.merged == true
runs-on: ubuntu-latest
@kevinmungai
kevinmungai / sapper_with_firebase_hosting.md
Created December 27, 2020 07:15
Sapper with Firebase Hosting
  1. Create Directory for your app mkdir my-app
  2. get the sapper template npx degit "sveltejs/sapper-template#rollup"
  3. Install the packages npm i
  4. Install express server npm i express
  5. Initialize Firebase firebase init
@MorenoMdz
MorenoMdz / batchWrapper.js
Last active July 21, 2023 10:55
Firebase Firestore batch more than 500 docs or operations
const batchWrapper = async (documentRef, action, update) => {
const batchArray = [];
batchArray.push(db.batch());
let operationCounter = 0;
let batchIndex = 0;
documentRef.forEach(doc => {
console.log('Org cleanup: deleting notifications', doc.id);
if (action === 'delete') {
batchArray[batchIndex].delete(doc.ref);
@pfiadDi
pfiadDi / firestore.rules
Created August 4, 2021 17:08
Firestore Advanced Security Rules
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
function isAuthenticated() {
return request.auth != null;
}
function isDefined(field) {
return field in request.resource.data