Skip to content

Instantly share code, notes, and snippets.

Avatar
🍩

Andy Eastwood AndrewEastwood

🍩
View GitHub Profile
@AndrewEastwood
AndrewEastwood / haproxy.conf
Created Nov 3, 2021 — forked from Wu-Wu/haproxy.conf
HAProxy configuration to deploy PSGI application
View haproxy.conf
#
# application entry points
# https://www.example.com/ (production)
# https://demo.example.com/ (demo/lite production)
# https://devel.example.com/ (development)
#
# static content served by nginx server
# http://app-be1.example.net:4xxx/
# http://app-be2.example.net:4xxx/
#
View helpful-docker-commands.sh
###############################################################################
# Helpful Docker commands and code snippets
###############################################################################
### CONTAINERS ###
docker stop $(docker ps -a -q) #stop ALL containers
docker rm -f $(docker ps -a -q) # remove ALL containers
docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter
# exec into container
@AndrewEastwood
AndrewEastwood / mapper5.js
Last active Jul 9, 2021
set/update value in an object
View mapper5.js
const mapper5 = (keys, v, o) => {
if (keys.length === 0) {
return o;
}
if (keys.length === 1) {
return { ...o, [keys[0]]: v };
}
const key = keys[0];
const isNextKeyForArray = /[0-9]+/.test(keys[1] || '');
@AndrewEastwood
AndrewEastwood / download-file.js
Created Sep 9, 2020 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
View download-file.js
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@AndrewEastwood
AndrewEastwood / gist:7d1b0f351210e7b0f0da515976af2b4e
Created Apr 12, 2016 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
View gist:7d1b0f351210e7b0f0da515976af2b4e
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
View sublime_text_2_useful_shortcuts.md

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods