Skip Navigation

InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)AL
Posts
11
Comments
586
Joined
2 yr. ago

  • Its probably bias to what you are used to the most. I think for example copy pasting stuff around in C like languages is way easier than the tab mangling one has to perform in python.

    Also python has so plenty of bizarre (i.m.o. not very readable) syntax beyond that. Like

    def __init__(self) : for a constructor

    the most verbose lambda syntax for something that should make it less verbose to inline functions def x = lambda x: x + 1

    logical operators being words while numerical and comparative ones aren't def x = not a or (b <= c)

    private methods not really existing thus needing underscores as a crutch

    I don't wanna hate on python, the ecosystem and libraries around it are amazing but people saying python is the gold standard in terms of syntax and "readability" is questionable i.m.o.. There also is a reason why many of new modern hyped languages (which don't have to abide to backwards compatibility to some other language like mojo) like Rust, Kotlin, Go, Zig, and Swift are C style langs.

  • Yeah, Android when it comes to "smoothness" is an enigma to me. For games it makes sense since the GPU is weak. But for browsing and stuff it should be plenty fast.

    You could also try to AOT compile apps with these adb commands to maybe get better performance:

    adb shell pm compile -a -f --check-prof false -m everything

    adb shell pm compile -a -f --check-prof false --compile-layouts

    adb shell pm bg-dexopt-job

  • Hmmm... this seems odd, based on the specs I expected the Pi 5 to offer a very solid Android experience, since they now use Cortex A76 CPUs. Same Microarchitecture as for example a Kirin 980 and Snapdragon 855 which to this day perform very well.

    Matter of fact this comment was sent on an LG G8S using the 855

  • I may be wrong on that, I haven't used Snapchat for 3 years but I remember the App always being pretty bad technically. Especially the high idle battery drain was wild. Giving such a company special permissions seems ripe for exploits to bypass the lockscreen.

  • Essentially a function that doesn't produce side effects, like modifying variables outside of its scope or modifying the function parameters. This something you should always try to incorporate into your code as it makes it much easier to test and makes the function's use less risky since you don't relay on external unrelated values.

    To give you an example in JavaScript, here are two ways to replace certain numbers from an other list of numbers with the number 0

    first a way to do it with a non pure function :

    let bannedNumbers = [4,6]

    const nums = [0,1,2,3,4,5,6,7,8,9]

     
        
    function replaceWithZero(nums){
        for (let i = 0 ; i < nums.length; i++){
            if (bannedNumbers.includes(nums[i])){
                nums[i] = 0
            }
        }
    }
    replaceWithZero(nums)
    console.log("numbers are : ", nums)
    
      

    here the function replaceWithZero does two things that make it impure. First it modifies its parameter. This can lead to issues, for example if you have Second it uses a non-constant variable outside of its scope (bannedNumbers). Which is bad because if somewhere else in the code someone changes bannedNumbers the behavior of the function changes.

    A proper pure implementation could look something like this :

     
        
    const nums = [0,1,2,3,4,5,6,7,8,9]
    function repalceWithZero(nums){
        const  bannedNumbers = [4,6]
        const result = []
        for(const num of nums){
            result.push(bannedNumbers.includes(num) ? 0 : num)
        }
        return result
    }
    const replaced = replaceWithZero(nums)
    console.log("numbers are : ", replaced)
    
      

    Here we are not modifying anything outside of the function's scope or its parameters. This means that no matter where, when and how often we call this function it will always behave the same when given the same inputs! This is the whole goal of pure functions.

    Obviously in practice can't make everything 100% pure, for example when making a HTTP request you are always dependent on external factors. But you can try to minimize external factors by making the HTTP request, and the running the result only through pure functions.

  • For new code I'm writing I'm using mostly JsDoc function headers on public methods of classes and exported functions. With one or two sentences explaining what function does.

    Also try to explain what to expect in edge cases, like when you pass am empty string, null, ... stuff of that nature - for which I then create unit tests.

    I also always mention if a function is pure or not or if a method changes the state of its object. On a sidenote I find it odd that almost no language has a keyword for pure functions or readonly methods.

    If I add a big new chunk of code that spans multiple files but is somewhat closed off, I create a md file explaining the big picture. For example I recently added my own closed off library to my angular frontend that handles websocket stuff like subscribing, unsubscribing, buffering, pausing,... for which a created a md file explaining it.

  • I don't know if these are uncommon but I have a few cool usecases besides the regular 1:1 folder syncing, maybe someone else finds them useful.

    Also you should know that the way I have all of this setup is that I have a container that hosts a bunch of SMB Network drives and a syncthing container that stores all of the fodlers on that drive. Having them also easily accessible through smb is great when I just wanna quickly copy something or back the folders up.

    So here are some of my maybe unorthodoz usecases :

    • Music - As a fan of offline music, I have it setup that music I acquire gets synced onto the server and re-encoded as opus through a script into a second folder which then through syncthing gets sent out my mobile devices. There I rather have smaller files than lossless quality. Said script also sorts the music into folders based on artist and album metadata.
    • I also sync my Newpipe Subscriptions between phones (unfortunately by manually exporting my settings and re-importing them)

    I also used to have a setup that would sync Minecraft Bedrock and Stardew Valley saves between devices (where Windows and Android saves are compatible) but Android 11 introduced a stupid restriction that prevents synching from accessing the the saves are located on Android.

  • Yes but there are also many parts of the System that can't be touched. The lockscreen, settings app, quicksettings area, task switcher,... are all things you have to use whatever the OEM forces you to use.

    Not to mention that launchers these days work jankier than ever.

    I believe that today's Google sees launchers as a misstake they made years ago and they now have to live with, rather than a concept that should be expanded to other parts of the OS.