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
| package helpers | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "time" | |
| "github.com/sirupsen/logrus" | |
| ) |
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 ProfilePage extends React.Component { | |
| prepareMessage = (user) => { | |
| return 'Followed ' + user; | |
| } | |
| showMessage = (user) => { | |
| const message = this.prepareMessage(user); | |
| alert(message); | |
| }; |
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 Page extends React.Component { | |
| getPageName = () => { | |
| return this.props.name; | |
| } | |
| render() { | |
| return <h1>Welcome on page: {this.getPageName()}!</h1>; | |
| } | |
| } |
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
| // The page argument refers to any instance of the Page class, including the inherited one. | |
| // That is, we could equally pass an instance of the ProfilePage class if it inherits from Page, | |
| // since we will use their common method getPageName, and due to this we satisfy the principle of polymorphism. | |
| function logPageVisit(page, userName) { | |
| console.log(`${userName} has visited ${page.getPageName()}`); | |
| } |
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
| function ProfilePage(props) { | |
| const prepareMessage = (user) => { | |
| return 'Followed ' + user; | |
| } | |
| const showMessage = () => { | |
| const message = prepareMessage(props.user); | |
| alert(message); | |
| }; |
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
| // ... imports | |
| import { prepareMessage } from './prepareMessage' | |
| function ProfilePage(props) { | |
| const showMessage = () => { | |
| const message = prepareMessage(props.user); | |
| alert(message); | |
| }; | |
| const handleClick = () => { |
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
| import ( | |
| "encoding/json" | |
| "errors" | |
| "fmt" | |
| "net/http" | |
| chi "github.com/go-chi/chi/v5" | |
| "github.com/go-chi/render" | |
| validation "github.com/go-ozzo/ozzo-validation/v4" |
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
| import "go.uber.org/dig" | |
| func Dependencies() []any { | |
| return []any{InjectionConfig, InjectionPostgres} | |
| } | |
| func InjectionConfig() (config.Config, error) { | |
| return config.NewConfig() | |
| } |
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
| package kafka | |
| import ( | |
| "context" | |
| "encoding/json" | |
| "fmt" | |
| "github.com/segmentio/kafka-go" | |
| "io" | |
| ) |
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
| package math | |
| import ( | |
| "math" | |
| "golang.org/x/exp/constraints" | |
| ) | |
| type Numeric interface { | |
| constraints.Integer | constraints.Float |
OlderNewer