Skip to content

Instantly share code, notes, and snippets.

View kylefdoherty's full-sized avatar

Kyle Doherty kylefdoherty

View GitHub Profile
@kylefdoherty
kylefdoherty / rails-deploy-to-digitalocean.md
Last active September 7, 2018 08:44
Notes for myself on How to Deploy a Rails App to DigitalOcean with Ubuntu 14.04, Phusion Passenger & Nginx, Postgres, and Capistrano

How to Deploy a Rails App to DigitalOcean with Ubuntu 14.04, Phusion Passenger & Nginx, Postgres, and Capistrano

1. Setup DigitalOcean Droplet

  • Choose Server Image

choose server image

  • Choose Size (if this is a hobby app you can probably get away with the smallest)

choose server size

Create a Server Instance

You can do this with a virtual box (ex: Vagrant & VirtualBox), an EC2 instance on AWS, a Droplet on Digital Ocean, and a variety of other ways/services.

Setup EC2 Instance

  • Launch EC2 instance on AWS (ubuntu 16.04 or something else)
  • Change the security group to only allow SHH from your IP
  • Name and download the keypair and move it to your ~/.ssh directory
  • SSH into your instance by navigating to connect and copy and pasting the SSH command given in the modal, ex: ssh -i "name_of_my_key_pair.pem" ubuntu@ec2-54-84-207-182.compute-1.amazonaws.com
  • You'll likely need to change the permission settings for that file. To do this you can use the command on the same modal where you got the SHH command. Ex:

Iterm2 Shortcuts

Navigation

Lines

  • End of line Ctrl + e
  • Beginning of line Ctrl + a

Words

  • Note: For iTerm2 you need to configure the option key to behave correctly. Go to 'preferences', under 'profiles' and in the 'keys' tab you can specify either the right or left option keys to send +Esc.

How to Delete a Submodule

  • Run git rm --cached
  • Delete the relevant lines from the .gitmodules file.
  • Delete the relevant section from .git/config.
  • Commit
  • Delete the now untracked submodule files.
  • Remove directory .git/modules/

Nginx Tutorial

Nginx is a webserver but also can act as a reverse proxy (sits in front of another server), a load balancer, or a load balancer. Read more here

Setup Nginx on Ubuntu

  1. Spin up an Ubuntu machine with vagrant or create one on digitalocean or somewhere else.
  2. sudo apt-get update & sudo apt-get install nginx
  3. Visit server's IP to see if Nginx is running (you'll see the welcome page if it is)
  • if you aren't sure what your server's IP run ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
  1. Setup your /etc/nginx/nginx.conf.
@kylefdoherty
kylefdoherty / docker_notes.md
Last active March 30, 2017 03:04
Docker Notes

Docker Notes

Images

  • templates used to create containers that have no state and never change

  • created with the docker build command

  • composed of layers of other images

  • Ex:

docker run hello-world

const checks = document.getElementsByClassName('js-mark-as-fixed')
for (let i = 0; i < checks.length; i++) { checks[i].click() }
const immutableArray = [1, 2, 3, 4]
const index = 2
const newArrayLess3 = [
...immutableArray.slice(0, index),
...immytableArray.slice(index + 1),
]
# => newArrayLess3 = [1, 2, 4]
# => immutableArray = [1, 2, 3, 4]
<!-- Learn More Text Element -->
<div class="f__center">
<div class="sp__4"><br /></div>
<h2 class="c__white">Ready to learn more?</h2>
<a class="btn btn__primary" href="#">Request A Demo</a>
<div class="sp__4"><br /></div>
</div>
<!-- End Learn More Text Element -->
<div><br /></div>
<script>
var action = {{DLV-custom-event-action}};
if (action === 'viewed') {
console.log("LOG MKETO PAGE VIEW")
// Munchkin.munchkinFunction('visitWebPage', { 'url': {{Page URL}} });
};
if (action === 'clicked') {
console.log("LOG MKETO CLICK")