Skip to content

Instantly share code, notes, and snippets.

@binarygit
binarygit / install-ruby-and-rails.bash
Last active July 1, 2024 05:23
This script installs Ruby and RoR. I created it to automate installing these things in my digital ocean droplets
# The steps are taken out of https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-18-04
# Steps to download and run this on your machine:
## Download the script
# wget https://gist.githubusercontent.com/binarygit/de4ba791bae94c633411d0fb51333728/raw/e3845300fe16fb8751a29757db2719d4cbecb591/install-ruby-and-rails.bash
## Source to run it because running the script like a command
## will run it in a new process. This new process won't be able
## to access the updated bashrc when we update it when installing
@binarygit
binarygit / bash
Created January 23, 2024 14:37
scrape-and-push
#!/usr/bin/env bash
cd ~/Documents/job_scraper
ruby main.rb
cd ~/Documents/jobs
git ci -am "Deployed on $(date)"
git push
@binarygit
binarygit / how_to_use_rails_secrets.md
Last active November 8, 2022 07:10
All about Rails secrets/credentials

setup your editor first

export EDITOR=<your editor of choice, eg: vim>

To edit your secrets use:

rails credentials:edit

The above command is editing your config/credentials.yml.enc file.

@binarygit
binarygit / dirty_form.js
Created October 18, 2022 18:59
Dirty Form using StimulusJs
import ApplicationController from "./application_controller";
const LEAVING_PAGE_MESSAGE = "Are you sure you want to leave?";
export default class extends ApplicationController {
static values = { dirty: Boolean };
static targets = ["submitBtn"];
connect() {
// find all inputs within the form
// and attach eventListeners