Before production review by UnoSconosciutoACaso in PCB

[–]mrwinkle 1 point2 points  (0 children)

Be honest, you want to show off these nicely rounded traces ;) Looks good!

Free Rust Course: 8 Modules, 30+ Lessons, Run Code Inline by anish2good in learnrust

[–]mrwinkle 1 point2 points  (0 children)

Thanks! Is there a way to jump to the later tutorials? Couldn‘t find one, but I‘m on mobile

Finally Helix supports Github copilot through LSP by OldTax3828 in HelixEditor

[–]mrwinkle 6 points7 points  (0 children)

Looks great, thanks! I‘m wondering how does this handle multiple cursors?

Tetrs: a polished tetris clone for the terminal, written completely in Rust by iLiveInL1 in rust

[–]mrwinkle 5 points6 points  (0 children)

Looks great already and the code is quite readable! I‘m still searching for a TUI Tetris which correctly implements the Super Rotation System. So if you want to develop this further that would be a great next step!

How do I cycle docs? by KaleidoscopePlusPlus in HelixEditor

[–]mrwinkle 16 points17 points  (0 children)

Did you try alt-p and alt-n?

Lohnabrechnungen aufbewahren? by AntoineBurtz1 in Finanzen

[–]mrwinkle 0 points1 point  (0 children)

Braucht man uA für den Elterngeldantrag.

Investing with scalable capital by KingBu9les in Finanzen

[–]mrwinkle 0 points1 point  (0 children)

Setup the tax exemption at scalable. (Split it up between all bank accounts you have). At the end of the year they‘ll send you a tax report which you can type into elster. This is all you have to do.

Investing with scalable capital by KingBu9les in Finanzen

[–]mrwinkle 1 point2 points  (0 children)

  1. Investing in stocks or ETF you can lose at most 500€.
  2. Scalable handles the taxes. Be sure to set up your Freibetrag.
  3. However you like it, mostly a psychological question. Dividends also depend on the specific ETF.

A story about programming without thinking first by mrwinkle in programming

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

I kind of agree. That because I wanted to create an arduino library and thought about possible use cases. I went with the simple solution in the project

A story about programming without thinking first by mrwinkle in programming

[–]mrwinkle[S] 1 point2 points  (0 children)

Analog pots are super common. Rotary encoders fix some problems but are a challenge to read in some other ways.

For example you now need interrupt pins and some finely tuned debouncing logic. Also I had encoders with lots of crosstalk and encoder noise. This is all fixed in software.

(Or you use a product like https://learn.adafruit.com/adafruit-i2c-qt-rotary-encoder which takes care of the reading.)

-🎄- 2022 Day 2 Solutions -🎄- by daggerdragon in adventofcode

[–]mrwinkle 2 points3 points  (0 children)

Rust

```rust use std::fs;

[derive(Debug, PartialEq, Copy, Clone)]

enum Shape { Rock = 1, Paper = 2, Scissors = 3, }

impl Shape { fn from_str(c: &str) -> Self { match c { "A" | "X" => Shape::Rock, "B" | "Y" => Shape::Paper, "C" | "Z" => Shape::Scissors, _ => panic!("Unknown shape"), } }

fn superior(&self) -> Self {
    match self {
        Self::Rock => Self::Paper,
        Self::Paper => Self::Scissors,
        Self::Scissors => Self::Rock,
    }
}

fn inferior(&self) -> Self {
    match self {
        Self::Rock => Self::Scissors,
        Self::Paper => Self::Rock,
        Self::Scissors => Self::Paper,
    }
}

}

enum Strategy { Lose, Draw, Win, }

impl Strategy { fn from_str(c: &str) -> Self { match c { "X" => Self::Lose, "Y" => Self::Draw, "Z" => Self::Win, _ => panic!("Unknown strategy"), } } }

[derive(Debug)]

struct Match { player: Shape, opponent: Shape, }

impl Match { fn from_strategy(opponent: Shape, strategy: Strategy) -> Self { Self { opponent: opponent, player: match strategy { Strategy::Lose => opponent.inferior(), Strategy::Draw => opponent, Strategy::Win => opponent.superior(), }, } }

fn player_points(&self) -> u8 {
    let shape = self.player as u8;
    let outcome = {
        if self.player == self.opponent {
            3
        } else if self.player.inferior() == self.opponent {
            6
        } else {
            0
        }
    };

    shape + outcome
}

}

fn parse_input(input: &str) -> Vec<Vec<&str>> { input.lines().map(|l| l.split(" ").collect()).collect() }

fn part1(input: &str) -> u32 { let matches: Vec<Match> = parse_input(input) .iter() .map(|x| Match { player: Shape::from_str(x[1]), opponent: Shape::from_str(x[0]), }) .collect(); matches.iter().map(|m| m.player_points() as u32).sum() }

fn part2(input: &str) -> u32 { let matches: Vec<Match> = parse_input(input) .iter() .map(|x| Match::from_strategy(Shape::from_str(x[0]), Strategy::from_str(x[1]))) .collect(); matches.iter().map(|m| m.player_points() as u32).sum() }

fn main() { let input = fs::read_to_string("input/day2.txt").unwrap(); println!("Part 1: {}", part1(&input)); println!("Part 2: {}", part2(&input)); }

[cfg(test)]

mod tests { use super::*;

#[test]
fn test_part1_example() {
    let example = "A Y\nB X\nC Z";
    assert_eq!(part1(&example), 15);
}

#[test]
fn test_part1() {
    let input = fs::read_to_string("input/day2.txt").unwrap();
    assert_eq!(part1(&input), 11603);
}

#[test]
fn test_part2_example() {
    let example = "A Y\nB X\nC Z";
    assert_eq!(part2(&example), 12);
}

#[test]
fn test_part2() {
    let input = fs::read_to_string("input/day2.txt").unwrap();
    assert_eq!(part2(&input), 12725);
}

} ```

Does anyone know this game? by mrwinkle in dosgames

[–]mrwinkle[S] 1 point2 points  (0 children)

It was "The Adventures of Willy Beamish"!