Next Window: ctrl+pgDown
Reset terminal: ctrl+shift+g
- Copy file location
ctrl+shift+c
Currently interested in ReactJS, Node, TypeScript, AI, UX.
{ | |
"added_words": | |
[ | |
"App", | |
"refactored", | |
"refactor", | |
"api", | |
"ui", | |
"async", | |
"linter", |
# CGI.parse(params) # "checklist_list_ids%5B%5D=10806" | |
# Gem::Specification.map(&:name).sort | |
# app.users_path # => "/users" | |
::U = User # Etc | |
def self.helpme | |
puts <<-TEXT | |
v # view helpers (eg: content_tag) | |
exceptions # List of all exceptions |
## NODE-REINSTALL | |
#!/bin/bash | |
# node-reinstall | |
# credit: http://stackoverflow.com/a/11178106/2083544 | |
## program version | |
VERSION="0.0.17" |
git for-each-ref --sort=-committerdate --format='%(committerdate:short)|%(refname)|%(authorname)' refs/heads refs/remotes | head -n20 | awk -F '|' '{ printf "%s %-70s %s\n", $1, $2, $3 }' |
title | date | author | tags |
---|---|---|---|
The Direction Of The Dependency |
2016-02-26 |
Architecture, Dependency Management, Ruby |
When projects grow they become hard to change. One aspect that is not often highlighted is dependency direction. I haven't found much material on the topic, maybe the best ideas came from this talk by Sandi Metz "Less, the path to a better design".
# Wrap in transaction, it's quicker | |
# and if something fails it will be easier to re-run them separately | |
ActiveRecord::Base.transaction do | |
User.create!(email: "[email protected]", etc: :etc) # Don't use FactoryGirl | |
end | |
# And they can be tested as follows | |
# spec/db/seed_spec.rb | |
require "rails_helper" |
Items that can be placed in a recycling bin include:
# One return per line makes it easy to understand / debug | |
def done? | |
return false if no_one_done_it? | |
return false if not_found? | |
return true if you_did_it? | |
false | |
end | |
# Special case pattern (!= NullObject) | |
# Some, including Kent Beck and Martin Fowler argue that one or more guard clauses |