Skip to content

Instantly share code, notes, and snippets.

View mbleigh's full-sized avatar

Michael Bleigh mbleigh

View GitHub Profile
@mbleigh
mbleigh / Dockerfile
Created May 16, 2023 21:47
Puppeteer Node.js app dockerfile.
FROM node:18-slim AS app
# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
# Install Google Chrome Stable and fonts
# Note: this installs the necessary libs to make the browser work with Puppeteer.
RUN apt-get update && apt-get install gnupg wget -y && \
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
@mbleigh
mbleigh / README.md
Last active April 12, 2024 10:18
Firebase Hosting Fetch All Files

Fetch All Files from Firebase Hosting

This script fetches all of the files from the currently deployed version of a Firebase Hosting site. You must be signed in via the Firebase CLI and have "Site Viewer" permission on the site in question to be able to properly run the script.

Running via NPX

npx https://gist.github.com/mbleigh/9c8680cf319ace2f506f57380da66e7d <site_name>
@mbleigh
mbleigh / README.md
Last active September 25, 2020 04:26
Automate the deletion of old Firebase Hosting versions.

Firebase Hosting Version Cleanup

This is a simple utility script for cleaning up Firebase Hosting versions, leaving a specified number of versions remaining. This is primarily done to conserve storage usage, but may have other uses.

USE AT YOUR OWN RISK. NO WARRANTY IS PROVIDED. THIS SCRIPT DOES DELETE STUFF PERMANENTLY

Usage

node cleanupVersions.js [commit]

<script src="/__/firebase/3.7.4/firebase-app.js"></script>
<script src="/__/firebase/init.js"></script>
<script>
function funcURL(fnName) {
let projectIdIsh = firebase.app().options.authDomain.split('.')[0];
return `https://us-central1-${projectIdIsh}.cloudfunctions.net/${fnName}`;
}
</script>
var ENVS = {
prod: {firebase: {firebaseURL: 'https://my-app-prod.firebaseio.com'}},
staging: {firebase: {firebaseURL: 'https://my-app-staging.firebaseio.com'}},
dev: {firebase: {firebaseURL: 'https://my-app-dev.firebaseio.com'}},
}
window.__env = (function() {
switch(window.location.hostname) {
case 'localhost':
return ENVS.dev;
@mbleigh
mbleigh / firebase.json
Created August 2, 2016 18:42
Firebase Hosting for apple-app-site-association
{
"hosting": {
"headers": [
{
"source": "/.well-known/apple-app-site-association",
"headers": [{"key": "Content-Type", "value": "application/json"}]
}
]
}
}
@mbleigh
mbleigh / divshot-migration-guide.md
Last active November 2, 2016 08:52
Divshot to Firebase Hosting migration guide

Firebase Migration Guide

Divshot has joined Google's Firebase! You can read more about the announcement on the Firebase blog. This guide is here to help you migrate and export your existing Divshot apps to Firebase Hosting.

If you don't already have a Firebase account, you'll need to create one. To do so, just visit firebase.com and sign up with your Google account.

@mbleigh
mbleigh / .travis.yml
Created October 30, 2014 04:59
Octopress + Travis CI + Divshot
language: ruby
rvm:
- 2.1.0
script: bundle exec rake generate
deploy:
provider: divshot
environment:
master: development
staging: staging
production: production
@mbleigh
mbleigh / comparison.md
Last active November 4, 2015 04:17
Comparing the features of Divshot and Firebase static web hosting.

Divshot/Firebase Hosting Feature Comparison

Feature Divshot Firebase
Global CDN
Custom Domains
SSL Supported
Command-Line Tools
Simple Rollback
Free w/ Firebase
@mbleigh
mbleigh / gist:6260675
Created August 18, 2013 09:09
Example Heroku post-commit payload
app=dumb-hook-example&user=michael%40intridea.com&url=http%3A%2F%2Fdumb-hook-example.herokuapp.com&head=dd615b2&head_long=dd615b2dff8c35abfcbd49b45fb4e9d2cb965874&prev_head=8a0e2c7&git_log=%20%20*%20Michael%20Bleigh%3A%20Add%20another.