Skip Navigation

Posts
30
Comments
533
Joined
2 yr. ago

  • WASM is a bit overkill and is also complicated. I need a simple scripting language that won't stress the users out. As mentioned in my post, I expect them to be absolute beginners.

  • Thanks for this. Seems like I'll go with Lua. I actually did try Rhai before posting this and it did work pretty easily and had a very nice and convenient plugin system. But it had no LSP and on top of that, it wasn't as easy as Lua.

  • Thanks for the suggestion. Though JS itself is a pretty weird language and has some weird behaviours, I'd rather not use it. It's also a bit too advanced for my use case. (somewhat simple control flow, maybe some math, etc.)

  • Thanks for understan

  • test

    Jump
  • holy fucking shit it finally works

  • I would've considered buying this. That's a good deal.

  • here, it definitely is shorter, I'll keep filter_map in mind, thanks:

     rust
        
    fn get_links(mut link_nodes: Select) -> Vec<String> {
        link_nodes.into_iter().filter_map(|node| node.value().attr("href").map(|href| href.to_string())).collect()
    }
    
      
  • it answers your question. you don't expect me to spoon feed you, do you? learn how to read documentations

  • Vanilla Arch.

  • What source? That was obvious sarcasm.

  • Here's what you are trying to do, with a one liner:

     rust
        
    fn get_links(mut link_nodes: Select) -> Vec<String> {
        link_nodes.retain(|node| node.value().attr("href").is_some()).into_iter().fold(Vec::new(), |links, node| links.push(link.value().attr("href").unwrap().to_string()))
    }
    
      

    edit: shorter and updated version:

     rust
        
    fn get_links(mut link_nodes: Select) -> Vec<String> {
        link_nodes.into_iter().filter_map(|node| node.value().attr("href").map(|href| href.to_string())).collect()
    }
    
      

    The retain method is to get rid of all the nodes which don't have a href attribute and the fold method after it is to extract the href out of the nodes and push them into the vector.

    It might work or not, I've written this from my memory and I can't exactly know what that Select is.

    I also hope you begin reading The Book without half assing it.

  • No problem calling third parties Russian spies without evidence. But waging a genocide does not make one a Nazi.

    I don't care what americans say about third parties, I am not one of them, nor do I want to be one. I simply stated that a nazi is not one who supports genocide, by definition. Would you call helping some random stranger that happens to be supporting trump (which supports genocide) helping a nazi intentionally?

    By your logic, anyone that supports genocide is a trump fan, hitler fan, etc.

  • Linux was optimized to be used as a desktop OS?

  • Link to presentation?

  • They are in an illusion where their backend is absolutely perfect, but third party apps like open source keyboards implement spyware that spies on users predictable bank passwords. (FlorisBoard is the biggest predator)

  • They should upgrade soon. One of the LW admins said that they were waiting for this release.

  • A new official UI is coming, which might improve the UX.

  • New Communities @lemmy.world

    2024 Anime related active communities promotion post

  • copypasta @sh.itjust.works

    I am the Rust programmer.

  • Programming @programming.dev

    Feature requests for a lemmy moderation bot

  • Fediverse @lemmy.ml

    Feature requests for a lemmy moderation bot

  • Fediverse @lemmy.world

    Feature requests for a lemmy moderation bot

  • Lemmy Moderators @lemmy.world

    Feature requests for a lemmy moderation bot

  • Open Source @lemmy.ml

    Feature requests for a lemmy moderation bot