<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muhammad Ahmed</title>
    <description>The latest articles on DEV Community by Muhammad Ahmed (@ahmedsandhu).</description>
    <link>https://dev.to/ahmedsandhu</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1153146%2F69c8a7b8-2526-46c4-ae2f-b209dfb4ffe9.png</url>
      <title>DEV Community: Muhammad Ahmed</title>
      <link>https://dev.to/ahmedsandhu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ahmedsandhu"/>
    <language>en</language>
    <item>
      <title>Calculating Overtime in JavaScript: Get the Regular Rate Right</title>
      <dc:creator>Muhammad Ahmed</dc:creator>
      <pubDate>Tue, 17 Nov 2026 12:43:48 +0000</pubDate>
      <link>https://dev.to/ahmedsandhu/calculating-overtime-in-javascript-get-the-regular-rate-right-4n19</link>
      <guid>https://dev.to/ahmedsandhu/calculating-overtime-in-javascript-get-the-regular-rate-right-4n19</guid>
      <description>&lt;p&gt;Overtime calculation in JavaScript looks like a ten-minute job. Multiply the extra hours by 1.5 and you're done, right? It works until a bonus or a shift differential shows up, and then the numbers drift.&lt;/p&gt;

&lt;p&gt;Here's a small, testable way to do it properly, with the regular rate handled the way US payroll expects.&lt;/p&gt;

&lt;p&gt;The rule in one paragraph&lt;/p&gt;

&lt;p&gt;Under the US Fair Labor Standards Act (FLSA), covered non-exempt employees get at least 1.5 times their regular rate for every hour over 40 in a workweek. The regular rate is the total straight-time pay for the week divided by the total hours worked. That's the catch: it isn't always the hourly wage.&lt;/p&gt;

&lt;p&gt;Step 1: the naive version&lt;/p&gt;

&lt;p&gt;This is what most people write first:&lt;/p&gt;

&lt;p&gt;javascript&lt;br&gt;
function naiveOvertime(rate, hours) {&lt;br&gt;
  const regular = Math.min(hours, 40) * rate;&lt;br&gt;
  const overtime = Math.max(hours - 40, 0) * rate * 1.5;&lt;br&gt;
  return regular + overtime;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;console.log(naiveOvertime(24, 47)); // 1212&lt;/p&gt;

&lt;p&gt;For a plain hourly wage, it's correct. A $24 rate and 47 hours gives $960 + $252 = $1,212.&lt;/p&gt;

&lt;p&gt;Step 2: add the regular rate&lt;/p&gt;

&lt;p&gt;Now let's say someone earns $22 an hour, works 45 hours, and gets a $120 production bonus that was promised in advance. That bonus is part of straight-time pay, so it raises the regular rate.&lt;/p&gt;

&lt;p&gt;Because straight time has already been paid for every hour, you only owe the extra half on the overtime hours.&lt;/p&gt;

&lt;p&gt;javascript&lt;br&gt;
function overtimePay({ rate, hours, bonus = 0, multiplier = 1.5, threshold = 40 }) {&lt;br&gt;
  const otHours = Math.max(hours - threshold, 0);&lt;br&gt;
  const straightTime = rate * hours + bonus;&lt;br&gt;
  const regularRate = straightTime / hours;&lt;br&gt;
  const premium = otHours * regularRate * (multiplier - 1);&lt;/p&gt;

&lt;p&gt;return {&lt;br&gt;
    regularRate: round(regularRate),&lt;br&gt;
    premium: round(premium),&lt;br&gt;
    total: round(straightTime + premium),&lt;br&gt;
  };&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;const round = (n) =&amp;gt; Math.round(n * 100) / 100;&lt;/p&gt;

&lt;p&gt;console.log(overtimePay({ rate: 22, hours: 45, bonus: 120 }));&lt;br&gt;
// { regularRate: 24.67, premium: 61.67, total: 1171.67 }&lt;/p&gt;

&lt;p&gt;Walk through the numbers: $22 × 45 = $990, plus the $120 bonus is $1,110. Divide by 45 hours and the regular rate is about $24.67. The half-time premium on 5 overtime hours is 5 × $24.67 × 0.5 = $61.67, so the total is $1,171.67.&lt;/p&gt;

&lt;p&gt;Ignoring the bonus in the overtime math would give $1,165. That's $6.67 short. It's small on one check, but it repeats every pay period.&lt;/p&gt;

&lt;p&gt;Why the multiplier is a parameter&lt;/p&gt;

&lt;p&gt;Time and a half is the federal minimum, not a ceiling. Contracts and some local rules set higher premiums, and double time is common on certain holidays. Passing multiplier in keeps the function honest. The time and a half calculator uses the same idea: the multiplier is an input, and 1.5 is just the default.&lt;/p&gt;

&lt;p&gt;Step 3: write tests before you trust it&lt;/p&gt;

&lt;p&gt;Money code deserves tests. Three cases cover the edges:&lt;/p&gt;

&lt;p&gt;javascript&lt;br&gt;
import assert from "node:assert";&lt;/p&gt;

&lt;p&gt;// Under 40 hours: no overtime&lt;br&gt;
assert.equal(overtimePay({ rate: 20, hours: 38 }).total, 760);&lt;/p&gt;

&lt;p&gt;// Exactly 40 hours: no overtime&lt;br&gt;
assert.equal(overtimePay({ rate: 20, hours: 40 }).total, 800);&lt;/p&gt;

&lt;p&gt;// Over 40 with a bonus&lt;br&gt;
assert.equal(overtimePay({ rate: 20, hours: 44, bonus: 100 }).total, 1024.55);&lt;/p&gt;

&lt;p&gt;The last case is worth checking by hand. Straight time is 44 × $20 + $100 = $980. The regular rate is $980 / 44 = $22.27. The premium is 4 × $22.27 × 0.5 = $44.55, which makes $1,024.55.&lt;/p&gt;

&lt;p&gt;Step 4: two pay rates in one week&lt;/p&gt;

&lt;p&gt;Some people work two roles at different rates. The federal method is a weighted average, so you add up all straight-time pay and divide by all hours.&lt;/p&gt;

&lt;p&gt;javascript&lt;br&gt;
function multiRateOvertime(shifts, threshold = 40) {&lt;br&gt;
  const hours = shifts.reduce((sum, s) =&amp;gt; sum + s.hours, 0);&lt;br&gt;
  const straightTime = shifts.reduce((sum, s) =&amp;gt; sum + s.hours * s.rate, 0);&lt;br&gt;
  const regularRate = straightTime / hours;&lt;br&gt;
  const premium = Math.max(hours - threshold, 0) * regularRate * 0.5;&lt;br&gt;
  return round(straightTime + premium);&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;console.log(multiRateOvertime([&lt;br&gt;
  { hours: 30, rate: 18 },&lt;br&gt;
  { hours: 18, rate: 24 },&lt;br&gt;
])); // 1053&lt;/p&gt;

&lt;p&gt;Check it by hand: (30 × $18) + (18 × $24) = $972 over 48 hours, so the regular rate is $20.25. The premium on 8 overtime hours is 8 × $20.25 × 0.5 = $81, and the total is $1,053. Your payroll system may use a different method if the employee and employer agreed to it in advance, so confirm before you rely on this.&lt;/p&gt;

&lt;p&gt;Things the function doesn't handle&lt;/p&gt;

&lt;p&gt;Keep this list in a comment so the next developer sees it:&lt;/p&gt;

&lt;p&gt;Daily overtime. Some states, like California, count hours over 8 in a day. This function only looks at the week.&lt;br&gt;
Pay-period boundaries. Each workweek must be calculated on its own before you add them up.&lt;br&gt;
Exempt employees. Whether someone is exempt depends on duties and salary, not job title.&lt;br&gt;
Rounding rules. Round at the end, not at every step.&lt;br&gt;
Sanity-check against a calculator&lt;/p&gt;

&lt;p&gt;When you're building anything payroll-related, compare your output with an independent source before it ships. A free tool like OT Pay Calculator is handy for this: enter a rate, hours, and multiplier, and compare the gross pay with what your function returns. If the figures differ, check the hour total first, then the rate, then the multiplier.&lt;/p&gt;

&lt;p&gt;Wrapping up&lt;/p&gt;

&lt;p&gt;Good overtime calculation in JavaScript comes down to three habits: compute the regular rate from total straight-time pay, treat the multiplier as an input, and test the boundary cases. Figures here are for learning and planning, not legal or tax advice, and rules vary by state.&lt;/p&gt;

&lt;p&gt;What edge case has bitten you in payroll code? Share it in the comments.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Palette of Possibilities: How Art Fuels Creativity in Everyday Life</title>
      <dc:creator>Muhammad Ahmed</dc:creator>
      <pubDate>Thu, 15 Feb 2024 08:09:19 +0000</pubDate>
      <link>https://dev.to/ahmedsandhu/palette-of-possibilities-how-art-fuels-creativity-in-everyday-life-1k80</link>
      <guid>https://dev.to/ahmedsandhu/palette-of-possibilities-how-art-fuels-creativity-in-everyday-life-1k80</guid>
      <description>&lt;p&gt;Art is more than just a canvas adorned with colors or a stage filled with performers; it is a dynamic force that shapes our thoughts, emotions, and daily experiences. In this exploration of the intricate relationship between art and creativity, we'll delve into the profound impact art has on our everyday lives.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;At its core, art encompasses a diverse range of creative expressions, from traditional paintings to contemporary digital masterpieces. It goes beyond aesthetics, serving as a powerful catalyst for unlocking creativity in our day-to-day existence.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Psychology Behind Art and Creativity
&lt;/h2&gt;

&lt;p&gt;Art has a profound psychological impact on individuals. Scientific studies reveal that exposure to art stimulates various regions of the brain, enhancing cognitive functions and promoting emotional well-being. The intricate connection between art and creativity lies in its ability to evoke emotions and inspire innovative thinking.&lt;/p&gt;

&lt;h2&gt;
  
  
  Art in Various Forms
&lt;/h2&gt;

&lt;p&gt;The world of art is expansive, encompassing visual, performing, and literary forms. Each form contributes uniquely to the creative experience, offering a palette of possibilities for individuals to explore and engage with their creative selves.&lt;/p&gt;

&lt;h2&gt;
  
  
  Art as a Source of Inspiration
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://xhibitionhouse.com/article/view/What%20are%20Elements%20and%20Principles%20of%20Art/38"&gt;Art serves&lt;/a&gt; as a wellspring of inspiration, fueling imagination and breaking through creative blocks. Whether admiring a painting or attending a live performance, individuals often find renewed motivation and fresh perspectives through artistic encounters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Incorporating Art into Everyday Life
&lt;/h2&gt;

&lt;p&gt;Integrating art into daily life extends beyond museums and galleries. Decorating living spaces with artwork and infusing artistic elements into routines create an environment that nurtures creativity on a consistent basis.&lt;/p&gt;

&lt;h2&gt;
  
  
  Art and Stress Reduction
&lt;/h2&gt;

&lt;p&gt;Art's therapeutic qualities are widely acknowledged, offering a valuable tool for stress reduction. Engaging in creative expression, whether through painting, music, or writing, provides a meditative escape, promoting mindfulness and mental well-being.&lt;/p&gt;

&lt;h2&gt;
  
  
  Artistic Communities and Collaboration
&lt;/h2&gt;

&lt;p&gt;Artistic communities foster collaboration and connection among like-minded individuals. Whether through local art groups or online platforms, the shared passion for creativity creates opportunities for collaborative projects and mutual inspiration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cultivating a Creative Mindset
&lt;/h2&gt;

&lt;p&gt;Fostering a creative mindset involves creating an environment that encourages experimentation and embraces mistakes as part of the learning process. Nurturing creativity becomes a way of life, leading to continuous personal and professional growth.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Impact of Art on Innovation
&lt;/h2&gt;

&lt;p&gt;Beyond personal creativity, art plays a pivotal role in innovation. The ability to think outside the box, a skill cultivated through artistic endeavors, contributes to problem-solving and innovation in various industries.&lt;/p&gt;

&lt;h2&gt;
  
  
  Art as a Cultural Connector
&lt;/h2&gt;

&lt;p&gt;Art serves as a powerful bridge between diverse cultures. Through creative expression, individuals can explore and appreciate the rich tapestry of global artistic traditions, fostering understanding and unity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploring Personal Artistic Expression
&lt;/h2&gt;

&lt;p&gt;Discovering one's artistic voice involves experimenting with different mediums and styles. This exploration allows individuals to develop a unique creative identity, fostering a deeper connection with their creative instincts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Nurturing Creativity in Children
&lt;/h2&gt;

&lt;p&gt;Recognizing the importance of art education in nurturing young minds is crucial. Encouraging creative play and providing opportunities for self-expression lay the foundation for a lifetime of creative thinking.&lt;/p&gt;

&lt;h2&gt;
  
  
  Digital Art and the Modern Creative Landscape
&lt;/h2&gt;

&lt;p&gt;The digital age has revolutionized artistic expression, making it more accessible and globally impactful. Digital art forms, from graphic design to virtual reality experiences, contribute to the ever-evolving landscape of creativity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Overcoming Common Myths About Art
&lt;/h2&gt;

&lt;p&gt;Dispelling misconceptions, such as the belief that art is reserved for the naturally talented or limited to specific industries, opens doors for individuals to embrace their creative potential without self-imposed barriers.&lt;br&gt;
Source: &lt;a href="https://xhibitionhouse.com/"&gt;Exhibition House&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, the palette of possibilities presented by art extends far beyond aesthetics. It is a vibrant force that enhances our cognitive abilities, fuels inspiration, and connects us across cultures. By incorporating art into our daily lives, we unlock the boundless creativity that lies within each of us.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQs
&lt;/h2&gt;

&lt;p&gt;****Is art only for those with innate talent?&lt;/p&gt;

&lt;p&gt;Art is a skill that can be developed with practice and dedication. Everyone has the potential to express themselves creatively.&lt;br&gt;
****How can I incorporate art into my daily routine?&lt;/p&gt;

&lt;p&gt;Start by adding small artistic elements to your surroundings, such as paintings, sculptures, or even daily doodles.&lt;br&gt;
****Can art really reduce stress?&lt;/p&gt;

&lt;p&gt;Yes, engaging in creative activities has been proven to lower stress levels and promote overall well-being.&lt;br&gt;
****Is digital art as valuable as traditional forms?&lt;/p&gt;

&lt;p&gt;Absolutely. Digital art offers new avenues for creative expression and has become an integral part of the modern artistic landscape.&lt;br&gt;
****What role does art play in fostering innovation?&lt;/p&gt;

&lt;p&gt;Art encourages thinking outside conventional boundaries, contributing to innovative problem-solving and idea generation.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>From Novice to Ace: Progressing in Disc Golf Skill Levels</title>
      <dc:creator>Muhammad Ahmed</dc:creator>
      <pubDate>Tue, 05 Sep 2023 18:46:58 +0000</pubDate>
      <link>https://dev.to/ahmedsandhu/from-novice-to-ace-progressing-in-disc-golf-skill-levels-4k6c</link>
      <guid>https://dev.to/ahmedsandhu/from-novice-to-ace-progressing-in-disc-golf-skill-levels-4k6c</guid>
      <description>&lt;p&gt;Disc golf, a sport that combines elements of traditional golf with the thrill of frisbee throwing, has been steadily gaining popularity. In this article, we'll take you on a journey from novice to ace, providing valuable insights and guidance for players at every skill level.&lt;/p&gt;

&lt;p&gt;The Beginner's Guide to Disc Golf Mastery&lt;/p&gt;

&lt;p&gt;Understanding the Basics&lt;/p&gt;

&lt;p&gt;Disc golf might seem straightforward, but it has its own set of rules. We'll walk you through the fundamental rules of the game, ensuring you're ready to hit the course with confidence.&lt;br&gt;
Equipping yourself with the right gear is essential. Learn about the essential equipment needed to start playing and get tips on selecting the perfect discs for beginners.&lt;br&gt;
Perfecting Your Throwing Technique&lt;/p&gt;

&lt;p&gt;Proper throwing form is the foundation of success in disc golf. We'll discuss the importance of form and provide step-by-step instructions for a basic disc golf throw.&lt;br&gt;
To improve your throws, practice is key. Discover practical drills that will help beginners enhance their throwing skills.&lt;br&gt;
Navigating the Course&lt;/p&gt;

&lt;p&gt;Disc golf courses can be challenging to navigate if you don't know what you're doing. We'll teach you how to read a disc golf course map and share strategies for approaching various types of holes.&lt;br&gt;
Course management and shot selection are vital skills to master. Gain valuable advice on making smart decisions on the course.&lt;br&gt;
 Must read about the &lt;a href="https://joygamez.com/reviews/best-disc-golf-putter/"&gt;best disc golf putters&lt;/a&gt; in 2023.&lt;br&gt;
Learning from Mistakes&lt;/p&gt;

&lt;p&gt;Even the best players make mistakes, especially when they're just starting out. We'll discuss common blunders that beginners often make and how to avoid them. &lt;br&gt;
Embrace failure as a stepping stone to success. Discover the value of learning from your mistakes, and find inspiration in stories of successful players who began as novices.&lt;br&gt;
Joining the Disc Golf Community&lt;/p&gt;

&lt;p&gt;The disc golf community is welcoming and supportive. Learn about the benefits of joining disc golf clubs or leagues and how to find local events and tournaments.&lt;br&gt;
Connect with experienced players who can provide guidance and mentorship as you embark on your disc golf journey.&lt;br&gt;
Conclusion&lt;/p&gt;

&lt;p&gt;Summarize the key takeaways for beginners looking to progress in disc golf, emphasizing the importance of practice and a supportive community.&lt;br&gt;
Encourage readers to embrace the journey from novice to ace, knowing that every great disc golfer started as a beginner.&lt;br&gt;
Blog Post 2: Intermediate Strategies for Disc Golf Improvement&lt;/p&gt;

&lt;p&gt;Introduction&lt;/p&gt;

&lt;p&gt;To excel in disc golf, continuous improvement is necessary. In this article, we'll help intermediate players advance their skills to the next level.&lt;br&gt;
Mastering Disc Selection&lt;/p&gt;

&lt;p&gt;Building a diverse disc arsenal is crucial. Explore the significance of disc selection, learn how to choose discs based on course conditions, and get tips on creating a customized disc lineup. GEt knowledge about the &lt;a href="https://joygamez.com/best-disc-golf-carts/"&gt;best disc golf carts&lt;/a&gt;.&lt;br&gt;
Advanced Throwing Techniques&lt;/p&gt;

&lt;p&gt;Take your throwing skills to the next level by mastering techniques like hyzer and anhyzer throws. Understand when and how to use these techniques effectively, with the help of visual aids.&lt;br&gt;
Mental strength plays a significant role in disc golf. Discover mindfulness and concentration exercises that will improve your focus and strategies for maintaining composure under pressure.&lt;br&gt;
Scoring Strategies and Course Management&lt;/p&gt;

&lt;p&gt;Unlock advanced strategies for optimizing your scores, and explore course management tactics tailored to intermediate players.&lt;br&gt;
Delve into real-world examples of course-specific challenges and their solutions to elevate your gameplay.&lt;br&gt;
Competitive Play and Tournaments&lt;/p&gt;

&lt;p&gt;Transitioning to competitive disc golf is a significant step. We'll describe the process and provide tips for preparing for and participating in tournaments.&lt;br&gt;
Be inspired by the success stories of intermediate players who excelled in competitive settings.&lt;br&gt;
Conclusion&lt;/p&gt;

&lt;p&gt;Summarize the key points that intermediate players should focus on to advance in their disc golf journey, emphasizing the importance of practice and mental fortitude.&lt;br&gt;
Encourage readers to continue refining their skills and strive for ace-level performance.&lt;br&gt;
Blog Post 3: Reaching Ace Status: Advanced Disc Golf Techniques&lt;/p&gt;

&lt;p&gt;Introduction&lt;/p&gt;

&lt;p&gt;Highlight the remarkable achievement of becoming an advanced disc golfer and the commitment it demands.&lt;br&gt;
Perfecting the Drive&lt;/p&gt;

&lt;p&gt;Elevate your game by exploring advanced driving techniques such as distance drives and roller shots. Learn how to tailor your drive to different hole types and discover drills to hone your driving skills.&lt;br&gt;
Precision Putting and Approach Shots&lt;/p&gt;

&lt;p&gt;Achieve accuracy and finesse with advanced putting techniques, including straddle and turbo putts. Gain insights into precise approach shots and touch throws, along with strategies for reading greens.&lt;br&gt;
Understand how wind and weather conditions can affect disc flight and acquire tips for adjusting your game accordingly. Explore disc selection and flight path adjustments for windy conditions.&lt;br&gt;
Strength and Conditioning for Peak Performance&lt;/p&gt;

&lt;p&gt;Physical fitness is a game-changer. Learn about exercises and training routines that can improve your strength and flexibility, ultimately enhancing your performance.&lt;br&gt;
Explore how a healthy lifestyle contributes to your overall disc golf success.&lt;br&gt;
Mentorship and Advanced Learning&lt;/p&gt;

&lt;p&gt;Seek guidance from elite disc golfers to accelerate your progress. Discover opportunities for advanced learning, such as clinics and workshops.&lt;br&gt;
Find inspiration in stories of disc golf pros who achieved ace status through dedication and mentorship.&lt;br&gt;
Conclusion&lt;/p&gt;

&lt;p&gt;Summarize the journey from novice to ace in disc golf, highlighting the continuous pursuit of improvement.&lt;br&gt;
Encourage advanced players to keep pushing their boundaries, sharing their knowledge with others, and contributing to the thriving disc golf community.&lt;br&gt;
By following this comprehensive guide, disc golf enthusiasts can navigate their way from novice to ace, continuously improving their skills and embracing the rewarding journey the sport has to offer.&lt;/p&gt;

</description>
      <category>discgolfing</category>
      <category>bestputters</category>
      <category>discgolfers</category>
    </item>
  </channel>
</rss>
