How to compare Go slices?

Problem: You have two slices that potentially share the same memory buffer meaning that appending to one can cause changes in another one. So, how to understand if two slices share memory? Let’s imagine we have a functions like: func IsMemoryShared(a, b []int) bool { ... } And we want to preserve following behaviour: a := []{1, 2, 3} b := []{1, 2, 3} IsMemoryShared(a, a) // true IsMemoryShared(a[:2]) // true IsMemoryShared(a, b) // false IsMemoryShared(a[1:0], b[1:0]) // false It is known that slice in Go backed by a struct and contain a pointer to a place in memory where slice data is stored and two integers - length and capacity of the slice.

How to open window in MacOS programmatically using Swift

Once I face a problem - “How can I create a normal window on Mac OS?”. Definitely it is possible to use XCode, generate new project using very modern tools and start writing events handling functions/callbacks/delegates/etc. But what if I want to do everything using code, for example last available version of Swift. And here I faced a problem cause there are no normal step-by-step guides which will explain how to do it.

Initial Commit

So, I want to Welcome everybody who at any circumstances get to this page. Recently I decided that it will be great at least to save some random things that I found interesting but also try to share it cause I strongly believe that if something become interesting to one person then this person is not alone and there is non zero probability that there is somebody else who can be interested in it.

Select a post to read