This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"meta": { // Basic meta information about the event. | |
"source": "stock-system", | |
"published_at": "2021-07-17T06:50:33Z" | |
}, | |
"data": { //Represents the main data model of the event | |
// Unique identifier to identify the article across all systems in the company | |
"article_id": "423b7e24-e6d9-11eb-ba80-0242ac130004", | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
func main() { | |
// A slice of sample websites | |
urls := []string{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func sum(a int, b int, c chan int) { | |
c <- a + b // send sum to c | |
} | |
func main() { | |
c := make(chan int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
"sync" | |
) | |
func main() { | |
// A slice of sample websites |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
"time" | |
) | |
func main() { | |
// A slice of sample websites |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
func main() { | |
// A slice of sample websites | |
urls := []string{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
func main() { | |
// A slice of sample websites | |
urls := []string{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This class represents a service which can be used to find all the reachble points | |
# from a point specified in a matrix. | |
# Any point is reachable only by moving horizontally or vertically and not diagonally. | |
class ManhattanDistance | |
attr_reader :block_matrix, :center_x, :center_y | |
# Takes input of a matrix which has values all 0 and only one 1 | |
# The distance would be calculated from the point which has 1 | |
def initialize(block_matrix) | |
@block_matrix = block_matrix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "github.com/julienschmidt/httprouter" | |
//Reads from the routes slice to translate the values to httprouter.Handle | |
func NewRouter(routes Routes) *httprouter.Router { | |
router := httprouter.New() | |
for _, route := range routes { | |
var handle httprouter.Handle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "github.com/julienschmidt/httprouter" | |
/* | |
Define all the routes here. | |
A new Route entry passed to the routes slice will be automatically | |
translated to a handler with the NewRouter() function | |
*/ | |
type Route struct { |
NewerOlder