Skip to content

Instantly share code, notes, and snippets.

@cklanac
cklanac / #code_snippets.md
Last active August 5, 2022 17:48
Code Snippets for "The Firebase Realtime Database and Flutter - Firecasts"

Code Snippets for "Firebase Realtime Database and Flutter" https://www.youtube.com/watch?v=sXBJZD0fBa4

NOTES:

  • The files are ordered by timestamp in the video
  • Only the relevant code is provided. Imports have been removed
  • Sections not included:
    • Security Rules
    • Using the emulator
  • FirebaseAnimatedList
@cklanac
cklanac / mac-setup.md
Last active February 26, 2024 04:17
Mac setup

Mac Setup Distilled

Install Chrome, Dev and Canary

Description of Chrome Channels

  • Install Chrome or Chrome Dev
    • Note: Chrome and Chrome Dev use the same profile on a Mac
  • Setup 2 profiles:
    • Browsing: It may contain bookmarks, personal settings and extenstions
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
Icon?
@cklanac
cklanac / blackbox
Last active April 30, 2019 15:06
blackbox node_modules and internals
node_modules
^(assert|buffer|crypto|events|fs|net|util|url|path|timers|_http_server|_http_common|_http_incoming|_http_outgoing|_stream_writable|_stream_readable|_stream_duplex)\.js
@cklanac
cklanac / mongo-recovery.md
Created February 25, 2019 18:12
Mongo Recovery

Possible Errors and recovery

Bad Shutdown: (Unable to lock file: /data/db/mongod.lock)

Occasionally, mongo will be improperly shutdown, like closing the terminal before exiting

$ ctrl + c

And you’ll see the following error

@cklanac
cklanac / jwtAuth.js
Last active January 17, 2019 16:05
Custom Auth middleware (alternative to Passport's local and jwt strategies)
const createError = require("http-errors");
const debug = require("debug")("app:auth:jwt");
const jwtHelper = require("../helpers/jwt");
function jwtAuth(req, res, next) {
const auth = req.header("Authorization");
if (!auth) {
debug("'Authorization' header not found");
const chai = require('chai');
const chaiHttp = require('chai-http');
const faker = require('faker');
const mongoose = require('mongoose');
// this makes the should syntax available throughout
// this module
const should = chai.should();
const {Restaurant} = require('../models');
@cklanac
cklanac / challenge-11-mongo.md
Last active November 3, 2018 08:56
Challenge 11: Mongo Basics

For this challenge you will run through a set of CRUD operation with Mongo.

Getting Started

To get started, you will need to create a noteful database with a notes collection and populate it with documents.

  • Copy the contents of this gist into a JSON file and import it using mongoimport. Note, the data in ths gist is formatted as a proper JSON array of objects, so the import process is slightly different that the Restaurants data used earlier. Below is the mongoimport command with --jsonArray flag.
mongoimport -d noteful -c notes --drop --jsonArray --file ~/