Using git fixup helps you to speed up appending changes further back in the git history of your feature branch.
git commit --fixup aabbcc # Create a commit with the message "fixup! Commit message of aabbcc" git rebase -i --autosquash master
It would be nice if you could use this feature without the
-i flag, but until now it seems not to be possible. Read more about our recommended git workflow for feature branches.
bundle update GEMNAME will update a lot more gems than you think. E.g. when you do this:
bundle update cucumber-rails
... you might think this will only update
cucumber-rails. But it actually updates cucumber-rails and all of its dependencies. This will explode in your face when one of these dependencies release a new version with breaking API changes. Which is all the time.
In the example above updating
cucumber-rails will give you Capybara 2.0 (because
capybara is a dependency of `cucumber-rail...
When you have many changes, and you want to spread them across different commits, here is a way to stage all changes matching a given regular expression for a single commit.
Consider the following
git diff output.
diff --git a/file1.rb b/file1.rb index 806ca88..36d536b 100644 --- a/file1.rb +++ b/file1.rb @@ -1,7 +1,5 @@ -# Here is a useless comment. -# It will be removed. class File1 - def foo + def bar # ... end end diff --git a/file2.rb b/file2.rb index 550e1c6..600f4e3 100644 --- a/file2.rb +++ b/file2...
The linked GitHub repository is a bit like our "dev" cards deck, but groomed from a single person (Josh Branchaud). It includes an extensive list of over 900 TILs on many topics that might be interesting for most of us. (e.g. Ruby, Rails, Git, Unix..)
Here is an excerpt of all the Ruby TILs that were new to me. I encourage you to take your time to skim over the original list as well!
Simplecov is a code coverage tool. This helps you to find out which parts of your application are not tested.
Integrating this in a rails project with rspec, cucumber and parallel_tests is easy.
Add it to your Gemfile and bundle
group :test do gem 'simplecov', require: false end
.simplecov file in your project root:
SimpleCov.start 'rails' do # any custom configs like groups and filters can be here at a central place end
You can use local copies of gems in your
Gemfile like this:
gem 'spreewald', :path => '~/gems/spreewald'
As soon as you have bundled your project with the local copy of the gem, all code changes in the copy will be available on your project. So you can for example set a debugger or add console output in the gem and use it from your project.
If you checked out the gem with your versioning tool, you can easily reset your changes afterwards or make a pull request for the gem if you improved it.
Don't commit a Gemfile with local pat...
Because colors improve readability so much.
On Ubuntu 18.04 you can install it with
sudo apt install grc
For the impatient - try following commands:
grc netstat grc ping hostname grc tail /var/log/syslog grc ps aux
This is a personal post-mortem analysis of a project that was mainly build to provide a REST API to mobile clients.
For the API backend we used the following components:
The concept worked really good. Here are two points that were extraordinary compared to normal Rails project with many UI components:
Root Insurance runs their application as a monolithic Rails application – but they've modularized it inside its repository. Here is their approach in summary:
MySQL and MariaDB have an SQL mode setting which changes how MySQL behaves.
The SQL mode value is comprised of multiple flags like
"STRICT_TRANS_TABLES, NO_ZERO_IN_DATE". Each flag activates or disables a particular behavior.
The default SQL mode varies widly between versions of MySQL and MariaDB. In general, more recent versions of MySQL and MariaDB have stricter settings than older versions, and MySQL has stricter settings than the more liberal MariaDB.
If your app explodes ...
git rebase -i-> mark your commit with
git reset HEAD~(remove the marked commit, but keep its changes)
git rebase --continue
Basically, you will review the last
n commits and stop at the splittable commit. Then you'll undo that commit and put its changes into new commits at your liking.
Review commits (
git rebase -i HEAD~3 # or git rebase -i origin/master
Git will give you a list of commits, younge...
So you're hunting down a regression (or just a bug) and want to use
git bisect to find out when it was introduced? Smart kid.
If you have a shell command ready to reveal if your current state is good or bad, you can have git do most of the work for you.
git bisect run <your command> you can tell git that your command will reveal the issue; git on the other hand will use the return value of that call to decide if the state is good or bad.
git show branch:file. Examples:
git show HEAD~:bin/command git show origin/master:../lib/version.rb
Web applications can be used by multiple users at the same time. A typical application server like Passenger has multiple worker processes for a single app. In a distributed deployment setup like we use at makandra you will even have multiple application servers, each with their own worker pool.
This means that your code needs to deal with concurrent data access. The two main tools we use to cope with concurrency are database transactions and distributed locks. These two are not interchangeable. You ca...
This is a bookmarklet you can add to Chrome or Firefox which will allow you to create a story in Pivotal Tracker from a Zammad ticket. This might come in handy when creating stories for SWAT Teams.
But first you will have to set two variables in the script below:
pt_project_id: the ID of the Pivotal Tracker Project you want to add stories to. This can be found as part of the URL of the project (
pt_token: the Pivotal Tracker token used for authentication. Can be found in y...