Skip to content

Instantly share code, notes, and snippets.

View maschwenk's full-sized avatar

Max Schwenk maschwenk

View GitHub Profile
@maschwenk
maschwenk / git_notes.md
Created January 6, 2022 02:26
Notes for buenito

Shit to setup your computer with

Install oh my zsh

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Put this into your ~./.zshrc file

@maschwenk
maschwenk / faker_issues.md
Last active February 6, 2019 05:11
Issue with Faker in specs

Problem

# Factory uses Faker::Name.first_name under the hoode -- evaluates to something with 'frank' as a substring
# Now you have two users named frank without realizing it
let(:user) { create :user } 
let(:another_user) { create :user, name: 'frank' }

it do
 filter_for_frank 

Request spec subjects

Who TF cares honestly? 🤷‍♂️ 🤷‍♀️

Great question. Let me preface this by saying I HATE talking about RSpec best practices. It's irrelevant to shipping software and tends to churn up a lot of long, useless discussion. However, I think it's useful to consider best practices when there is a demonstrable functional (not stylistic) difference between two approaches that can affect maintainability, flexibility, and speed.

One style I see quite a lot looks a bit like this:

The before hook tower of doom

@maschwenk
maschwenk / haveibeenpwned_password_check.md
Last active September 8, 2017 17:00
Check haveibeenpwned for your passwords
  1. wget https://downloads.pwnedpasswords.com/passwords/pwned-passwords-1.0.txt.7z 5GB file, expands to ~10GB
  2. brew install unar (optional if you have a cli tool that can unarchive 7z files)
  3. unar pwned-passwords-1.0.txt.7z
  4. fgrep $(echo -n "password youre looking for" | openssl sha1 | tr '[:lower:]' '[:upper:]') pwned-passwords-1.0.txt
  • $(echo -n "password youre looking for" | openssl sha1 | tr '[:lower:]' '[:upper:]') gives you a SHA1, uppercased
@maschwenk
maschwenk / git-recent-branches.rb
Last active May 15, 2022 00:31
git recent branches
#!/usr/bin/env ruby
# 1. put this in brew path `/usr/local/bin/`
# 2. make it executable `chmod +x /usr/local/bin/recent-branches`
# 3. in git config `~/.gitconfig` place an alias to the command inside `[alias]` block
# `br = recent-branches -n 20` (n being the number of branches you wanna show by default)
require 'optparse'
require 'English'
options = { number: 20 }
@maschwenk
maschwenk / keybase.md
Created March 10, 2017 20:15
Keybase affirmation

Keybase proof

I hereby claim:

  • I am maschwenk on github.
  • I am maschwenk (https://keybase.io/maschwenk) on keybase.
  • I have a public key ASAyC0V4YqxxtZUPz2MjpoYg2zi7qMJuhvaLhGQ3ZZ2qMAo

To claim this, I am signing this object:

# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline