Skip to content

Instantly share code, notes, and snippets.

View mbleigh's full-sized avatar

Michael Bleigh mbleigh

View GitHub Profile
@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 / 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 / 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 / gist:1081663
Created July 14, 2011 00:58
Notes from converting my AppleTV into a media server and NAS.

AppleTV as Headless Media NAS

I don't use my AppleTV and I've had a 500GB external HD sitting around that isn't really getting use either. I thought I'd make use of both of these things and see if I could turn my AppleTV into a NAS device that would also allow for BitTorrent downloading and act as a transcoding DLNA MediaServer that I could access from my Xbox 360 and/or PS3.

Feature List

@mbleigh
mbleigh / gist:1384828
Created November 22, 2011 03:39 — forked from jch/gist:1384826
Object.pathy!
def response
last_response.stub!(:parsed_body).and_return(MultiJson.decode(last_response.body))
last_response
end
def body(path = nil)
if path
response.parsed_body.at_json_path(path)
class User
attr_reader :item
def self.create(name)
User.new(TABLES['users'].items.create(id: name))
end
def self.all
TABLES['users'].items.to_a.map{|i| User.new(i)}
end
@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>
@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 / config.ru
Created April 8, 2013 23:34
Quick "Hello World" for running Grape and Sinatra together using Rack::Cascade.
# Put this in a new directory, then run `rackup`
require 'sinatra'
require 'grape'
class Web < Sinatra::Base
get '/' do
"Hello world."
end
end