Today I Learned

Giant Monkeys Learning

3 posts by adrianfuhrmann

Construct an array with _ index

Blocksyntax:

years = Array.new(11) { Time.now.year + _1 }

Hier wird Array.new(11) verwendet, um ein Array mit 11 Elementen zu erstellen (einschließlich des aktuellen Jahres), und der Block { Time.now.year + _1 } berechnet das Jahr für jedes Element (beginnend mit dem aktuellen Jahr). _1 ist ein Platzhalter für den Index des Blocks (ab 0).

capybara: save page to disk

Today i learned that capybara's save_and_open_page statement is a gem to debug the current page capybara wants to test.

Rebase without having anything pushed yet

Prototyping should also be cleaning up commits before first push. How to do that?

Well, git rebase --interactive --root masterdoes the trick.

Thanks to https://troglobit.com/howto/rebase-without-an-origin/