- Sloth Bytes
- Posts
- 𦄠Feature Flags
𦄠Feature Flags
Hello friends!
Welcome to this weekās Sloth Bytes. I hope you had a fun week š

Build Real Apps in Minutes
I'll be honest. I used to think no-code was for people who "couldn't really code."
But I realized I was missing the entire point.
While I was stuck planning, others were already launching with Bubble ā no code, no team, just their idea and a browser.
How many ideas stall at the blank page? Bubble AI turns plain English into real apps ā so you can skip the overwhelm and start building.
All that work that has nothing to do with solving real problems
Bubble AI handles the boring stuff so you can:
Launch real apps in hours, not months.
Start making money with built-in payments and login flows.
Focus on your idea ā Bubble AI handles the rest.
Apps built on Bubble scale ā just ask companies like HubSpot and Amazon.
You donāt need to be technical to build. With Bubble AI, your idea is the blueprint.

Feature Flags

Iāve been curious about feature flags for a while and wanted to share what I learned š
Next week Iāll do a more beginner/fundamental topic! Let me know if you have a topic in mind.
Imagine you have a job (already unrealistic.)
The non-technical CEO wants to launch their brand new āone of a kind never been done beforeā feature on Friday.
The problem?
This feature has a chance of breaking everything and they want to deploy on a Fridayā¦
That's a dumpster fire waiting to happen.
But there is a way to reduce the potential damage and embarrassment.
Feature flags.
What Are Feature Flags?
Feature flags are basically if statement with superpowers:
if feature_flag("new_checkout"):
return new_checkout_experience()
else:
return old_checkout_experience()
These statements allow you to do things like:
deploy new features without making them visible to users
make features visible only to a small amount of users and environments
The Real Power: Gradual Rollouts
Feature flags arenāt ONLY switches (on/off), you can also āroll outā features intelligently.
Slowly increase the amount of users that have access to these features:
def feature_enabled(flag, user_id):
rollout_percent = get_rollout_percentage(flag)
# Put users into "buckets."
user_bucket = hash(f"{flag}:{user_id}") % 100
#If the user's bucket number is less than the rollout
#They see the feature
return user_bucket <= rollout_percent
#Ex: rollout_percent = 50, users in bucket 0-50 see the feature.
# Monday: 1% ā Tuesday: 5% ā Wednesday: 25% ā Friday: 100% of users
Same users always see/don't see the feature (consistent experience)
You can gradually increase the rollout
If something breaks, only affects small % of users
No need to maintain lists of who has access
Common Feature Flag Patterns/Use Cases
Kill Switches:
If a feature has a critical bug, traffic spikes or third-party service failures, you can use feature flags to quickly turn off functionality when needed.
This works for ALL features, not just new features.
A/B Testing:
These flags let you test out/experiment features to small amounts of users to see if itās performing well/worth to maintain.
if feature_variant("button_color") == "green":
color = "#00ff00"
else:
color = "#ff0000"
track_conversion(variant=feature_variant("button_color"))
User Targeting:
def should_enable(flag, user):
# Beta testers
if user.email in BETA_USERS:
return True
# Geographic rollout
if flag == "new_payment" and user.country == "CA":
return True
# Percentage for others
return percentage_rollout(flag, user.id)
Wait this sounds complicated?
Yep it is, so itās not surprising thereās services that handle this annoying stuff.
Some Popular Services
Youāre a nerd and wanna learn more?
Check this article out:





Thanks to everyone how submitted!
AspenTheRoyal, BraedenAlonge, dganesh05, emil-case, plantaeart, mau-estradiote, cre-w, spenpal, Fireboy086.
Special shout out to SabhyaAggarwal. I forgot to include his submission last week and it was also his birthday (I felt really bad.)
Feel free to comment Happy late birthday to Sabhya!
How Many Digits between 1 and N
Imagine you took all the numbers between 0 and n
and concatenated them together into a long string.
How many digits are there between 0 and n
? Write a function that can calculate this.
There are 0 digits between 0 and 1, there are 9 digits between 0 and 10 and there are 189 digits between 0 and 100.
Examples
digits(1)
output = 0
digits(10)
output = 9
digits(100)
output = 189
digits(2020)
output = 6969
How To Submit Answers
Reply with
A link to your solution (github, twitter, personal blog, portfolio, replit, etc)
or if youāre on the web version leave a comment!
If you want to be mentioned here, Iād prefer if you sent a GitHub link or Replit!
Thatās all from me!
Have a great week, be safe, make good choices, and have fun coding.
If I made a mistake or you have any questions, feel free to comment below or reply to the email!
See you all next week.
What'd you think of today's email? |
Want to advertise in Sloth Bytes?
If your company is interested in reaching an audience of developers and programming enthusiasts, you may want to advertise with us here.
Reply