This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git rebase --onto live $(git merge-base --fork-point master) $(git branch --show-current) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "checks": [ | |
| { | |
| "fd": "81109", | |
| "state": "approved", | |
| "number": "81109", | |
| "date": "2020-08-09", | |
| "actual_draw_date": "2020-08-12", | |
| "prise": "Сертификат на 2000р.", | |
| "prise_slug": "sertificate_2000", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| city: "New York", | |
| state: "NY", | |
| latitude: 40.7127837, | |
| longitude: -74.0059413 | |
| }, | |
| { | |
| city: "Los Angeles", | |
| state: "CA", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| highlight -O rtf vanilla.js --line-numbers --font-size 24 --font Inconsolata --style solarized-dark -W -J 50 -j 3 --src-lang js | pbcopy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Translit | |
| RU_TO_EN = { | |
| 'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', | |
| 'ё' => 'yo', 'ж' => 'zh', 'з' => 'z', 'и' => 'i', 'й' => 'j', 'к' => 'k', | |
| 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', | |
| 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'ts', | |
| 'ч' => 'ch','ш' => 'sh','щ' => 'sch','ъ' => '','ы' => 'y', 'ь' => '', | |
| 'э' => 'je', 'ю' => 'yu', 'я' => 'ya' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let!(:user) { create :user } | |
| before do | |
| allow(User).to receive(:find).with(user.id).and_return(user) | |
| end | |
| it 'updates the user' do | |
| expect(user).to receive(:update!).with(name: 'Alex') | |
| post "/users/#{user.id}", params: { name: 'Alex' } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let!(:user) { create :user } | |
| it 'updates the user' do | |
| expect_any_instance_of(User).to receive(:update!).with(name: 'Alex') | |
| post "/users/#{user.id}", params: { name: 'Alex' } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # http://localhost:3000/users/:id/update | |
| def update | |
| user = User.find(params[:id]) | |
| user.update!(name: params[:name]) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let!(:user) { create :user } | |
| it 'updates the user' do | |
| expect(user).to receive(:update!).with(name: 'Alex') | |
| post "/users/#{user.id}", params: { name: 'Alex' } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| hash = { user: { name: 'Peter' } } | |
| hash[:user][:name] # => "Peter" | |
| hash = {} | |
| hash[:user][:name] # => NoMethodError: undefined method `[]' for nil:NilClass | |
| hash[:user] && hash[:user][:name] # => "Peter" | |
| { user: { name: 'Peter' } }.dig(:user, :name) # => "Peter" |
NewerOlder