Mira
735 subscribers
802 photos
25 videos
20 files
263 links
sporadic attempts at cybersec.
personal channel.

files: @mira_files
playlist: @the_coding_playlist
Download Telegram
Aceternity UI has some bugs in few components I used. like for example the Card-with-hover-effect takes array of objects with title, description and link property. then uses the link prop for the key. if you have an object with the same link prop, it throws an error. since it has hover event, there will be lots of console errors which isn't good for the overall performance. instead, they can use the index of the object being mapped as the key since the index is always unique in this context. other bugs i noticed is, some components have validDOMNesting warning, meaning for instance <h1> or <h2> cannot appear as a descendant of <p> or <h3>.
πŸ‘2
A little copying is better than a little dependency.


this is actually one of the wisdom words from Rob Pike (one of Golang's creator). it is all about simplicity vs. reusability. still a dependency is crucial but sometimes dependencies pose some risks like:

Increased build times: Larger projects take longer to compile.
Introducing security vulnerabilities: Outdated or compromised libraries pose risks.
Make your code harder to understand: You might not know how the library works internally.

In Go's minimalist philosophy, sometimes a few lines of copied code are easier to manage than a complex external library. This is especially true for small, self-contained functions or utility code.

Weigh the benefits of reusing code against the potential downsides of adding dependencies. In Go, simplicity often wins! that is why something like generics weren't supported till Go's version 1.2

#tips #golang
πŸ”₯2
😁4
πŸ’―4
in Go, to format Error strings use fmt.Errorf or fmt.Sprintf to create error strings that are clear, concise, and informative. Include relevant details, such as the operation that failed or the specific values involved.

func openFile(filename string) (io.Reader, error) {
file, err := os.Open(filename)
if err != nil {
return nil, fmt.Errorf("failed to open file %s: %w", filename, err) // Wrap the error with context
}
return file, nil
}

handling errors properly really saves debugging times

#tips #golang
This media is not supported in your browser
VIEW IN TELEGRAM
what people do with AI 🀦
🀣5πŸ”₯1
A sniper’s dream FINAL VERSION || Khapiter.boy.s
MegaSaverBot
here's the full version of the song btw πŸ—Ώ AI song artists be rocking
😁1
A constant struggle, a ceaseless battle to bring success from inhospitable surroundings, is the price of all great achievements.


have a great day y'all ✌️
❀1
❀3
ForwardingServiceRepositoryImpl (Archive)
She did it
ofc congrats to Jo. this guy is the reason i started a channel. he and @gugutlogs finally made it πŸ™Œ
πŸ”₯11
hey mates πŸ‘‹ so i've been working on a site where anyone can learn and reference Golang materials. Here's the site link:

https://gopher-notes.netlify.app/

Gopher Notes is an archive of Go notes from different resources. I reviewed and edited each part so that the material is up-to-date.

Features:

- Clear and Concise Notes: so you actually retain the info (no more forgetting what a 'defer' statement does lol)
- Exercises that'll test your coding skills
- Bookmark Feature that'll let you bookmark any topic
- Wrapping Up Sections: Additionally, I included this section for every topic that is covered.

If you're starting out in Go or want quick references, check it out. Plus it's totally open-source (giving it a star is appreciated lol). Let's build some awesome Go stuff together! πŸ—

[GitHub Repo]

#MyProjects #GopherNotes #golang #resources
πŸ”₯27πŸ‘2
make nested conditionals one-dimensional! use early returns from a function rather than if/else chains. this is essential not only in the aspect of Go, but also in any language.

take a look at the following code snippet:

func isValidPassword(password string) bool {
isValid := true
if len(password) < 8 {
isValid = false
} else {
if !containsUppercase(password) {
isValid = false
} else {
if !containsLowercase(password) {
isValid = false
} else {
if !containsNumber(password) {
isValid = false
}
}
}
}
return isValid
}

func containsUppercase(str string) bool {
// ... implementation ...
}

func containsLowercase(str string) bool {
// ... implementation ...
}

func containsNumber(str string) bool {
// ... implementation ...
}

the above code adds cognitive load for someone who's reading ur code (the number of entities they need to think about is a lot, so they might be lost in ur code).

but take a look at the more idiomatic approach to the code:

func isValidPassword(password string) bool {
if len(password) < 8 {
return false
}
if !containsUppercase(password) {
return false
}
if !containsLowercase(password) {
return false
}
if !containsNumber(password) {
return false
}
return true
}

func containsUppercase(str string) bool {
// ... implementation ...
}

func containsLowercase(str string) bool {
// ... implementation ...
}

func containsNumber(str string) bool {
// ... implementation ...
}


it uses early returns (guard clauses) and provide a linear approach to logic trees

#tips #code
@Mi_Ra_Ch
the JPEG-XL team at Google is teaming up with Firefox to make browsing experience safer and smoother.

why should you care? they're replacing the heavy decoder (100k+ lines of C++) with a lighter one built in Rust. this means faster load times and a more secure experience for all image-heavy sites (especially if you're like me who spends time on image-heavy sites). less bloat, more speedβ€”it's a win a win! hope it gets shipped

#JPEGXL
@Mi_Ra_Ch
ahh internet so bad rn cant even work. gotta be coz of national exam. good luck for everyone tho πŸ™Œ
❀4
no offense to @DaveDumps but when it comes from the guy itself, you gotta accept the fate πŸ˜‚ hope OpenSUSE has improved a lot since then
πŸ‘2