Nguyễn Quang Hà

17 posts

Nguyễn Quang Hà

Nguyễn Quang Hà

@qanghaa

Dev

Katılım Şubat 2018
695 Takip Edilen21 Takipçiler
Nguyễn Quang Hà
Nguyễn Quang Hà@qanghaa·
@anthdm Like you're optimizing the memory usage using arena, but I dont understand the "leak" mean?
English
0
0
0
68
Anthony GG
Anthony GG@anthdm·
I'm just such a pragmatic programmer. Claude needs me I dont need Claude. We are not the same
Anthony GG tweet media
English
4
0
37
4.7K
Phuong Le
Phuong Le@func25·
💡 Golang Tip #73: Implement String() for enum with the stringer tool. Have you noticed when you print a duration in Go, like fmt.Println(time.Second), it shows up as "1s" instead of "1000000000" while time.Duration is int64. This is because the time.Duration type has a String() method that makes it print out in a way that's easy to understand. This method is part of the fmt.Stringer interface: For our own custom types to be just as clear, we can add a String() method too. Now, for enums, we often use numbers, but we also want to print out something that's easy to read. We might write a function with a switch statement to do this: However, this can be extra work. If we change the enum and forget to update this function, it can lead to problems. Luckily, Go has the Stringer tool, a command-line tool that can automatically create a String() method for us: > "Do we need to run it for every single type in different packages?" That's where "go generate" comes in. We just add a special comment in our code, and "go generate" will invoke the stringer and create the String() method for us: We can place the comment anywhere in the same package, but I prefer putting it right above of enum type. There are options to change how String() works: -trimprefix: to remove part of the name. If we have HeroTypeTank, it will normally show as "HeroTypeTank". With -trimprefix set to "HeroType", it will just show as "Tank". //go:generate stringer -type=HeroType -trimprefix=HeroType -linecomment: pick a completely different name. Just put the comment right after the enum value. HeroTypeAssassin // Something //go:generate stringer -type=HeroType -linecomment #golang
Phuong Le tweet mediaPhuong Le tweet mediaPhuong Le tweet mediaPhuong Le tweet media
English
3
4
79
4.1K
Nguyễn Quang Hà retweetledi
Sergio Pereira
Sergio Pereira@SergioRocks·
If you're looking for a new job, don't simply tell your interviewer: - "I've been a software engineer for 3 years" You should measure your own experience in qualitative terms. Not number of years. Try these ideas instead:
English
21
181
1.5K
341.5K
sysxplore
sysxplore@sysxplore·
Docker reference sheet🐳
sysxplore tweet media
English
2
57
294
14.7K
Rakesh Jain
Rakesh Jain@devops_tech·
Mastering Docker File 🐳 A thread explaining everything about a Docker File 👇
Rakesh Jain tweet media
English
33
428
1.8K
290K
Nguyễn Quang Hà retweetledi
Easlo
Easlo@heyeaslo·
I asked, "What’s one book that everyone should read?" Here are 10 MOST RECOMMENDED books everyone should read:
English
70
441
1.8K
0
Nguyễn Quang Hà retweetledi
Timo Heman
Timo Heman@timo__tech·
5 Steps To Understanding A Problem. A thread 🧵
Timo Heman tweet media
English
7
51
131
0
Zero To Mastery
Zero To Mastery@zerotomasteryio·
New #ZTM course coming out very soon... maybe this week!? It's one of the most requested topics. We're pumped and think you will be too. Here's your hint: 🦢 Let's hear some guesses. What do you think it is?
English
24
3
54
0
Nguyễn Quang Hà retweetledi
GUWEIZ
GUWEIZ@ttguweiz·
🔪
GUWEIZ tweet media
QME
41
3.1K
22K
0
Nguyễn Quang Hà retweetledi
Marko Denic
Marko Denic@denicmarko·
Free Web Development Resources: 🧵
English
1.1K
7.5K
19.9K
0
Nguyễn Quang Hà retweetledi
Simon Høiberg
Simon Høiberg@SimonHoiberg·
🔥 Massive JavaScript Compilation 🔥 30 Tips on writing better JavaScript, TypeScript and React 👇
English
25
337
1.2K
0
Nguyễn Quang Hà retweetledi
Axel Rauschmayer (also on 🦣)
How are async functions executed? #executing-async-functions-synchronous-start-asynchronous-settlement-advanced" target="_blank" rel="nofollow noopener">exploringjs.com/impatient-js/c…
Axel Rauschmayer (also on 🦣) tweet media
English
5
23
121
0