Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/ardanlabs/practical-go
/ functions
Functions
75 in github.com/ardanlabs/practical-go
⨍
Functions
75
◇
Types & classes
13
↓ 4 callers
Function
Relu
T is a "type constraint" (not a new type)
stats/stats.go:78
↓ 3 callers
Method
Found
* Exercise: - Add a "Keys" field to Player with is a slice of strings - Add a "Found(key string)" method to player - It should err if key is not one
game/game.go:127
↓ 3 callers
Function
Tokenize
Tokenize returns tokens (lower case) found in text.
nlp/nlp.go:16
↓ 2 callers
Function
Max
(values []T)
stats/stats.go:28
↓ 2 callers
Method
Move
(int, int)
game/game.go:111
↓ 2 callers
Function
NewItem
* Types of "new" or factory functions. func NewItem(x, y int) Item func NewItem(x, y int) *Item func NewItem(x, y int) (Item, error) func NewItem(x, y
game/game.go:174
↓ 2 callers
Function
SHA1Sig
SHA1Sig returns SHA1 signature of uncompressed file. Exercise: Decompress only if file name ends with ".gz" cat http.log.gz| gunzip | sha1sum
sha1/sha1.go:20
↓ 2 callers
Function
banner
(text string, width int)
banner/banner.go:23
↓ 2 callers
Function
health
()
nlp/cmd/httpd/main.go:116
↓ 2 callers
Function
median
* median - sort values - if odd number of values: return middle - return average of middles */
cart/cart.go:86
↓ 2 callers
Function
safeDiv
* Using named return values: - defer/recover to change return error value - documentation */
div/div.go:16
↓ 2 callers
Function
urlLog
(url string)
urls/urls.go:80
↓ 1 callers
Method
At
Exercise: Write Max function for ints or floats Don't use the built-in max function
stats/stats.go:47
↓ 1 callers
Function
KillServer
(pidFile string)
kill_server/kill_server.go:25
↓ 1 callers
Method
Move
Move moves i by delta x & delta y. "i" is called "the receiver" i is a pointer receiver * Value vs pointer receiver - In general use value semantics -
game/game.go:159
↓ 1 callers
Function
UserInfo
UserInfo return name and number of public repos from GitHub API.
github/github.go:49
↓ 1 callers
Function
appendInt
(s []int, v int)
cart/cart.go:108
↓ 1 callers
Function
bestBid
Written by Algo team, time to completion varies
rtb/rtb.go:41
↓ 1 callers
Function
bidOn
If algo didn't finish in time, return a default bid
_extra/rtb.go:20
↓ 1 callers
Function
bidOn
If algo didn't finish in time, return a default bid
rtb/rtb.go:20
↓ 1 callers
Function
concat
(s1, s2 []string)
cart/cart.go:101
↓ 1 callers
Function
div
(a, b int)
div/div.go:33
↓ 1 callers
Function
fanOutPool
(urls []string)
urls/urls.go:32
↓ 1 callers
Function
fileSig
(path string)
_extra/taxi_check.go:33
↓ 1 callers
Function
fileSig
(path string)
taxi_check/taxi_check.go:100
↓ 1 callers
Method
healthHandler
(w http.ResponseWriter, r *http.Request)
nlp/cmd/httpd/main.go:106
↓ 1 callers
Function
loadTokenizeCases
(t *testing.T)
nlp/nlp_test.go:32
↓ 1 callers
Function
moveAll
(ms []Mover, dx, dy int)
game/game.go:114
↓ 1 callers
Function
parseResponse
(r io.Reader)
github/github.go:68
↓ 1 callers
Function
parseSigFile
Parse signature file. Return map of path->signature
_extra/taxi_check.go:50
↓ 1 callers
Function
parseSigFile
Parse signature file. Return map of path->signature
taxi_check/taxi_check.go:117
↓ 1 callers
Function
sigWorker
(fileName, signature string, ch chan result)
taxi_check/taxi_check.go:88
↓ 1 callers
Function
sleepSort
* Channel semantics - send/receive to/from a channel will block until opposite operation(*) - guarantee of delivery - buffered channel has "n" non b
go_chan/go_chan.go:78
↓ 1 callers
Function
topN
topN returns the "n" most common words in freq.
freq/freq.go:50
↓ 1 callers
Function
urlCheck
(url string)
urls/urls.go:113
Function
ExampleStem
()
_extra/stemmer_test.go:9
Function
ExampleStem
()
nlp/stemmer/stemmer_test.go:9
Function
ExampleTokenize
()
nlp/example_test.go:9
Function
FuzzTokenizer
(f *testing.F)
nlp/nlp_test.go:97
Function
NewMatrix
(rows, cols int)
stats/stats.go:52
Function
Stem
Stem returns the stem of word. e.g. "working" -> "work"
_extra/stemmer.go:13
Function
Stem
Stem returns the stem of word. e.g. "working" -> "work"
nlp/stemmer/stemmer.go:13
Method
String
Rule of thumb: Accept interface, return types go install golang.org/x/tools/cmd/stringer@latest In ~/.zshrc export PATH="$(go env GOPATH)/bin:${PATH}"
game/game.go:65
Function
TestInCI
(t *testing.T)
nlp/nlp_test.go:91
Function
TestTokenize
(t *testing.T)
nlp/nlp_test.go:12
Function
TestTokenizeTable
Exercise: Read test cases from tokenize_cases.toml instead of in-memory slice
nlp/nlp_test.go:48
Function
Test_healthHandler
(t *testing.T)
nlp/cmd/httpd/main_test.go:12
Function
Tokenize
(text string)
_extra/nlp.go:13
Function
bestBid
Written by Algo team, time to completion varies
_extra/rtb.go:31
Function
demo
()
github/github.go:20
Function
fanOutResult
(urls []string)
urls/urls.go:89
Function
fanOutWait
(urls []string)
urls/urls.go:61
Function
main
()
game/game.go:8
Function
main
()
banner/banner.go:9
Function
main
()
urls/urls.go:11
Function
main
Code that runs before main - var expressions - init function
freq/freq.go:23
Function
main
()
kill_server/kill_server.go:11
Function
main
()
_extra/taxi_check.go:71
Function
main
()
_extra/rtb.go:9
Function
main
()
div/div.go:5
Function
main
()
taxi_check/taxi_check.go:38
Function
main
()
sha1/sha1.go:12
Function
main
()
cart/cart.go:8
Function
main
Given a github user login, return name and number of public repos
github/github.go:14
Function
main
()
rtb/rtb.go:9
Function
main
()
hw/hw.go:7
Function
main
()
stats/stats.go:9
Function
main
()
nlp/cmd/httpd/main.go:36
Function
main
()
select/select.go:9
Function
main
()
count/count.go:10
Function
main
()
go_chan/go_chan.go:8
Function
main
()
empty/empty.go:5
Function
mapDemo
()
freq/freq.go:62
Method
stemHandler
(w http.ResponseWriter, r *http.Request)
nlp/cmd/httpd/main.go:71
Method
tokenizeHandler
(w http.ResponseWriter, r *http.Request)
nlp/cmd/httpd/main.go:78