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 / 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 / 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 / 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