Skip to content

Instantly share code, notes, and snippets.

View dkhmelenko's full-sized avatar

Dmytro Khmelenko dkhmelenko

View GitHub Profile
def print_address(address):
def decorator(original_function):
print(f"Sending to {address}")
original_function()
return decorator
input_string = "Lorem ipsum"
content = read_characters(input_string)
for item in content:
print(f"Current char {item}")
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)
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)
def read_characters(string):
for char in string:
print(f"Yield char {char}...")
yield char
content = read_characters(input_string)
print(content)
AWSTemplateFormatVersion: '2010-09-09'
Description: Stack to create new S3 bucket
Resources:
myUniqueBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: 'my-unique-bucket-name'
val transition = TransitionInflater.from(context)
.inflateTransition(android.R.transition.slide_left)
transition.duration = 500
stateLayout.showState(contentState, transition)
val stateLayout = findViewById<StateLayout>(R.id.state_layout)
stateLayout.showState(loadingState)
...
stateLayout.showState(contentState)
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
}
}
val loadingState = ViewState.create(R.layout.view_state_loading)