Skip to content

Instantly share code, notes, and snippets.

View netzfisch's full-sized avatar
🐋
swim w/ friends

harm netzfisch

🐋
swim w/ friends
View GitHub Profile
@netzfisch
netzfisch / gist:1a09308a7f3bc44db692
Last active September 15, 2015 15:36 — forked from alex-zige/gist:5795358
Rails Rspec API Testing Notes

Rails Rspec APIs Testing Notes

Folders Structure

  spec
  |--- apis #do not put into controllers folder. 
        |--- your_api_test_spec.rb  
  |--- controllers
  |--- models
  |--- factories
 |--- views
@netzfisch
netzfisch / my_awesome_rspec_hacks.rb
Created September 30, 2018 09:51 — forked from jalkoby/my_awesome_rspec_hacks.rb
My awesome RSpec hacks
## Context + metadata
shared_context 'Logged as a user', role: true do
let(:user) { |example| create :user, example.metadata[:role] }
before { login_as user }
end
scenario "Login as a client", role: :client
scenario "Login as a customer", role: :customer
scenario "Login as an admin", role: :admin
@netzfisch
netzfisch / readme.md
Created December 5, 2018 14:54 — forked from thomasdarimont/readme.md
Example for decoding a JWT Payload with your Shell (bash, zsh...)

Setup

Add this to your .profile, .bashrc, .zshrc...

decode_base64_url() {
  local len=$((${#1} % 4))
  local result="$1"
  if [ $len -eq 2 ]; then result="$1"'=='
  elif [ $len -eq 3 ]; then result="$1"'=' 
  fi
 echo "$result" | tr '_-' '/+' | openssl enc -d -base64
@netzfisch
netzfisch / exit_the_cloud.md
Created October 9, 2024 21:11 — forked from rameerez/exit_the_cloud.md
☁️ How I got off the cloud and migrated everything from AWS to a VPS in Hetzner

☁️ How I got off the cloud and migrated everything from AWS to a VPS in Hetzner

This is an opinionated handbook on how I migrated all my Rails apps off the cloud and into VPS.

This is how I manage real production loads for my Rails apps. It assumes:

  • Rails 7+
  • Ruby 3+
  • PostgreSQL
  • Ubuntu Server 24.04
  • Capistrano, Puma, Nginx