Skip to content

Instantly share code, notes, and snippets.

@ChrisChiasson
ChrisChiasson / firebase_V8_async.js
Created January 19, 2024 04:12
Cleaned up Firebase V8 Lazy Loading Example
// firebaseApp replaces import firebase from "firebase/app" (the _only_ named import)
// firebaseAppPromise is the promise that gets awaited immediately to prevent multi-call re-init
let firebaseApp, firebaseAppPromise;
export async function getFirebaseApp() {
if (!firebaseApp) {
if (!firebaseAppPromise) firebaseAppPromise = import(/*webpackPreload: true*/ "firebase/app");
firebaseApp = await firebaseAppPromise;
}
return firebaseApp;
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ChrisChiasson
ChrisChiasson / git-ssh-error-fix.sh
Created December 31, 2019 16:30 — forked from Tamal/git-ssh-error-fix.sh
Solution for 'ssh: connect to host github.com port 22: Connection timed out' error
$ git clone git@github.com:xxxxx/xxxx.git my-awesome-proj
Cloning into 'my-awesome-proj'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
$ # This should also timeout
$ ssh -T git@github.com
ssh: connect to host github.com port 22: Connection timed out
$ # but this might work
@ChrisChiasson
ChrisChiasson / WynnEpsilon.cpp
Last active October 31, 2021 01:51
C++ Wynn's epsilon algorithm with caching
//#include <iostream> //only to debug cache
#include <map>
/**
* Functor that returns an estimate for the converged
* value of a series of numbers or higher order math
* objects like tensors or vectors.
*
* Wynn's epsilon method is used, and the intermediate
* epsilon results are cached in a two level map. A
@ChrisChiasson
ChrisChiasson / this isn't really a script.sh
Created March 31, 2018 05:22
livepeer transcoder setup in bash on ubuntu 17.10
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install golang-go
go get github.com/livepeer/go-livepeer/cmd/livepeer
cd ~/go/src/github.com/livepeer/go-livepeer/
go get ./...
sudo apt-get install autoconf
./install_ffmpeg.sh
export PKG_CONFIG_PATH=$HOME/compiled/lib/pkgconfig
go build ./cmd/livepeer/livepeer.go
@ChrisChiasson
ChrisChiasson / Expect.hpp
Last active December 4, 2020 14:35
Very Simple Unit Testing Setup
#ifndef EXPECT_EXPECT_HPP_
#define EXPECT_EXPECT_HPP_
#include <iostream>
#include <stdexcept>
#include <string>
/**
* Expect test functor.
* See this struct's test file for a simple example. */