Skip to content

Instantly share code, notes, and snippets.

View duncanhunter's full-sized avatar

Duncan Hunter duncanhunter

View GitHub Profile
const admin = require("admin");
function getFirebaseUser(req, res, next) {
console.log("Check if request is authorized with Firebase ID token");
if (
!req.headers.authorization ||
!req.headers.authorization.startsWith("Bearer ")
) {
console.error(
"No Firebase ID token was passed as a Bearer token in the Authorization header.",
@gvergnaud
gvergnaud / Promises-under-the-hood.md
Last active May 3, 2025 21:13
Promises, under the hood.

Promises, under the hood

Everyone knows that to create a new Promise, you need to define it this way:

  new Promise((resolve, reject) => {
    ...
    resolve(someValue)
  })

You pass a callback that defines the specific behavior of your promise.

@btroncone
btroncone / rxjs_operators_by_example.md
Last active September 14, 2025 16:48
RxJS 5 Operators By Example
@btroncone
btroncone / ngrxintro.md
Last active September 5, 2025 05:30
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@mfunkie
mfunkie / exampleUsage.html
Created August 15, 2014 14:48
Template Popover for Angular-UI Bootstrap
<div ng-app="myModule">
<script type="text/ng-template" id="myTemplatePopover.html">
<div ng-controller="PopoverTestCtrl">
<span>Is it not <b style="color:red;">glorious</b> to have <i>html</i> in a popover?</span>
<span>{{ theStuff }}</span>
<button class="btn btn-danger" ng-click="$popover.close()">Try closing here!</span>
</div>
</script>
<button class="btn btn-success" template-popover="myTemplatePopover.html" template-popover-title="I'm a title!" template-popover-placement="bottom">You can have popovers with templates too!</button>
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active June 8, 2025 15:03
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.