How to create your npm card

Lately, our company started growing so I had to start interviewing frontend engineers, UI/UX designers and other developers who focus on the UI aspect of web development At first, my expectation was that the process wouldn’t involve anything else but talking to a person. I was caught off guard about the fact that a lot these amazing developers shared with me their portfolios, websites or even demos. It was surprising and inspiring to see some of the creative ways people standout. ...

July 5, 2020 · 5 min · oschvr

Merge Sort in Go and Javascript

Here’s my implementation of the Mergesort algorithm in Golang package main import ( "fmt" "io/ioutil" "math/rand" "strconv" "strings" "time" ) func main() { start := time.Now() arr := randArr(20) // Merge sort array fmt.Println("\n Sorted \n", mergeSort(arr)) fmt.Println("Sorted in: ", time.Since(start)) } // Function to generate random array func randArr(size int) []int { arr := make([]int, size, size) rand.Seed(time.Now().UnixNano()) for i := 0; i < size; i++ { arr[i] = rand.Intn(99) } return arr } // Merge sort accepts an array and recursively sorts it func mergeSort(arr []int) []int { if len(arr) < 2 { return arr } middle := (len(arr)) / 2 return merge(mergeSort(arr[:middle]), mergeSort(arr[middle:])) } // Merges two arrays into one func merge(left, right []int) []int { var sortedArr []int // Check for inversions while array for len(left) > 0 && len(right) > 0 { if left[0] <= right[0] { sortedArr = append(sortedArr, left[0]) left = left[1:] // Just like shift(), remove first and return slice } else { sortedArr = append(sortedArr, right[0]) right = right[1:] // Just like shift(), remove first and return slice } } // Append to sortedArr if no inversions and for len(left) > 0 { sortedArr = append(sortedArr, left[0]) left = left[1:] // Just like shift(), remove first and return slice } for len(right) > 0 { sortedArr = append(sortedArr, right[0]) right = right[1:] // Just like shift(), remove first and return slice } return sortedArr } and here’s in Javascript ...

May 26, 2019 · 2 min · oschvr

Shortest Fibonacci

Here’s an incredibly short anonymous fibonacci function in Js. It takes a parameter n to calculate the fibonacci number at position n ((n) => (n <= 1 ? n : n - 1 + n - 2))(5);

May 15, 2019 · 1 min · oschvr