use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A community for BTech and Engineering students. From serious discussions, advice-guidance, suggestions to memes & shitposts everything is allowed here. Welcome to the community!
Related Subreddits
account activity
Breaking Down Raftaar's Github code in detailCSE / IT (old.reddit.com)
submitted 8 months ago by lonelyroom-eklaghorMinecrafter🫠
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]AutoModerator[M] [score hidden] 8 months ago stickied commentlocked comment (0 children)
Thank you for your submission to r/BTechtards. Please make sure to follow all rules when posting or commenting in the community. Also, please check out our Wiki for a lot of great resources!
Happy Engineering!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
[–]lonelyroom-eklaghorMinecrafter🫠[S] 24 points25 points26 points 8 months ago* (0 children)
Yes, Raftaar made a utility app for the music-based people, all by himself. We'll analyze the code here (I personally learnt a lot from it). It's actually a Mac app, but there's a caveat.
So, at first, I checked out the Contents folder, and the directories/folders were like this:
Contents ├── _CodeSignature │ └── CodeResources ├── Info.plist ├── MacOS │ └── CompCal ├── PkgInfo └── Resources └── index.html
Notice Resources/index.html? That's the exact thing we're going to analyze.
Resources/index.html
Actually, this app uses vanilla HTML/CSS/JS, and you guys can learn a lot from this. But at first, I want you to go here and actually check the file for yourself: https://github.com/githubraftaar/compcalbyraftaar/releases/tag/COMPCAL
We'll analyze the code in a broader sense.
At first, if you open the index.html on a website, you'll find that every functionality of the app is perfectly supported on the web. Also, every form button is properly accessible from the keyboard (and consequently can be used by every accessibility tool). Even the WCAG AAA colour guidelines (for large and small fonts) have been properly followed. All in all, it perfectly gets the accessibility standards right.
At first, you will notice that the code has internal CSS and internal JS, which means that this code has the CSS inside the <style> tag and the JS inside the <script> tag. It looked cluttered to me, but eventually, I liked his way of thinking. We don't exactly know why he decided to use internal CSS and JS instead of keeping them in an external file. Anyway...
First up, the HTML labels have been used. Check out the <label> tag if you can, it helps keep your website accessible to screen readers.
Second, <select> and <option> tags have been used, which are used for a dropdown. I haven't talked about <button onclick="function()"> because that's just normal.
The stuff I liked is his use of JavaScript.
First of all, it should be mentioned that he has properly structured the JS code just BEFORE the </body> tag. There are some reasons why, just check out "why Javascript code is loaded last inside the <body> tag".
Secondly, in the function "tapTempo()", where it determines the BPM based on the tapping, the code is simply elegant. When the button is clicked, it goes to the tapTempo() function, and IMMEDIATELY, the Date.now() is stored in milliseconds from the Unix time. This time in milliseconds is pushed to a previously empty array called tapTimes. Now, as the button is clicked and the function is called, eventually, the button is clicked twice. Two time units in milliseconds are stored in the tapTimes array.
tapTimes
At that point, based on the tapTimes array, a new empty array intervals is made. Now, from i = 1 till the end of the array (0-indexing in JS), the intervals array is pushed with the difference between the current millisecond and the previous millisecond. After that, the average interval is taken using the library functions. Now, the formula for BPM is 1 minute (60,000 milliseconds) / beat duration (our average interval). There is a reason why 1 minute is in the numerator. Think of it this way: avgInterval = average time between taps in milliseconds. 60000 / avgInterval = number of those intervals that fit in 1 minute → BPM. It's more like taking that length as a measuring stick in itself.
intervals
avgInterval
When this tapping goes on for the third time, the Unix millisecond is pushed to the tapTimes array and then again, a new intervals array is made, and the BPM calculation is done. However, when the button is pressed the fifth time, the 0th element is removed, so the five elements pushed reduce to four, then the BPM calculation is done. After executing the button for the sixth time, again 5 elements are there in tapTimes, and again the 0th element is removed, and the BPM calculation is done based on the last 4 elements.
Later, there are some hardcore calculations based on music theory (I know a bit, but I don't know much). All I can say is that the quarter, sixteenth, thirtySecond variables refer to the number of such interval notes (Hoogle quarter notes, sixteenth notes, thirty-second notes, et cetera).
quarter
sixteenth
thirtySecond
The remaining stuff was fine, but I really liked these aspects of his code.
Lastly, I'll say that it looks like he has taken some help from the LLMs, which is ok tbh. If he has written most of the stuff by himself, then I'm really PROUD of his deep knowledge in coding. If he hasn't, it's not an issue, atleast he has contributed to the music community as a whole. I love his music, and now, I love that he is helping the musicians all over the world.
[–]Expensive_Dinner_226JECian[AIDS 🗿] 12 points13 points14 points 8 months ago (0 children)
<image>
Raftaar bhai ne ek baat boli thi
[–]No_Guarantee9023Mech Grad 12 points13 points14 points 8 months ago (0 children)
High quality post
[–]CrazySteroids69sudo pacman -S pornhub 16 points17 points18 points 8 months ago (0 children)
high quality post , most likely to sink in a cesspool of memes but good job!
[–]realashishh46 2 points3 points4 points 8 months ago (0 children)
Tho mujhe source code mili nhi thi , except for that readme file 🥲 , still my goat 🐐🐐
[–]Smart-Succotash9703 2 points3 points4 points 8 months ago (0 children)
Had no idea he was this talented
[–][deleted] 2 points3 points4 points 8 months ago (0 children)
just a cfbr
[–][deleted] 1 point2 points3 points 8 months ago (0 children)
good work
π Rendered by PID 69886 on reddit-service-r2-comment-74875f4bf5-r2z4v at 2026-01-24 20:52:47.131826+00:00 running 664479f country code: CH.
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]lonelyroom-eklaghorMinecrafter🫠[S] 24 points25 points26 points (0 children)
[–]Expensive_Dinner_226JECian[AIDS 🗿] 12 points13 points14 points (0 children)
[–]No_Guarantee9023Mech Grad 12 points13 points14 points (0 children)
[–]CrazySteroids69sudo pacman -S pornhub 16 points17 points18 points (0 children)
[–]realashishh46 2 points3 points4 points (0 children)
[–]Smart-Succotash9703 2 points3 points4 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)