Skip to content

10

We can use the :empty selector in CSS to hide empty DOM element without JS.

.classname:empty {
display: none;
}

9

The theme-color value for the name attribute of the element indicates a suggested color that user agents should use to customize the display of the page or of the surrounding user interface.

<meta name="theme-color" media="(prefers-color-scheme: dark)" content="black" />

8

Functional Options Pattern in Go.

Functional is a design pattern that lets you build a complex struct using a variadic constructor that accepts zero or more functions as arguments.

7

You can check all the available versions of a Go module with this command.

Terminal window
go list -m -versions <module_name>

6

You can represents type “any” in Go using empty interface.

var a interface{}
a = 20
a = "a string"
a = true
a = []int{1, 2, 3}
a = struct {
Name string
Email string
} {"John", "[email protected]"}

5

Atoi stands for “ASCII to integer”.

4

The reason why the time in go playground starts at 2009-11-10 23:00:00 UTC is because that time is Go’s birthday.

3

When you highlight a whitespace in VSCode, it’ll show you if it’s a space or tabs. A dot represents a space and an arrow represents a tab.

2

You can use CSS mask-image to fade the image to transparent.

.transparent-gradient {
-webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
mask-image: linear-gradient(180deg, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
}

1

#00FF00 is not called green but lime.