Skip to content

Instantly share code, notes, and snippets.

View dwanderton's full-sized avatar

David Anderton dwanderton

View GitHub Profile
@dwanderton
dwanderton / setting-up-heroku-and-cloudflare.md
Created January 13, 2022 21:35 — forked from mrispoli24/setting-up-heroku-and-cloudflare.md
Setting up Heroku and Cloudflare (the right way)

Setting up Heroku and Cloudflare (the right way)

The following outlines how to setup Heroku + Cloudflare with a full SSL certificate. What this means is that communication between the browser and the Cloudflare CDN is encrypted as well as communication between Cloudflare and Heroku’s origin server. Follow these steps exactly and the setup is a breeze.

Step 1: Set up domain names in Heroku

First you want to add the root domain and the www domain to heroku. You do this by clicking into your production application, then going to settings and then scrolling down to Domains and certificates.

Here you will add <your_domain>.com and www.<your_domain>.com. This will give you two CNAME records. They will look something like <your_domain>.com.herokudns.com and www.<your_domain>.com.herokudns.com.

Step 2: Add CNAME records to Cloudfare.

<!-- Using Google Analytics within an Editor (Google Docs) sidebar add-on -->
<!DOCTYPE html>
<html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-X"></script>
<script>
window.dataLayer = window.dataLayer || [];
@dwanderton
dwanderton / build-tag-push.py
Created January 28, 2019 20:57 — forked from peatiscoding/build-tag-push.py
a script to convert your docker-compose.yml (version 2) with build node to image node; this script required DOCKERHUB_USER environment available.
#!/usr/bin/python
import os
import subprocess
import time
import yaml
import re
user_name = os.environ.get("DOCKERHUB_USER")
@dwanderton
dwanderton / 0-startup-overview.md
Created July 12, 2018 19:54 — forked from dideler/0-startup-overview.md
Startup Engineering notes
@dwanderton
dwanderton / gist:edbaadb6d7a204d29a5d
Created April 13, 2015 20:10
Add Google Analytics to each link with a class - example multiple social icons on page using font awesome (jQuery)
<script>
//standard ga script begin
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','http://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-00000000-0', 'auto'); //add your ga UA id here
ga('require', 'displayfeatures');
@dwanderton
dwanderton / redirect.js
Created April 13, 2015 07:33
Redirect https to http (perhaps to enable serving insecure content)
if (location.protocol === 'https:') {
// page is secure make unsecure
window.location.assign(window.location.href.replace('https','http'));
}
@dwanderton
dwanderton / gist:7526180
Created November 18, 2013 11:13
Chrome uncaught exception with code for randomise button if we just use player in Players.update: Uncaught Error: Not permitted. Untrusted code may only update documents by ID. [403]
'click input.randomise': function() {
Players.find({}).forEach(function(player) {
Players.update(player._id, {$set: {score: randomScore()}});
});
}