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
from collections import defaultdict | |
class Graph: | |
def __init__(self): | |
self.nodes = defaultdict(set) | |
def add_node(self, node, neighbors): | |
self.nodes[node].update(neighbors) |
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 value | |
func If[E any](ok bool, then, or E) E { | |
if ok { | |
return then | |
} | |
return or | |
} |
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
func Await[C context.Context, E any](ctx C, ch <-chan E) (E, bool) { | |
select { | |
case <-ctx.Done(): | |
var empty E | |
return empty, false | |
case v, ok := <-ch: | |
return v, ok | |
} | |
} |
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
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDiGuEm2gFKN6ILanclMT1iYNLjraF9FdiTgH+bPSOAO4kmJusKDjtgmzGfI8SoUs4AxxcNX1ZsJB9u+lYTKW63CRupCeiZP1MnyKMHbDz+iTcTph8UeFGvM4TbMkPEUhXNBlk8t8VHARK0c50sAChhjRIKNnqnWbncGy49wqDFVQqqScslHZMozJIKmvbFX9tf8QfkNpfGlo9WhTMGBQV2Sm2RABd77j/F+5mSGOSHRVYhYlb33aIT3vDm3QQxJ25valspnmjGvHh6cvolUId+pNY2yJ88LG7m9QJnPHKT6KLYjWqcL9S8XIwGXBvGk6hdNR4j/hU23dWqCJxi6p3yrFPF2ikKV9srDRKRY09cgsF/rgIYB0D7tKLnYLT0Eh+h0b6P0zZNvNSvBc6/eBGG2v2teHsOSVtwlgCGF6IJJp08IkRVzzUiHN6V3HxvTt5LkGRNVy0BR4tgyvJulslnxhg8ePVshSTwyXt0D9UhFxuFhVwnxyTt6VXZDh8vnzc= merlin@gekata |
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
{ | |
"workbench.iconTheme": "vscode-great-icons", | |
"editor.minimap.enabled": false, | |
"go.formatTool": "goimports", | |
"go.useLanguageServer": true, | |
"[json]": { | |
"editor.defaultFormatter": "HookyQR.beautify" | |
}, | |
"clock.alignment": "Right", | |
"clock.format": "🕑HH:MM 📅 d mmm yyyy", |
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
import ( | |
"testing" | |
"text/template" | |
) | |
func testTemplate(test *testing.T, pattern string) { | |
test.Run(pattern, func(test *testing.T) { | |
var _, err = template.ParseGlob(pattern) | |
if err != nil { | |
test.Fatal(err) |
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 swag | |
type Swag struct { | |
Openapi string `yaml:"openapi"` | |
Info Info `yaml:"info"` | |
Servers []Servers `yaml:"servers"` | |
Paths map[string]Path `yaml:"paths"` | |
} | |
type Info struct { |
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
// Copyright 2020 Petrukhin Pavel | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 | |
// | |
// Unless required by applicable law or agreed to in writing, software | |
// distributed under the License is distributed on an "AS IS" BASIS, |
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 wr | |
import "io" | |
type Wr struct { | |
err error | |
written int64 | |
w io.Writer | |
} |
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
type t interface { | |
Errorf(string, ...interface{}) | |
} | |
func testStringer(test t, str stringer, expected ...string) { | |
var value = str.String() | |
if value == "" { | |
test.Errorf("%T.String() must not return an empty string", str) | |
return |
NewerOlder