From 0 to 5 in severity:
debug
- for debugging purposes, onlyinfo
- an informative messagewarn
- this may or may not be an issueerror
- this is an issue, but the application can continue running
#!/bin/bash | |
git diff --name-only --cached | grep -q package-lock.json | |
pkglock_staged=$? | |
git diff --name-only --cached | grep -q package.json | |
pkgjson_staged=$? | |
if [[ "$pkglock_staged" -eq 0 && "$pkgjson_staged" -eq 1 ]]; then | |
echo "attempted commit of package-lock.json without changes to package.json!" |
Bash reads different configuration files depending on how the shell session is started.
Providing an access token allows you to avoid a user/password authentication prompt.
https://username:[email protected]/username/repo.git
Aggregate tables, in general, are simply database tables that contain aggregated values.
An aggregate fact table is simply one that combines multiple rows of data, loses some detail and aggregates numerical values.
Instead of defining an included
method to handle extending a class, we can
extend ActiveSupport::Concern
.
It is actually a pretty simple but powerful concept. It has to do with code reuse as in the example below. Basically, the idea is to extract common and/or context specific chunks of code in order to clean up the models and avoid them getting too fat and messy.
module TimeHelper | |
def now | |
Time.new.to_i | |
end | |
def time_ago(seconds, now = Time.now.to_i) | |
minutes = (now - seconds) / 60 | |
quantity = [minutes / 525600, minutes / 43200, minutes / 1440, minutes / 60, minutes] | |
%w(year month day hour minute).each_with_index do |type, i| |