Skip to content

Instantly share code, notes, and snippets.

@michrome
michrome / how-to-manually-deploy-to-amplify.md
Last active September 6, 2022 13:24
Ho to manually deploy pre-built assets to Amplify

Create a new branch

$ aws amplify create-branch --app-id d35zda70oajrej --branch-name test --region ca-central-1

Create a new deploy

$ aws amplify create-deployment --app-id d35zda70oajrej --branch-name test --region ca-central-1
@michrome
michrome / checkPriority.js
Last active September 26, 2018 13:03
Detect when a Business Standstill case is about to be raised and ask customer to call
// <script type="text/javascript" src="https://gist.githubusercontent.com/michrome/151cf59c2b12b700346a3535bc07d5d5/raw/checkPriority.js"></script>
window.setInterval(checkPriority, 500);
function checkPriority() {
var x = Coveo.$("[data-case-field='Priority']").coveo("getValue");
if (x === "1 - Business Standstill") {
alert("Please call us!");
Coveo.$("[data-case-field='Priority']").coveo("setValue", "");
}
}
@michrome
michrome / _headers
Created May 11, 2018 21:48
This doesn't work
http://hello-yoga.co.uk/*
Cache-Control: public, max-age=2592000
http://www.hello-yoga.co.uk/*
Cache-Control: public, max-age=0, must-revalidate
{"BrandonRomano/static-lite":{"17648":{"size":69,"stargazers_count":27,"watchers_count":27,"forks_count":6,"open_issues_count":1,"forks":6,"open_issues":1,"watchers":27,"network_count":6,"subscribers_count":4}},"Frozen-Flask/Frozen-Flask":{"17648":{"size":323,"stargazers_count":526,"watchers_count":526,"forks_count":47,"open_issues_count":17,"forks":47,"open_issues":17,"watchers":526,"network_count":47,"subscribers_count":20}},"tightenco/jigsaw":{"17648":{"size":1808,"stargazers_count":797,"watchers_count":797,"forks_count":89,"open_issues_count":12,"forks":89,"open_issues":12,"watchers":797,"network_count":89,"subscribers_count":38}},"11ty/eleventy":{"17648":{"size":506,"stargazers_count":473,"watchers_count":473,"forks_count":14,"open_issues_count":27,"forks":14,"open_issues":27,"watchers":473,"network_count":14,"subscribers_count":14}},"JavaEden/Orchid":{"17648":{"size":11511,"stargazers_count":55,"watchers_count":55,"forks_count":3,"open_issues_count":22,"forks":3,"open_issues":22,"watchers":55,"network_c
@michrome
michrome / pg2local.sh
Last active December 27, 2015 14:09
Capture a Postgres backup from Heroku and restore it to a local development database
#!/bin/bash
# Capture a backup
heroku pgbackups:capture
# Download the backup
curl -o latest.dump `heroku pgbackups:url`
# Restore the back locally
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U `whoami` -d `echo ${PWD##*/}_development` latest.dump
@michrome
michrome / gist:6592136
Created September 17, 2013 09:33
Show current git branch in terminal prompt
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
@michrome
michrome / git-pull-all.sh
Last active May 15, 2019 05:35
Add these to your .profile to allow you to pull and push all your branches with a remote Git server.
# Usage:
# `git-pull-all` to pull all your local branches from origin
# `git-pull-all remote` to pull all your local branches from a named remote
function git-pull-all() {
START=$(git symbolic-ref --short -q HEAD);
for branch in $(git branch | sed 's/^.//'); do
git checkout $branch;
git pull ${1:-origin} $branch || break;
@michrome
michrome / gist:5831920
Last active December 18, 2015 19:19
Playing with classes in CoffeeScript
# Run this http://cl.ly/PnKK
class Animal
constructor: (options) ->
{@name, @sound, @action} = options
greeting: ->
"#{@sound} #{@sound}"
dog = new Animal({sound:"woof", name:"Rover", action:"wags tail"})