Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions march-2026/3-21-first-tweet/first_tweet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// First Tweet 🐦
// shercodes

function tweetBalance(tweet) {
let charsLeft = 140; // Limit of characters
let count = 0; // Characters counter
let string = tweet.split(" "); // Words array

for (let word of string) {
if (word.startsWith("@")) { // Usernames
count += 20;
} else if (word.startsWith("http://") || word.startsWith ("https://")) { // URLs
count += 23;
} else if (/\p{Emoji}/u.test(word)) { // Emojis
count += 2;
} else { // All other characters
count += word.length;
}
}

count += string.length - 1; // Adds spaces
return charsLeft - count;
}
20 changes: 20 additions & 0 deletions march-2026/3-22-water-day/water_day.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Water Day πŸ’§
// shercodes

function leakyPipe(volume, leak, hours, threshold) {
let currentVolume = volume; // Initial volume
const lossRate = leak; // Percentage per hour
const iterations = hours; // Number of hours
let waterRemaining = 0; // Result

for (let i = 0; i < iterations; i++) {
currentVolume = currentVolume * [1 - (lossRate / 100)]; // Calculates the volume after each hour passed.
if (currentVolume >= threshold) {
waterRemaining = Number(currentVolume.toFixed(2));
} else {
waterRemaining = -1;
}
}

return waterRemaining;
}