Skip to content

Instantly share code, notes, and snippets.

View johnbeynon's full-sized avatar

John Beynon johnbeynon

View GitHub Profile
@johnbeynon
johnbeynon / gist:6a59fec601ad02c8a6d4
Created November 14, 2014 16:41
Rails redefine structure:dump
# In Rakefile
Rake::Task["db:structure:dump"].clear if Rails.env.production?
▶ heroku run bin/setup
Running `bin/setup` attached to terminal... up, run.6178
Adding DATABASE_URL to .env
Adding RACK_ENV to .env
Adding TZ to .env
Adding RAISE_ERRORS to .env
Adding FORCE_SSL to .env
Adding TIMEOUT to .env
Adding PRETTY_JSON to .env
Using i18n 0.7.0
@johnbeynon
johnbeynon / imagemagick.md
Created October 30, 2015 11:03
Imagemagick buildpack

Before:

$ heroku run bash
~ $ convert --version
Version: ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP

After deploying an Heroku Button app the apps git repo is not updated. Attempts to clone it will result in a message "You have cloned an empty repo". You can easily link an Heroku Button app to a repo so you can make changes to the source and deploy it again.

  • Deploy the app with Heroku Button and remember the app name that you created.
  • Go back to where the Heroku Button was displayed and copy it's underlying URL eg https://heroku.com/deploy?template=https://github.com/jamesward/heroku-connect-phone-change
  • Now extract the https://github.com part so you're left with https://github.com/jamesward/heroku-connect-phone-change
  • Clone the repo with heroku git:clone -a <YOUR-APP-NAME> - it will be reported as empty
  • cd into the project and add a git remote pointing at the original source, git remote add origin https://github.com/jamesward/heroku-connect-phone-change
  • pull from the remote origin git pull origin master
  • ls the directory, and there's the code.
@johnbeynon
johnbeynon / add_domain.rb
Last active March 20, 2025 20:16
Add custom domain to Render preview environment app
#!/usr/bin/ruby
# Script to add a custom domain to a preview environment web service. Use it via the buildCommand
#
# Resultant custom domain added to the service will be:
# <servicename>-pr-<number>.prs.mydomain.com
#
# Setup:
#
# Add a wildcard DNS entry to your domain, something like *.prs.mydomain.com pointing to 216.57.24.1
services:
- type: web
context: ./static
name: passthrough
branch: master
env: static
buildCommand: echo "hi"
staticPublishPath: .
buildTriggers:
includedPaths:
hugo version # Output the OLD version
if [[ ! -f $XDG_CACHE_HOME/hugo ]]; then
echo "...Downloading HUGO"
mkdir -p ~/tmp
wget -P ~/tmp https://github.com/gohugoio/hugo/releases/download/v0.99.1/hugo_0.99.1_Linux-32bit.tar.gz
cd ~/tmp
echo "...Extracting HUGO"
tar -xzvf hugo_0.99.1_Linux-32bit.tar.gz