Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      June 2, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      June 2, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      June 2, 2025

      How To Prevent WordPress SQL Injection Attacks

      June 2, 2025

      How Red Hat just quietly, radically transformed enterprise server Linux

      June 2, 2025

      OpenAI wants ChatGPT to be your ‘super assistant’ – what that means

      June 2, 2025

      The best Linux VPNs of 2025: Expert tested and reviewed

      June 2, 2025

      One of my favorite gaming PCs is 60% off right now

      June 2, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      `document.currentScript` is more useful than I thought.

      June 2, 2025
      Recent

      `document.currentScript` is more useful than I thought.

      June 2, 2025

      Adobe Sensei and GenAI in Practice for Enterprise CMS

      June 2, 2025

      Over The Air Updates for React Native Apps

      June 2, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      You can now open ChatGPT on Windows 11 with Win+C (if you change the Settings)

      June 2, 2025
      Recent

      You can now open ChatGPT on Windows 11 with Win+C (if you change the Settings)

      June 2, 2025

      Microsoft says Copilot can use location to change Outlook’s UI on Android

      June 2, 2025

      TempoMail — Command Line Temporary Email in Linux

      June 2, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: No Limits on Repetition

    CodeSOD: No Limits on Repetition

    February 3, 2025

    Just because you get fired doesn’t mean that your pull requests are automatically closed. Dallin was in the middle of reviewing a PR by Steve when the email came out announcing that Steve no longer worked at the company.

    Let’s take a look at that PR, and maybe we can see why.

                        $originalUndrawn = DecimalHelper::toDecimal($party->limit)->sub(DecimalHelper::toDecimal($party->drawn));
    

    This is the original code, which represents operations on investments. An investment is represented by a note, and belongs to one or more partys. The amount that can be drawn is set by a limit, which can belong to either the party or the note.

    What our developer was tasked with doing was allow a note to have no limit. This means changing all the places where the note‘s limit is checked. So this is what they submitted:

                        if ($note->limit == null) {
                            $originalUndrawn = DecimalHelper::toDecimal($party->limit)->sub(DecimalHelper::toDecimal($party->drawn));
                        } else {
                            $originalUndrawn = DecimalHelper::toDecimal($party->limit)->sub(DecimalHelper::toDecimal($party->drawn));
                        }
    

    You’ll note here that the note limit isn’t part of calculating the party limits, so both branches do the same thing. And then there’s the deeper question of “is a null really the best way to represent this?” especially given that elsewhere in the code they have an “unlimited” flag that disables limit checking.

    Now, Steve wasn’t let go only for their code- they were just a miserable co-worker who liked to pick fights in pull request comments. So the real highlight of Steve’s dismissal was that Dallin got to have a meaningful discussion about the best way to make this change with the rest of the team, and Steve didn’t have a chance to disrupt it.

    [Advertisement]
    Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.

    Source: Read More 

    Hostinger
    Facebook Twitter Reddit Email Copy Link
    Previous ArticleHow to Fix Spotify ‘No PubKey’ Error on Ubuntu
    Next Article bower – curses frontend for the Notmuch email system

    Related Posts

    News & Updates

    How Red Hat just quietly, radically transformed enterprise server Linux

    June 2, 2025
    News & Updates

    OpenAI wants ChatGPT to be your ‘super assistant’ – what that means

    June 2, 2025
    Leave A Reply Cancel Reply

    Hostinger

    Continue Reading

    CVE-2025-43854 – DIFY Clickjacking Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Monster Hunter Wilds has received updated PC Spec requirements and a new PC Benchmark program to help players test them out

    News & Updates

    LAMBDA: A New Open-Source, Code-Free Multi-Agent Data Analysis System to Bridge the Gap Between Domain Experts and Advanced AI Models

    Development

    This budget soundbar I tested sounds like it’s far more expensive than it actually is

    News & Updates

    Highlights

    GitHub Availability Report: October 2024

    November 14, 2024

    In October, we experienced one incident that resulted in degraded performance across GitHub services. October…

    StreamBridge: Turning Your Offline Video Large Language Model into a Proactive Streaming Assistant

    May 13, 2025

    Diwali and Salesforce: The Spark of Innovation in Modern Business

    November 3, 2024

    Customizing Material UI Themes Without Losing Accessibility

    April 25, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.