Skip to content

Instantly share code, notes, and snippets.

View willdowglas's full-sized avatar

Will Douglas willdowglas

View GitHub Profile
@willdowglas
willdowglas / checkout_and_rollback.rb
Created December 19, 2023 19:34
Checks rails migrations bewteen branches, rollbacks them and checkout to target branch
# Formats output to a bold, green text
def puts(*) # Formats output
print("\e[1m\e[32m") # formats text to bold, green
super
print("\e[22m\e[0m") # clear format
end
# Outputs error message and exits program with failure(1)
def fail(message)
Kernel.puts "\e[1m\e[31m#{message}\e[22m\e[0m" # bold, red
@willdowglas
willdowglas / checks.yml
Last active March 2, 2023 14:55
Raul gh actions sample
name: PR checks
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build:
name: some name
@willdowglas
willdowglas / KB-Buying-guide-EU.md
Created October 19, 2022 20:47 — forked from henfiber/KB-Buying-guide-EU.md
Buying keyboards and keyboard components from EU

Europe

@willdowglas
willdowglas / regenerate_credentials.md
Created December 30, 2020 14:06 — forked from db0sch/regenerate_credentials.md
How to regenerate the master key for Rails 5.2 credentials

If your master.key has been compromised, you might want to regenerate it.

No key regeneration feature at the moment. We have to do it manually.

  1. Copy content of original credentials rails credentials:show somewhere temporarily.
  2. Remove config/master.key and config/credentials.yml.enc
  3. Run EDITOR=vim rails credentials:edit in the terminal: This command will create a new master.key and credentials.yml.enc if they do not exist.
  4. Paste the original credentials you copied (step 1) in the new credentials file (and save + quit vim)
  5. Add and Commit the file config/credentials.yml.enc
@willdowglas
willdowglas / Dockerfile
Created December 30, 2020 13:46
Dockerize Rails
FROM ruby:2.7.1
WORKDIR /src
COPY . /src
RUN bundle install
CMD rails server
@willdowglas
willdowglas / alura_video_controller.js
Last active December 21, 2020 05:55
set video to fullscreen and playback rate to 2.0
const el_id = "video-player_html5_api"
let element = document.getElementById(el_id)
element.addEventListener("play", my_configs)
element.addEventListener("ended", document.exitFullscreen())
function my_configs() {
element.requestFullscreen()
element.playbackRate = 2
}
@willdowglas
willdowglas / docker-compose.yml
Created November 26, 2020 01:34
MySQL + phpMyAdmin
version: '3.3'
volumes:
data:
services:
db:
image: mysql
ports:
- "3306:3306"
volumes:
- data:/var/lib/mysql
@willdowglas
willdowglas / cfg.json
Created April 20, 2020 16:32
current vscode settings
{
"editor.acceptSuggestionOnCommitCharacter": false,
"editor.cursorBlinking": "solid",
"editor.cursorStyle": "block",
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"editor.fontSize": 14,
"editor.insertSpaces": false,
"editor.minimap.enabled": false,
"editor.renderWhitespace": "boundary",
@willdowglas
willdowglas / .vimrc
Created March 2, 2020 13:28
My vim config file
execute pathogen#infect()
filetype plugin indent on
syntax enable
set background=dark
let g:solarized_termtrans = 1
colorscheme solarized
set number relativenumber
set linebreak