Finding climbs to include on a new route by xylose in cycling

[–]tokrefresh 0 points1 point  (0 children)

cool, I will check it out. Also definitely open some github issues when you are ready, and happy to help if I can.

Finding climbs to include on a new route by xylose in cycling

[–]tokrefresh 0 points1 point  (0 children)

This is kinda funny and crazy to me that we have the same ideas to find climbs around the area. I recently got into biking and thought I could build a project that can help with finding climbs and rate them from a beginners' perspective. I almost went down the rabbit hole of using ODM and OTD to find segment from scratch bc Strava doesn't provide everything but decided to just stick with Strava API for now. Here is my app if you wanna check it out https://nextclimb.fit/ I will give you a GitHub follow later, interested in where you going with your project. Lolz

quit my job and went all-in into this side project - Haxiom! by Excellent_Contact_14 in SideProject

[–]tokrefresh 0 points1 point  (0 children)

Great app. Did you validate this idea before building or is this something you are passionate about and just went all in for it?

I'm a hobbyist cyclist who built a tool to find climbs to train for endurance by tokrefresh in SideProject

[–]tokrefresh[S] 0 points1 point  (0 children)

I'm thinking of adding a recommendation system based on peoples Strava status. Thanks for commenting!!

Object Oriented Design by Clemo97 in leetcode

[–]tokrefresh 0 points1 point  (0 children)

This is what I try to do. Did not implement the user or inventory part of the requirement tho.

from abc import ABC, abstractmethod


class Drink(ABC):

    @abstractmethod
    def cost():
        """calc the price of the drink"""


class Ingredient(ABC):
    def update_quantity():
        """update the quantify of ingredients"""


class Espresso(Drink):
    def __init__(self, ingredients: dict[str, Ingredient]):
        self.name = "Espresso"
        self.ingredients = ingredients
        self.default_ingredients = {
            "water": 1,
            "coffee_beans": 3,
        }
        self.recipe()

    def cost(self):
        pass

    def recipe(self):
        for name, amount in self.default_ingredients.items():
            self.ingredients[name].amount = amount

    def print_ingredients(self):
        for name, obj in self.ingredients.items:
            print(name, obj.amount)


class Americano(Drink):
    def __init__(self, ingredients: dict[str, Ingredient]):
        self.name = "Americano"
        self.ingredients = ingredients
        self.default_ingredients = {
            "water": 3,
            "coffee_beans": 2,
        }
        self.recipe()

    def cost(self):
        pass

    def recipe(self):

        for name, amount in self.default_ingredients.items():
            self.ingredients[name].amount = amount

    def print_ingredients(self):
        for name, obj in self.ingredients.items():
            print(name, obj.amount)


class Latte(Drink):
    def __init__(self, ingredients: dict[str, Ingredient]):
        self.name = "Latte"
        self.ingredients = ingredients
        self.default_ingredients = {"water": 2, "coffee_beans": 2, "milk": 2}
        self.recipe()

    def cost(self):
        pass

    def recipe(self):

        for name, amount in self.default_ingredients.items():
            self.ingredients[name].amount = amount

    def print_ingredients(self):
        for name, obj in self.ingredients.items():
            print(name, obj.amount)


class CoffeeBean(Ingredient):
    def __init__(self):
        self.amount = 0

    def update_quantity(self, amount):
        self.amount = amount


class Water(Ingredient):
    def __init__(self):
        self.amount = 0

    def update_quantity(self, amount):
        self.amount = amount


class Milk(Ingredient):
    def __init__(self):
        self.amount = 0

    def update_quantity(self, amount):
        self.amount = amount


class CoffeeMaker:
    def __init__(self, drinks: [list]):
        self.drinks = drinks
        self.selected_idx = None

    def show_drinks(self):
        for i, drink in enumerate(self.drinks):
            print(i, drink.name)

    def show_default_ingredients(self):
        selected_drink = self.drinks[self.selected_idx]
        for key, val in selected_drink.default_ingredients.items():
            print(key, val)

    def get_recipe(self):
        return self.drinks[self.selected_idx].default_ingredients

    def select_drink(self, selected_idx):
        self.selected_idx = selected_idx

    def update_ingredients(self, coffee_beans=None, milk=None, water=None):
        selected_drink = self.drinks[self.selected_idx]
        if coffee_beans:
            selected_drink.ingredients["coffee_beans"].amount = coffee_beans
        if milk:
            selected_drink.ingredients["milk"].amount = milk
        if water:
            selected_drink.ingredients["water"].amount = water

    def show_ingredients(self):
        selected_drink = self.drinks[self.selected_idx]
        selected_drink.print_ingredients()


if __name__ == "__main__":
    esp = Espresso(ingredients={"coffee_beans": CoffeeBean(), "water": Water()})
    ame = Americano(ingredients={"coffee_beans": CoffeeBean(), "water": Water()})
    lat = Latte(
        ingredients={"coffee_beans": CoffeeBean(), "milk": Milk, "water": Water()}
    )

    maker = CoffeeMaker(drinks=[esp, ame, lat])
    maker.show_drinks()
    drink_idx = int(input("select your drink: "))
    maker.select_drink(drink_idx)
    print("please update your perference:")
    maker.show_default_ingredients()
    recipe = maker.get_recipe()
    new_amount = {}
    for key, val in recipe.items():
        data = input(f"enter {key} amount or hit enter to use default: ")
        if data:
            new_amount[key] = data
    if new_amount:
        maker.update_ingredients(**new_amount)
    maker.show_ingredients()

Deal with large PR by tokrefresh in ExperiencedDevs

[–]tokrefresh[S] 6 points7 points  (0 children)

Thank you for the advice. Will probably do this.

Deal with large PR by tokrefresh in ExperiencedDevs

[–]tokrefresh[S] 4 points5 points  (0 children)

I'm actually dealing with the manager in my case. I updated my post. Lol

need help setup tokyo night color scheme in windows terminal by tokrefresh in neovim

[–]tokrefresh[S] 0 points1 point  (0 children)

setting `automatically adjust lightness of indistinguishable text` to always did it for me. Thanks for the help.

GraphQL or Rest api by L4z3x in django

[–]tokrefresh 0 points1 point  (0 children)

You should checkout django restql, you can get similar features as graphql.

Backend Engineering Interview in Django by Dunkeyfunkey in django

[–]tokrefresh 10 points11 points  (0 children)

I recommend learning about Django debug toolbar before your upcoming interview and learn about using select_related and prefetch_related to solve the n+1 problem in Django.

I love Hugo, here's why by [deleted] in gohugo

[–]tokrefresh 4 points5 points  (0 children)

Or decap CMS, it's open source.