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
def print_address(address): | |
def decorator(original_function): | |
print(f"Sending to {address}") | |
original_function() | |
return decorator |
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
input_string = "Lorem ipsum" | |
content = read_characters(input_string) | |
for item in content: | |
print(f"Current char {item}") |
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
ratings = {"Namaste": 3.8, "At Luigi": 3.7, "Peruvian": 4.4, "Hannes": 3.9, "Creperie": 4.2} | |
top_rated = {name: rating for name, rating in ratings.items() if rating > 4.0} | |
print(top_rated) |
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
reviews = [3.2, 1.1, 5.0, 4.4, 3.9, 4.8, 2.8, 4.1, 3.6] | |
top_reviews = [review for review in reviews if review > 4.0] | |
print(top_reviews) |
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
def read_characters(string): | |
for char in string: | |
print(f"Yield char {char}...") | |
yield char | |
content = read_characters(input_string) | |
print(content) |
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
AWSTemplateFormatVersion: '2010-09-09' | |
Description: Stack to create new S3 bucket | |
Resources: | |
myUniqueBucket: | |
Type: AWS::S3::Bucket | |
Properties: | |
BucketName: 'my-unique-bucket-name' |
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
val transition = TransitionInflater.from(context) | |
.inflateTransition(android.R.transition.slide_left) | |
transition.duration = 500 | |
stateLayout.showState(contentState, transition) |
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
val stateLayout = findViewById<StateLayout>(R.id.state_layout) | |
stateLayout.showState(loadingState) | |
... | |
stateLayout.showState(contentState) |
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 BindableContent(val text: String) : ViewState.Inflatable(R.layout.view_state_content) { | |
override fun onBindView(view: View) { | |
val textView = view.findViewById<TextView>(R.id.text) | |
textView.text = text | |
} | |
} |
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
val loadingState = ViewState.create(R.layout.view_state_loading) |