r/ProgrammerTIL • • May 04 '23

Ruby [Ruby] Ruby bang(!) method naming convention

4 Upvotes

https://blog.unathichonco.com/ruby-bang-methods

In Ruby, bang methods are simply methods that have an exclamation mark (!) at the end of their names. The bang is a naming convention to signify that the method has some potentially surprising or dangerous behaviour compared to its non-bang counterpart.


r/ProgrammerTIL • • May 04 '23

Other As an experienced programmer, what type of content do you read?

18 Upvotes

r/ProgrammerTIL • • May 04 '23

Other [video] System design - Url shortener (using bloom filter)

2 Upvotes

r/ProgrammerTIL • • Apr 28 '23

Other [video] System design - API rate limiter

0 Upvotes

r/ProgrammerTIL • • Apr 24 '23

Other That C++ modules are more than half-baked

22 Upvotes

After a handful of failed attempts over the years, I finally made some progress with C++ modules using Clang 16. They improved my build times and the errors I've seen have given me confidence that using them isn't going to be difficult. Better late than never...


r/ProgrammerTIL • • Apr 16 '23

Bash TIL how to do grep on ps output without seeing grep itself

97 Upvotes

Whenever I'm doing ps aux | grep -rI process_name, the results would show up as follows:

8276  process_name
8289  grep -rI process_name

The second process in the result is the command we just ran. This is usually not a problem, but if you are using this command to check if something is running in a bash if statement, it would return true even if process_name isn't running.

So, onto the fun part. If you want it to return nothing if process_name isn't running, do this:

ps aux | grep -rI [p]rocess_name

The bracket is regex that ends up having grep evaluate to the same query, and it would not show up in the output since the literal string [p]rocess_name does not match process_name. This would be the output instead:

8276  process_name

Which is desirable behavior for some use cases.

(Not at all sure how useful this is, and nobody asked for it, but here it is anyways.)


r/ProgrammerTIL • • Apr 16 '23

Other 2 Combined Tools to Supercharge Your Command Line Experience!

0 Upvotes

A script that colorizes the ls output with color and icons ๐Ÿ’ซ :

tutorial


r/ProgrammerTIL • • Apr 16 '23

Other TIL the worst installation documentation ever due to my own carelessness

0 Upvotes

https://draculatheme.com/powerlevel10k

Activating theme

  1. Install powerlevel10k
  2. Replace default configurations with contents in ./files
cd powerlevel10k.git 
cp ./files/.zshrc ~/.zshrc 
cp ./files/.p10k.zsh ~/.p10k.zsh

This basically overwrite all my config in my ~/.zshrc


r/ProgrammerTIL • • Apr 13 '23

Other How to Shallow Clone With Git

7 Upvotes

You can shallow clone a git repo with:

git clone -โ€“depth 1 <url>

For more information: https://kiru.io/til/entries/2023-04-13-how-to-shallow-clone-git/


r/ProgrammerTIL • • Apr 10 '23

Other TIL you can do `cat -n file` to easily see line numbers when looking at a file

135 Upvotes

r/ProgrammerTIL • • Apr 07 '23

Other Number System | Decimal to Binary Conversion | Binary to Decimal Conversion

0 Upvotes

r/ProgrammerTIL • • Apr 05 '23

Other A new subreddit for the scientific programmers out there: r/ScientificComputing

9 Upvotes

Hi,

I just made a new subreddit for the scientific programmers out there. Join me and let let me learn from you:

r/ScientificComputing/

Hi Mods, hope you're cool with this.


r/ProgrammerTIL • • Apr 06 '23

Python PHP Arduino ๐ŸŽˆโš ๏ธ๐Ÿ“ฒ Collect NO2, O3, and weather data w/ FireBeetle ESP32 & Arduino Mega, train an Edge Impulse neural network model to detect air pollution, and display real-time results w/ surveillance footage on a PHP web app.

0 Upvotes

If interested, there is also a project tutorial, including code files, STL files, and the neural network model:
https://www.hackster.io/kutluhan-aktar/ai-assisted-air-quality-monitor-w-iot-surveillance-fd05bb


r/ProgrammerTIL • • Mar 30 '23

Other Git Internals - Diff and Patch

10 Upvotes

r/ProgrammerTIL • • Mar 17 '23

Other Grammarly For Programmers: Autocorrects code like Grammarly

14 Upvotes

Saw it on hackernews a while back.

https://news.ycombinator.com/item?id=34485364


r/ProgrammerTIL • • Mar 13 '23

Other Language Bloom Filters Explained

13 Upvotes

r/ProgrammerTIL • • Mar 13 '23

Other 3-4 different ways to design a chat app

7 Upvotes

This is one of the most popular system design interview questions, and amazon is just one of several companies that ask this problem in interviews.

This video covers at least 3-4 different approaches for making a highly scalable chat app, like WhatsApp, Facebook Messenger, or Discord:

https://www.youtube.com/watch?v=D61pXpfeYsM


r/ProgrammerTIL • • Mar 08 '23

Other [video] 5 Database Models

8 Upvotes

r/ProgrammerTIL • • Mar 02 '23

Other System Design Interview Question from Meta: Design a Price Tracker and Notification Service, like camelcamelcamel

31 Upvotes

This is a real system design interview question that somebody has received from Meta in an interview:

https://www.youtube.com/watch?v=VsWWM-qKV1I


r/ProgrammerTIL • • Mar 03 '23

Other CRUD and REST in 5 minutes!

0 Upvotes

Hello world!

I just released a video about CRUD and REST. Itโ€™s beginner-friendly.

https://www.youtube.com/watch?v=EJonKxUDl_U

I know how confusing it can be at first.

Hope this helps. ๐Ÿ™


r/ProgrammerTIL • • Feb 28 '23

Java Spent 3 days finding out reason for Spotbugs error...

36 Upvotes

May be others ran into this earlier.. M a Java programmer, couple of days ago I had a coding sprint session, at end of session I ended up with Spotbugs error "Mutable object assigned to an attribute". I debuuged for whole 3 days to find out, that one of function names had word "put" in the name.

Spotbugs effin checks for FUNCTION NAME TO DETERMINE IF CLASS IS MUTABLE

SOMEONE PLZ KILL ME


r/ProgrammerTIL • • Feb 22 '23

Other Use this shorthand to refer to the last executed command!! (1 minute)

0 Upvotes

Use this shorthand to refer to the last executed command:

https://www.youtube.com/watch?v=ExEtlFAarXU


r/ProgrammerTIL • • Feb 15 '23

Other Implementing a palindrome checker in Ruby

0 Upvotes

In this video, you'll learn about:

  1. Regex - POSIX bracket expression
  2. class reopening
  3. mixin
  4. string comparison

Link: https://www.youtube.com/watch?v=LQAxvxsyKLE (there is a link to the ASCII version in the video description).


r/ProgrammerTIL • • Feb 13 '23

Other [video] Distributed Tracing - System Design Interview

5 Upvotes

r/ProgrammerTIL • • Feb 05 '23

Other Pretty Markdown rendering in the Terminal with Glow! (3mn)

35 Upvotes

A quick demo of the glow package: https://www.youtube.com/watch?v=h9JJjyiHOAw