All the hidden and not hidden features of Git and GitHub.
If you want to find the commits that touched a specific text in a file, use
git log -S 'text in the code' -- path/to/file.
Here is an example, where the move of the
convert_number_column_value(value) method in active record is traced (simplified output):
git log -n 1 --pretty=oneline -S 'convert_number_column_value(value)' -- activerecord/lib/active_record/base.rb ceb33f84933639d3b61aac62e5e71fd087ab65ed Split out most of the AR::Base code into separate modules :cake:
git show ceb33f84933639d3b61aac62e5e71fd087ab65ed…
We often use VCR to stub external APIs. Unfortunately VCR can have problems matching requests to recorded cassettes, and these issues are often hard to debug.
VCR's error messages mostly look like this and are not very helpful:
An HTTP request has been made that VCR does not know how to handle: POST http://another-site.de:9605/json/index
VCR fails if the request does not exactly look like the request it has recorded. If the request is d…
This is pretty much like defining subclasses through traits with the Modularity gem.
module MyConstantTrait as_trait do self::MY_CONSTANT = 'hello universe' end end
This would set
MY_CONSTANT for any class using the trait.
Of course you can also use parameters (for logic or for setting values, like here):
module ValuesTrait as_trait do |*args| self::VALUES = args end end class Foo does 'values', :f...
SVG is an acronym for "scalable vector graphics". SVGs should be used whenever an image can be described with vector instructions like "draw a line there" or "fill that space" (they're not suited for photographs and the like). Benefits are the MUCH smaller file size and the crisp and sharp rendering at any scale.
It's a simple, old concept brought to the web – half-heartedly. While actually all browsers pretend to support SVG, some barely complex use cases get you beyond common browser support.
In the bas…
You can have a command repeatedly executed and the output displayed. This is useful e.g. for monitoring file system changes with
ls, but has many more applications.
The update frequency is controlled by the
-n argument (default: 2s), which is locale-specific; i.e. you might need to use a comma as delimiter.
> watch -n 1.5 ls
This might be relevant for us since we're often managing customer documents in our apps.
I played around with the library and this is what I found:
-U parameter you can change how many lines are shown above and below a changed section.
git diff -U10 will show 10 lines above and below.
If you're trying to start a cloud-init based Ubuntu VM with KVM you will suffer long boot times and confusing output on the terminal. If you want to get rid of it you need to remove cloud-init.
echo 'datasource_list: [ None ]' | sudo -s tee /etc/cloud/cloud.cfg.d/90_dpkg.cfg
sudo apt-get purge cloud-init
Capybara-screenshot can automatically save screenshots and the HTML for failed Capybara tests in Cucumber, RSpec or Minitest.
Requires Capybara-Webkit, Selenium or poltergeist for making screenshots. They're saved into
The attached files contain config for cucumber integration and a
Then show me a screenshot step.
Icomoon.io offers a free app to build custom icon webfonts. It offers downloads as webfont set (.eot, .ttf, .woff, .woff2) or as icon set of SVG and/or PNG and many more file types, or even SVG sprites.
From my experience, the frontend developer should create the font, and not the designer. There are many tweaks required during font development, and routing changes over the designer imposes just too much overhead.
If you are fine with the default console diff most of the time but only sometimes want to use an external tool for viewing a diff, you can use
git diff with meld:
git difftool --tool=meld
For each file in the diff you will be asked if you want to view it using meld.
In order to properly replay previously recorded requests, VCR must match new
HTTP requests to a previously recorded one. By default, it matches on HTTP
method and URI, since that is usually deterministic and fully identifies the
resource and action for typical RESTful APIs.
You can customize how VCR matches requests using the
There are number of predefine…
Added hint about how to react on image load, how to listen to that event.
dconf-editor(as your user)
org / mate / panel / objects / clock / prefs
A good, space-saving format string for German users is
%d.%m. %H:%M. This shows the current date, month, hour and minute (e.g. 24.12. 23:59).
#reverse_order does not work with complex sorting constraints and may even silently create malformed SQL for rails < 5.
Take a look at this query which orders by the maximum of two columns:
Page.order('GREATEST(pages.published_from_de, pages.published_from_en) DESC').to_sql # => SELECT "pages".* FROM "pages" ORDER BY GREATEST(pages.published_from_de, pages.published_from_en) DESC
Rails 4 will not immediately raise but creates malformed SQL when trying to use
reverse_order on this query: