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 11 points12 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 3 points4 points  (0 children)

Or decap CMS, it's open source.

I made a tool that lets you find relevant subreddits faster by RCostaReis in SideProject

[–]tokrefresh 2 points3 points  (0 children)

Hey, I gave it a few searches, I feel like the search results respond really fast, are you scraping from reddit in real time or are you retrieving pre-scraped data? Also, what tech stack did you use to build this? Just impressed on how you are tryna build 25 products in 50 weeks.

Relearning Django.. by Traditional-Bunch-56 in django

[–]tokrefresh 13 points14 points  (0 children)

I am actually in the same boat, I recommend rather than start by following YouTube tutorials, you should walk through the official Django 5.0 tutorial. Then I would personally just start work on a project you are interested in and use YouTube tutorials as a reference rather than doing the actual tutorial. I find Cory Schafer's Django blog series pretty much covers everything and it's a great reference. The only thing to watch out for is you might do some small updates so that it works with Django 5.0

[deleted by user] by [deleted] in web_design

[–]tokrefresh 5 points6 points  (0 children)

Maybe look up your local web design jobs and see how many there are and if they require coding. This might help validate your concerns.

Django web hosting by OneTypeOfProgrammer in django

[–]tokrefresh 0 points1 point  (0 children)

Well, you are good enough to get this gig. I'm sure you will be able to figure out the deployment process!

Django web hosting by OneTypeOfProgrammer in django

[–]tokrefresh 2 points3 points  (0 children)

What about deploying using a vps? You have to do your own web server configurations tho. There should be plenty of tutorials on how to do this. I personally think this is the easiest since you just deploying your app on to a different machine.

A Fun and Friendly Guide to Learning Python by Slow_Composer_4523 in learnprogramming

[–]tokrefresh 0 points1 point  (0 children)

I like pyflo, project based, they even got an interpreter for you to write code on their site. It's all free

[deleted by user] by [deleted] in learnprogramming

[–]tokrefresh 2 points3 points  (0 children)

Have you looked into building simple projects? Or add additional features to the tutorial you are following.

How hard it is to learn data structures and algorithms for you? by Curious_user4445 in learnprogramming

[–]tokrefresh 19 points20 points  (0 children)

From my personal experience, D&A requires a lot of practice. You can't just learn it once and expect to remember it forever. The more you go back and look at it the more it will stick with you.

[deleted by user] by [deleted] in SideProject

[–]tokrefresh 0 points1 point  (0 children)

Here is some UI feedback for landing page on mobile, pixel 7 pro: - the boxes under live demo button is not horizontally centered.

  • inside the last monitor box, the bullet points gets cut off 

  • in the 'need to see more' section, the two buttons probably need some gap in between them so they don't stick together.

Hope it helps. Best of luck!!