- Value: (read-only) does some math or manipulation with one input value, like a model, but for one value only
- Presenter: (read-only) takes complex data, like different models, and provides extra presentation values, even HTML
- Service: (mainly-write) Has a main method that writes data through delegation, and can expose the results as read-methods (eg: errors)
- Query: (read-only) Joins different models and performs SQL queries on them, ideally through SQL views
- Gateway: (read-write) LIB Wrap of an API (lib: favour primitives, don't depend on
app) - Serializer: (read-only) Converts input to a string like JSON, CSV, PDF blob etc (prefer others)
- Parser: (read-only) convert data from one format to another (prefer others)
- Decorator: (read-only) extends an object with extra value otherwise written in a presenter (prefer others)
- Be restful
- Put view partials in proper resource (table partial, not table body)
- Namespace a lot, use lib a lot, but don't put app (eg AR models) stuff in lib
- Models should not use change itself in callbacks; Use services, strategies, queries, have a clear dependency hirarchy
- Limit the use of validation (defaults?), they are only for UI purposes, (almost) always add relative DB constraints
- DB foreign_keys, unique indexes, null with defaults
- No SQL outside of the model
- Write extra models (or Query objects?) to connect models
- Write non-AR models
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Read File System | |
| # alias ag='ag -C' # -C 5 # Context | |
| alias aglog='ag "\>\>\>"' | |
| alias agdeb='ag binding\.pry app/ lib/ vendor/ config/ spec/ && ag debugger app/javascript/ app/assets/javascripts/' | |
| alias agig="ag --ignore-dir={vendor,vendir,node_modules,cache,tmp,test}" | |
| # alias agit='ag --ignore="*_test\.*"' | |
| alias agl='ag -l' # file only | |
| alias agq='ag -Q' # no regex | |
| alias agw='ag --width=300' | |
| alias bigfiles="find . -type f -printf '%s %p\n' | sort -nr | head -30" |
Currently (and constantly) exploring new productivity gains with AI, using ReactJS, NextJS, TypeScript and always focusing on UX and DX.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| { | |
| "added_words": | |
| [ | |
| "App", | |
| "refactored", | |
| "refactor", | |
| "api", | |
| "ui", | |
| "async", | |
| "linter", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## NODE-REINSTALL | |
| #!/bin/bash | |
| # node-reinstall | |
| # credit: http://stackoverflow.com/a/11178106/2083544 | |
| ## program version | |
| VERSION="0.0.17" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }' |
