Inspired by: @marckohlbrugge's analysis of Fizzy by 37signals
study the architecture of this rails app. does it differ from a typical rails app? think hard.
Inspired by: @marckohlbrugge's analysis of Fizzy by 37signals
study the architecture of this rails app. does it differ from a typical rails app? think hard.
| # Add color coding based on Rails environment for safety | |
| if defined? Rails | |
| banner = if Rails.env.production? | |
| "\e[41;97;1m #{Rails.env} \e[0m " | |
| else | |
| "\e[42;97;1m #{Rails.env} \e[0m " | |
| end | |
| # Build a custom prompt |
To me, legacy code is simply code without tests. I’ve gotten some grief for this definition. What do tests have to do with whether code is bad? To me, the answer is straightforward, and it is a point that I elaborate throughout the book: Code without tests is bad code. It doesn’t matter how well written it is; it doesn’t matter how pretty or object-oriented or well-encapsulated it is. With tests, we can change the behavior of our code quickly and verifiably. Without them, we really don’t know if our code is getting better or worse.
Four Reasons to Change Software: For simplicity’s sake, let’s look at four primary reasons to change software.
| Note: this assumes you are using ZSH shell. | |
| ## Installation | |
| Install [asdf](https://github.com/asdf-vm/asdf): | |
| ``` | |
| $ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.4.0 | |
| $ echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zshrc | |
| $ echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.zshrc |
This is about how to split a GitHub pull request, following a real in-the-wild example.
So it happened that I once wanted to fix a bug (#832) on the shelljs repository.
I forked the repository, cloned it and created a new branch called ln-directory-dest. I fixed the bug, created a pull request, and implemented initial review feedback.
At this point, I had added the commits A, B, C, D, E and [F](https://github.com/Loilo/shelljs/commit/946ab48bf5cf9c8aac03407
rails new <project_name> -d postgresql --skip-turbolinks --skip-spring -T-d postgresql sets up the project to use PostgreSQL--skip-turbolinks & --skip-spring creates a project that does not use turbolinks or spring-T skips the creation of the test directory and use of Test::Unit| // setRowsData fills in one row of data per object defined in the objects Array. | |
| // For every Column, it checks if data objects define a value for it. | |
| // Arguments: | |
| // - sheet: the Sheet Object where the data will be written | |
| // - objects: an Array of Objects, each of which contains data for a row | |
| // - optHeadersRange: a Range of cells where the column headers are defined. This | |
| // defaults to the entire first row in sheet. | |
| // - optFirstDataRowIndex: index of the first row where data should be written. This | |
| // defaults to the row immediately below the headers. | |
| function setRowsData(sheet, objects, optHeadersRange, optFirstDataRowIndex) { |
| # app deps | |
| sudo yum install git | |
| # erlang deps | |
| sudo yum groupinstall "Development Tools" | |
| sudo yum install ncurses-devel | |
| # erlang | |
| wget http://www.erlang.org/download/otp_src_18.1.tar.gz | |
| tar -zxvf otp_src_18.1.tar.gz |
gem 'rails_12factor' to your Gemfile. This will add error logging and the ability for your app to serve static assets.bundleRAILS_ENV=production rake db:create db:migrate db:seedrake secret and copy the outputexport SECRET_KEY_BASE=output-of-rake-secretrake assets:precompile. This will create a folder public/assets that contains all of your assets.RAILS_ENV=production rails s and you should see your app.Remember to clobber your assets (rake assets:clobber) and re-precompile (rake assets:precompile) if you make changes.