10 votes

What programming/technical projects have you been working on?

This is a recurring post to discuss programming or other technical projects that we've been working on. Tell us about one of your recent projects, either at work or personal projects. What's interesting about it? Are you having trouble with anything?

13 comments

  1. [7]
    Johz
    Link
    I finally finished my blog! It's here: https://jonathan-frere.com/ Technically, it's not much to write home about (Hugo, some SCSS, a single JS function, Cloudflare pages for hosting), but it was...

    I finally finished my blog! It's here: https://jonathan-frere.com/

    Technically, it's not much to write home about (Hugo, some SCSS, a single JS function, Cloudflare pages for hosting), but it was still interesting playing around with some different templating options, and figuring out little things like getting light mode/dark mode to work.

    The bigger challenge was getting the design to work. I'm not 100% happy with the colours (but I think I'm just going to accept them at this point), but I'm happy with the layered effect, and I'm really happy with the shadows -- it feels like the first time where I've made shadows that didn't feel like a ten-year-old drew them!

    And then of course I wrote a blog post about the design of the blog post, because that's like the standard thing to do with a new blog... 😅

    6 votes
    1. [6]
      fxgn
      Link Parent
      The design is nice, though I do agree that the color scheme is not perfect. Also you could probably improve the typography a bit, the fonts are fine but it would be cool if they were great. Some...

      The design is nice, though I do agree that the color scheme is not perfect.

      Also you could probably improve the typography a bit, the fonts are fine but it would be cool if they were great. Some examples of personal websites with good typography IMO are Gwern or Jake Lazaroff. And of course you can never go wrong with just using Inter for everything (see my blog for an example)

      5 votes
      1. [5]
        Johz
        Link Parent
        I specifically didn't go on a font search because I wanted to avoid loading a bunch of extra fonts files, but then I added cover images (at least to the posts I've done since I did the redesign),...

        I specifically didn't go on a font search because I wanted to avoid loading a bunch of extra fonts files, but then I added cover images (at least to the posts I've done since I did the redesign), so maybe I can also get away with a nice font as well. But I do agree that a nice font can really make all the difference, and it's usually how I start these sorts of things.

        Out of interest, are you viewing dark mode or light mode? I'm a light mode person, and I tried to also add a dark mode variant because I know people like it, but I find it so much harder to evaluate it properly.

        3 votes
        1. [4]
          fxgn
          Link Parent
          If you don't want to load custom fonts, you can check out Modern Font Stacks, which provides a lot of font stacks of pre-installed fonts. Though, realistically, since your website is hosted on...

          If you don't want to load custom fonts, you can check out Modern Font Stacks, which provides a lot of font stacks of pre-installed fonts.

          Though, realistically, since your website is hosted on Cloudflare pages, font loading should be very quick because of their CDNs, compression and caching. Also, if you found a cool font on Google Fonts but don't want to add Google trackers onto your page, Cloudflare has a feature you can enable that automatically replaces all Google Fonts imports with self hosted fonts on your page. Sites that I linked above use multiple custom fonts, but they load almost instantly.

          I was viewing your website in light mode, I actually think that the color scheme in dark mode looks nicer. Btw, the website resets to light mode any time I click on any link or reload the page, you should probably store it in a cookie.

          2 votes
          1. [3]
            Johz
            Link Parent
            Those font stacks look interesting, although on Android at least, I'm getting the baseline defaults for almost every stack. But it could be something good to play around with. The light mode/dark...

            Those font stacks look interesting, although on Android at least, I'm getting the baseline defaults for almost every stack. But it could be something good to play around with.

            The light mode/dark mode thing is a Known Issueâ„¢, but it's difficult to properly fix. The site is completely static (and I don't want to make it dynamic just for theme switching) so the only way of detecting that cookie would be client-side. But if I do it client-side, I either have a situation where the wrong values are loaded initially, and I get a flash of incorrect styling, or the Javascript blocks the rendering of the page until the correct variables have been set.

            Having the switcher only work until you load the next page means that the site remains static, loads quickly, and shows the preferred colour scheme for most users, but for users who want a different colour scheme while they're reading the article, they can still get that without having to fiddle with system settings. But I suspect that's a rare case so maybe it's easier just to remove the switcher altogether?

            1 vote
            1. [2]
              fxgn
              Link Parent
              Perhaps you could use the prefers-color-scheme CSS media query and do the colorscheme switching directly in your styles? That way there'll be no delay, and users who use a dark theme will see a...

              Perhaps you could use the prefers-color-scheme CSS media query and do the colorscheme switching directly in your styles? That way there'll be no delay, and users who use a dark theme will see a dark version of your site

              1 vote
              1. Johz
                Link Parent
                That's what I'm doing currently, but with the addition of the toggle as an override. Which is also why I'm more okay with the behaviour where it's only a temporary toggle - most users will see the...

                That's what I'm doing currently, but with the addition of the toggle as an override. Which is also why I'm more okay with the behaviour where it's only a temporary toggle - most users will see the right thing to start with.

                1 vote
  2. Halfdan
    Link
    In Godot, I coded a 3D ball to be moved by the mouse using physical forces. Online demo here I think it's kinda fun, I like the feel of the fluid movement, but no idea how to make it into an...

    In Godot, I coded a 3D ball to be moved by the mouse using physical forces.
    Online demo here

    I think it's kinda fun, I like the feel of the fluid movement, but no idea how to make it into an actual game.

    Here's the GDscript:

    extends RigidBody3D
    
    var ball_center :Vector3 = Vector3(0.0, 0.0, 0.0)
    var move :Vector3 = Vector3(0.0, 0.0, 0.0)
    var mouse_boost:float = 8500.0
    
    func _ready():
    	mass = 978.5 # "if a marble ball has a diameter of 0.5 meter, what is its mass?"
    	set_linear_damp(2.0) # Default 0.0
    	set_angular_damp(2.0)
    
    func _physics_process(delta):
    	var mouse_velocity:Vector2 = Vector2(0.0, 0.0)
    	mouse_velocity = Input.get_last_mouse_velocity()
    	move = Vector3(mouse_velocity.x*mouse_boost, 0.0, mouse_velocity.y*mouse_boost)
    	apply_force(move*delta,ball_center)
    
    4 votes
  3. [2]
    fxgn
    Link
    rounded-window-corners, an extension for GNOME that, well, adds rounded corners for all windows, got abandoned by its maintainer. In the repo issues, everyone was saying that they wish someone...

    rounded-window-corners, an extension for GNOME that, well, adds rounded corners for all windows, got abandoned by its maintainer. In the repo issues, everyone was saying that they wish someone forks the extension and maintains it, so I decided to do that.

    https://github.com/flexagoon/rounded-window-corners

    For now, I haven't added anything yet, but I've been slowly refactoring the extension to make the codebase easier to maintain.

    4 votes
    1. streblo
      Link Parent
      Very cool! There are a couple gnome extensions I couldn't live without, if they ever got abandoned I'd feel the need to do the same.

      Very cool!

      There are a couple gnome extensions I couldn't live without, if they ever got abandoned I'd feel the need to do the same.

      1 vote
  4. xk3
    (edited )
    Link
    I prefer argparse but never really liked how argparse prints the help menu. It feels very cluttered with overlapping text: example here. One of the things I did in the past week is create my own...

    I prefer argparse but never really liked how argparse prints the help menu. It feels very cluttered with overlapping text: example here.

    One of the things I did in the past week is create my own CustomHelpFormatter which prints arguments and their help text as two distinct columns. The most interesting part is here:

    def format_two_columns(text1, text2, width1=30, width2=70, left_gutter=2, middle_gutter=2, right_gutter=3):
        terminal_width = min(consts.TERMINAL_SIZE.columns, 100) - (left_gutter + middle_gutter + right_gutter)
        if text2:
            width1 = int(terminal_width * (width1 / (width1 + width2)))
            width2 = int(terminal_width * (width2 / (width1 + width2)))
        else:
            width1 = terminal_width
    
        wrapped_text1 = textwrap.wrap(text1, width=width1)
        wrapped_text2 = textwrap.wrap(text2, width=width2)
    
        formatted_lines = [
            f"{' ' * left_gutter}{line1:<{width1}}{' ' * middle_gutter}{line2:<{width2}}{' ' * right_gutter}".rstrip()
            for line1, line2 in zip_longest(wrapped_text1, wrapped_text2, fillvalue="")
        ]
    
        return "\n".join(formatted_lines) + "\n"
    

    the design is very human...

    1 vote
  5. paradoxfox
    Link
    About a month ago, I finally pulled the trigger on purchasing a cheap mirrorless camera, the Canon R50. I wanted a place where I can showcase my photos, besides Instagram, and decided to make my...

    About a month ago, I finally pulled the trigger on purchasing a cheap mirrorless camera, the Canon R50. I wanted a place where I can showcase my photos, besides Instagram, and decided to make my own gallery.

    I've also been fiddling with Svelte recently and decided to use it for a small project like this. The perfect chance to combine these two new hobbies of mine. Although I've been meaning to make this site ever since I got my camera I only just had the time to sit down and actually build it. And it's done! Here's the link: https://gallery.dimeski.net/

    Although I gotta mention the photos I put on there weren't really thought out, I just wanted to have placeholder photos until I can decide on what to showcase. I also had the chance to use ImageMagick (to make thumbnails), something I haven't touched since first year of university!

    1 vote