Medium is a popular blogging platform. It attracts almost 200 million unique visits monthly.
It is a wonderful place to start your writing career. You have a huge audience and a great community on your side.
This piece shows you everything you need to know about writing Medium.com. I wish…
I’ve collected a list of useful tips and “tricks” you can use to write professional Swift code.
I hope you enjoy it.
Ternary operators allow us to make
if...else statements shorter.
The syntax is:
condition ? true : false
For example, let’s compress this if-else expression:
let money = 100…
Here is the link to the complete code for the animated gradient ViewController.swift. To learn how it’s done, stick around.
A gradient is a powerful effect. Choosing colors that look good together is essential to make it stand out. You may find color samples in uiGradients useful.
I use these…
with statement in Python helps you with resource management. It ensures no resources are accidentally left open.
with statement is a replacement for commonly used
finally error-handling statements.
A common example of using the
with statement is opening a file.
To open and write to a file in…
The distance to the horizon depends on how high you are observing it.
If you are 5'6'’, standing on the shoreline, the horizon appears 2.75 miles away from you.
In this article, you learn how to calculate the distance to the horizon with a simple formula.
There are 4 quarts in 1 gallon.
This is easy to remember. Consider the word “quart”. It refers to a quarter.
When speaking about volumes, a quart is a quarter of a gallon. In other words, it is one-fourth of a gallon—so there are four of them in a gallon.
The resolution for 4k is
3840 x 2160
This means a 4k screen has a whopping 8.3 million pixels in total. This is 36 times more than a good old 480p SD screen!
The 4k refers to 4000. But the resolution of 4k is “only”
3840 x 2160.
Python switch-case statements are here! And they are actually called match-case statements.
This means you can soon replace this type of if-else mess:
With a more compact match-case statement:
In some situations, the latter approach is better. It can make the code more readable and less repetitive.