Skip to content

Instantly share code, notes, and snippets.

View michaelenglo's full-sized avatar
💭
Squashing bugs 👾

Michael Englo michaelenglo

💭
Squashing bugs 👾
  • Vancouver, British Columbia, Canada
View GitHub Profile
@michaelenglo
michaelenglo / fut_squad_ratings.py
Last active June 18, 2022 20:24
Calculate FIFA Ultimate Team Squad Ratings (from https://fifauteam.com/fifa-21-squad-rating-guide/)
def calculate_ratings(players):
# Get the sum for all players ratings
player_ratings = map(lambda x: x.ratings, players)
sum_player_ratings = sum(player_ratings)
# Also get the average
average_player_ratings = sum_player_ratings / 11
# Calculate the correction factor (for each player, it's either positive delta or 0) and get the total.
@michaelenglo
michaelenglo / riddle.js
Last active June 13, 2020 01:05
What does this JS code evaluate to?
const noOfShownComments = 5;
const commentsIds = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
console.log(!!(noOfShownComments => commentsIds.length
? true
: false}));
@michaelenglo
michaelenglo / gist:74577990a139ca3c7ff5c2d501df43d4
Last active May 18, 2020 22:13
The world's cleanest switch statement.
This is how regular switches are typically made:
function regularSwitch(case) {
switch(case) {
case "default":
return "green";
case "ignored":
return "red";
case "selected";
return "grey";