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
| const bracketList = '[]{}()' | |
| const bracketNumber = bracketList.length / 2 | |
| const hasBalancedBrackets = str => { | |
| const stack = [] | |
| let bracketOpenLastIndex = null | |
| let bracketOpenIndex = null | |
| let bracketCloseIndex = null |
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
| interface InjectWheels { | |
| public void setWheels(Wheels w); | |
| } | |
| interface InjectBattery { | |
| public void setBattery(Battery b); | |
| } | |
| class Car implements InjectWheels, InjectBattery { | |
| Wheels injectedWheels; |
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
| renderRow : String -> Int -> Html Msg | |
| renderRow title data = | |
| tr [] | |
| [ td [] [ text title ] | |
| , td | |
| [ style | |
| [ ( "text-align", "right" ) | |
| , ( "min-width", "5rem" ) | |
| ] | |
| ] |
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
| maximum : List comparable -> Maybe comparable |
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
| newestCopyright = | |
| List.maximum copyrightYears | |
| |> Maybe.withDefault 0 |
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
| type alias Book = | |
| { isbn : String | |
| , title : String | |
| , authors : List String | |
| , copyright : Int | |
| , edition : Maybe String | |
| } | |
| type alias LibraryReport = | |
| { numBooks : Int |
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 Car{ | |
| private Wheels wheel; | |
| private Battery battery; | |
| /* | |
| Где-то в нашей кодовой базе мы инстанцирует объекты, требующие этот класс | |
| Два варианта реализации внедрения зависимостей: | |
| 1. На основе конструктора | |
| 2. На основе setter-метода | |
| */ |
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 Car { | |
| private Wheels wheel = new MRFWheels(); | |
| private Battery battery = new ExcideBattery(); | |
| ... | |
| ... | |
| } |
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
| const displayItems = storeItems | |
| .filter(filterBy(systemCriteria)) | |
| .filter(filterBy(customerCriteria)) | |
| .sort(sortBy(primaryDimension, secondaryDimension)); |