There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

open_world , in every damn time ...
@open_world@lemmy.world avatar

I feel like this popup shows up too often

technojamin ,

If you have a common folder that you clone projects to (like OP’s ~/coding), then that checkbox lets you trust that whole folder easily when this pop up comes up.

Tsubodai ,

I have a coding folder “repos”. It’s on a remote machine though and I get this every time I connect to my code folder using a new remote host. So annoying!

jballs , in We've come a long way baby
@jballs@sh.itjust.works avatar

I read in a different post that the code was misinterpreted to be a 5 second sleep before showing the video, but instead was waiting 5 seconds to execute some anti-ad-block script. Still pretty sleazy either way.

A_Very_Big_Fan ,

There’s a video going around of a guy using a useragent spoofer to prove that it only does this on non-Chromium browsers. So I don’t think it’s necessarily anti-adblock, but it could be interpreted that way when you consider Google’s plans to implement DRM in Chromium.

vpklotar ,

Had a look at Louise Rossmans video yesterday about this and from what he showed he got it on all browsers.

Video: https://youtu.be/_x7NSw0Irc0?si=My5Nurw4XqdjDH8l

Solemarc ,

When I went rooting around to find it. I figured it was some QA process that starts 5 seconds after the video loads (the timer seems to be async and the code sends a promise off while it waits). Of course, it’s all minified JS so it’s a huge pain to read.

dannym , in Merge then review

If somebody actually did that it would be grounds for removing their privileges to merge into master. THIS, THIS is why the JavaScript ecosystem has gotten so bad, people with mentalities similar to his.

xmunk , in Best VS Code theme

My eyes.

Tetsuo ,

Now code is imprinted straight to your retina.

You can see the code long after in your sleep and keep on optimizing it.

JoMiran , in Memory is overrated
@JoMiran@lemmy.ml avatar

I’ve been at this for almost thirty years. At this point, I’ve forgotten more than I have ever learned.

PapstJL4U , in It’s a game for kids!
@PapstJL4U@lemmy.world avatar

Before studying CS, I recognized it as ‘the bioware puzzle’. They were probably copying their own scribbles fron back then.

Haskell was the hardest, but it looked the most beautiful.

lugal ,

Haskell was the hardest, but it looked the most beautiful.

That pretty much sums that language up

DarkenLM ,

Strange. I find the language hideous, most likely because it resembles math, or maybe because I'm already used to the C-like syntax.

lugal ,

Haskell is beautiful because it resembles math

xigoi ,
@xigoi@lemmy.sdf.org avatar

It’s also beautiful because it doesn’t have C-like syntax.

mindbleach ,

Functional programming flips your brain around backwards, but shader programming will turn it inside-out.

manpacket ,

For more brain flipping try looking into hardware description languages (Verilog) or proof assistants (Coq).

TheBananaKing ,

In order to write a haskell program, you must first write the corresponding haskell program.

lugal ,

And in order to do that, you have to imagine sisyphus happy

Knusper ,

<span style="font-weight:bold;color:#795da3;">hanoi </span><span style="font-weight:bold;color:#a71d5d;">:: Integer -> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-></span><span style="color:#323232;"> [(a, a)]
</span><span style="color:#323232;">hanoi 0 _ _ _ </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">[]
</span><span style="color:#323232;">hanoi n a b c </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> hanoi (n</span><span style="font-weight:bold;color:#a71d5d;">-</span><span style="color:#0086b3;">1</span><span style="color:#323232;">) a c b </span><span style="font-weight:bold;color:#a71d5d;">++</span><span style="color:#323232;"> [(a, b)] </span><span style="font-weight:bold;color:#a71d5d;">++</span><span style="color:#323232;"> hanoi (n</span><span style="font-weight:bold;color:#a71d5d;">-</span><span style="color:#0086b3;">1</span><span style="color:#323232;">) c b a
</span>

From here: www.rosettacode.org/wiki/Towers_of_Hanoi#Haskell

DumbAceDragon , (edited )
@DumbAceDragon@sh.itjust.works avatar

https://media.tenor.com/1bIptSWki_kAAAAd/unintelligible.gif

Edit: I understand it now. That first line is just a really weird way to define a function.

Knusper ,

Welp, imma try myself at an explanation. Mostly cause I haven’t written Haskell in a while either.

So, that first line:


<span style="font-weight:bold;color:#795da3;">hanoi </span><span style="font-weight:bold;color:#a71d5d;">:: Integer -> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-></span><span style="color:#323232;"> [(a, a)]
</span>

…actually only declares the function’s type.

In this case, it’s a function that takes an Integer and three values of a generic type a and then returns a list of tuples of those same as.
So, those as are just any types representing the towers. Could be strings, integers, custom data types, whatever. The returned tuples represent movements between towers.

Following that are actually two definitions of the function.

The first definition:


<span style="color:#323232;">hanoi </span><span style="color:#0086b3;">0</span><span style="color:#323232;"> _ _ _ </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">[]
</span>

…is the recursion base case. Function definitions are applied, whenever they match, being evaluated top-to-bottom.

This line specifies that it only matches, if that first Integer is 0. It does not care what the remaining parameters are, so matches them with a wildcard _.
Well, and to the right side of the equals sign, you’ve got the return value for the base case, an empty list.

Then comes the more interesting line, the recursion step:


<span style="color:#323232;">hanoi n a b c </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> hanoi (n</span><span style="font-weight:bold;color:#a71d5d;">-</span><span style="color:#0086b3;">1</span><span style="color:#323232;">) a c b </span><span style="font-weight:bold;color:#a71d5d;">++</span><span style="color:#323232;"> [(a, b)] </span><span style="font-weight:bold;color:#a71d5d;">++</span><span style="color:#323232;"> hanoi (n</span><span style="font-weight:bold;color:#a71d5d;">-</span><span style="color:#0086b3;">1</span><span style="color:#323232;">) c b a
</span>

This line matches for any remaining case. Those small letter names are again wildcards, but the matched value is placed into a variable with the provided name.

And then, well, it recursively calls itself, and those ++ are list concations. This line’s only real complexity is the usual Tower Of Hanoi algorithm.

AllonzeeLV , in ಠ_ಠ

I’ll answer your judgment with judgment.

The alternative is humans.

Have you met us? We’re no prize.

Colorcodedresistor ,

deleted_by_author

  • Loading...
  • DragonTypeWyvern ,

    They’ve got genocide down though

    NegativeLookBehind , in ಠ_ಠ
    @NegativeLookBehind@kbin.social avatar

    I mean, he made friends with AI

    ZeroCool OP ,

    Yeah but the T-800 had cool sunglasses. It’s okay to be friends with robots if they’re wearing cool sunglasses.

    agent_flounder ,
    @agent_flounder@lemmy.one avatar

    Didn’t ZZ Top do a song about that?

    Kowowow , in Monitor Alignment Alignment Chart

    what about having a tv across the room as a second monitor?

    Just_Pizza_Crust ,

    If you only use the TV to watch media, you’re lawful neutral. If you use it for gaming or anything else, you’re chaotic good.

    user224 ,
    @user224@lemmy.sdf.org avatar

    It’s still going to be better than screen on budget laptops. I am convinced my laptop’s screen is 30Hz and it surely wasn’t manufactured to produce colors.

    RaivoKulli ,

    Hah, I’m just gaming on a laptop but one that’s connected to my TV

    ObsidianBlk , in Which side are you? Javascript or Typescript
    @ObsidianBlk@lemmy.world avatar

    My issue with typescript… and, correct me if I’m wrong… is it doesn’t exist without Javascript. Typescript needs to be compiled down into Javascript to be run. It has no stand alone interpreter (that I’m aware of) and definitely not one baked into web browsers or NodeJS (or adjacent) tools. In essence, Typescript is jank sitting on top of and trying to fix Javascript’s uber jank, simultaneously fracturing the webdev space while not offering itself as a true competitive and independent language for said space.

    That’s my amateur two cents for what it’s worth.

    madcaesar ,

    You are correct.

    That says I would never ever EVER start a project without TS.

    It’s like coding with hands vs coding with your elbow.

    EarMaster ,

    I also don’t want to compile my C++ code myself. I’m pretty happy with letting a compiler do it’s job…

    fidodo ,

    I really don’t get how people can feel more productive in JavaScript. With typescript the code practically writes itself. Sometimes when refactoring I’ll change a functions input and output signature and just fix compiler errors until it stops complaining, and the code just works without me having to really even think about what the code is doing.

    Any time I’m forced to go back to js I feel like I’m going crazy trying to keep track of what’s in all the variables. With typescript I can use more powerful object structures without having to constantly double check where they came from.

    CanadaPlus ,

    What we really need is a browser that runs something other than Javascript. Until then, stack of jank it is.

    SoBoredAtWork ,

    WASM?

    CanadaPlus ,

    Is that a standalone thing? This is obviously not my specialty but I thought it was part of Javascript.

    SoBoredAtWork ,

    I’ve never worked with it and don’t know in detail, but it lets you compile several languages into web based client/server code (basically, converting other languages into website code). Works with C, C++, C#, Go, Rust, Swift, etc)

    brian ,

    I don’t think it really fractures anything considering you can call a ts package from js without knowing. The other way also works with third party typings in DefinitelyTyped.

    It really just adds a bit of extra type info into js, looks like js, and transpiles into js that looks almost exactly like the input, including comments and spacing and such if you like, so there isn’t any lockin.

    There isn’t any competition, it’s just an extra optional tool for the js ecosystem in my eyes.

    shasta ,

    I think too many people ITT are conflating Typescript with Typescript frameworks like Angular.

    fidodo ,

    The transpilation that typescript does doesn’t really have anything to do with typescript, it’s just there because typescript wants to support the latest ecmascript features, so transpilation is necessary for that, but technically you could simply strip out the type info and have another transpiler like babel handle the backwards compatibility. I think there are a few minor exceptions to that, like enums. There was even a proposal to add some typescript types to native JavaScript that would be ignored by the interpreter and just act as comments.

    brian ,

    I mean, tsc without any of the backporting functionality is still a transpiler since it goes from a high level language(ts) to another high level language(js). Transpilation as a concept doesn’t imply that it is for backporting language features or that the source and destination languages are the same, just that it is a transformation from source code to a similar or higher abstraction level language source code

    fidodo ,

    Yes, it’s still a transpiler, I’m not saying it isn’t, but what I mean is that it doesn’t add any functionally specific to the typescript language. There’s a transpiler for TS that doesn’t even do any type checking at all and just does the type stripping and back porting. But of course, that’s not why people use typescript. All the features that are actually important to typescript could be done through a linter instead. If type annotations were added to JavaScript you could get most of typescript’s features with linting rules and just handle back porting in a more standard way.

    lily ,

    Just fyi, while they don’t help with running TS in the browser, the Bun and Deno runtimes both natively run TS without any compilation.

    severien ,

    That’s not true, deno compiles TypeScript to JavaScript, it just does it transparently. The code still runs on v8.

    brian ,

    V8 also doesn’t run js, it does some byte code compilation stuff amongst other things, then interprets that. But that’s all a bit pedantic too, V8 runs js, deno runs ts.

    fwiw deno.com even has as one of their first bullet points that they have “native support for TypeScript and JSX”

    severien ,

    Sure, but part of the claim was “without any compilation”. But bun/deno do compile TS into JS.

    Anticorp ,

    As a professional with 25 years of experience I agree with you. The entire modern architecture was created by people who don’t like simple things that work. I’m pretty sure there are a couple of high ranking master developers sitting at the head of W3C competing to create the most convoluted system possible.

    DogMuffins ,

    I agree.

    I’m a hobbyist. I don’t work on really large or complex projects. I just want to get the most productivity for my spare-time-dabbling and having tried a few times to get into typescript it seemed to create more “extra steps” for me than it saved.

    JakenVeina ,

    The fact that TypeScript doesn’t attempt to obfuscate JavaScript, and just fills in the gaps, is what makes it the best solution to the problem.

    It’s not a separate language, it’s Javascript tooling

    fidodo ,

    I’ve used JavaScript since its creation. I would describe typescript as JavaScript as it should have been. I’ve always actually liked JavaScript’s simplicity, but I’ve never liked its lack of type safety. At its core, JavaScript has a tiny conceptual footprint, and that’s actually pretty refreshing compared to other very complicated languages. But it was plagued with terrible implementations and the inherent messiness of dynamic typing. I’ve watched it evolve over the years and it’s improved beyond my greatest hopes. Between the advent of transpilation, tooling, and typescript, I’m very proud of where the language has gotten to. Having made websites in the 90s and 00s, I feel like people don’t realize how much work has gone into getting the ecosystem in a much better place.

    guts ,

    Like 2023 CoffeeScript?

    fidodo ,

    Typescript doesn’t have strong typing but static typing still gets you really really far. It means you need to be more careful with your io and avoid dangerous type assertions, but I don’t think that’s a bad thing. Having used typescript an absolute ton, the only real jank I’ve encountered is from bad library typings that either use it lazily or incorrectly, but for code bases that use it through and through it has been smooth sailing, and having professionally used both traditional static typed languages and dynamically typed languages, I really enjoy typescript’s type inference and structural typing. I think you should give it an honest try before judging it. But that’s just my 2 cents as an industry professional who has used many languages and have been programming for decades for what it’s worth.

    01189998819991197253 , in Hallelujah
    @01189998819991197253@infosec.pub avatar

    Add ls.bat in your windows directory with dir as the source. It basically acts as an alias.

    jasondj ,

    Still won’t help me when I type ifconfig or dig, though.

    Also I’ve noticed there is also a curl in Windows CLI that I believe is based on libcurl, but when called from powershell is an alias for (iirc) Invoke-WebRequest.

    w2tpmf ,

    ifconfig doesn’t even work in a lot of Linux distros anymore.

    jvisick ,

    I came across this one just yesterday and while it was convenient at first, I immediately got frustrated when I went to add some parameters and discovered it wasn’t actually curl

    JustBrian7872 ,

    Classic PoweShell experience. Try rm -rf - I wonder why they added the aliases in the first place. Only frustrating to type different arguments which are also more verbose. Tastes like the good ol’ embrace-extend-extinguish.

    PoolloverNathan ,

    Fortunately splitting up the arguments works in Powershell sometimes: rm -r -f

    jarfil , in This is clearly shaping up to be the pinnacle of this decade's technology
    1. Don’t roll out your own crypto suite
    2. Don’t write your own game engine
    3. Don’t create your own OS from scratch
    4. Don’t build another multipurpose framework

    Whom am I kidding, go do all of that! Learn why you most probably shouldn’t 😆

    Sonotsugipaa OP ,
    @Sonotsugipaa@lemmy.dbzer0.com avatar

    Ew, knowledge and experience, pweh disgusting

    fckreddit ,

    I want to learn how to write a physics engine.

    jarfil ,

    Those are easy, unless you want 128bit resolution, relativistic effects, collisions, or fancy stuff like that.

    PS: Bonus points if you write one without collision detection, then sell it as a game on Steam.

    PS2: Super Bonus points if you make it 64bit, then keep crowd-funding it for 10 years.

    Norgur ,
    1. Don't make an MMORPG as your first ever game with only you and your one friend as devs
    Sonotsugipaa OP ,
    @Sonotsugipaa@lemmy.dbzer0.com avatar

    Oddly specific?

    Norgur ,

    Yet depressingly common in MMORPG circles. People tend to vastly underestimate the amount of work needed to get an remotely playable MMO off the ground.

    Sonotsugipaa OP ,
    @Sonotsugipaa@lemmy.dbzer0.com avatar

    I’ve entertained the idea, and the first to requirements that come to mind are advertising money and server upkeep money - then one could start worrying about actually making it

    drew_belloc ,
    @drew_belloc@programming.dev avatar

    What is this smell? Is that the smell of self experience?

    Norgur ,

    Nah, I can't tell a Class from a Function in most programming languages. I ain't making no game.

    257m ,

    You won’t be able to mistake the two if you don’t use Classes.

    MagicShel ,

    Oh, was it you who made Sociolotron?

    sheepishly ,
    @sheepishly@kbin.social avatar

    What if I make an OS that's also a game engine?

    Sonotsugipaa OP ,
    @Sonotsugipaa@lemmy.dbzer0.com avatar

    Hear me out: a fully fledged desktop environment, like KDE Plasma or Gnome, but it’s a 3D world - “windows” are just walls, the file explorer is just a bunch of procedurally generated condos, and you get a Gmod physics gun to move stuff around.

    Norgur ,

    Soooo.. Microsoft Bob in 3d?

    Sonotsugipaa OP ,
    @Sonotsugipaa@lemmy.dbzer0.com avatar

    Microsoft bob in 3D with a Gmod physics gun

    ytrav , in Golang be like

    lints that underline unused vars as errors, and not notes or warns are the worst lints…

    Hack3900 , in Brace Style

    I kinda like it…

    olafurp ,

    Who’s going to write the extension so that they are all hidden and automatically inserted?

    VonReposti , (edited )

    I think you’ll like Ruby. It has mostly done away with braces and code blocks end with end, e.g.

    
    <span style="color:#323232;">def create
    </span><span style="color:#323232;">  unless admin redirect_to new_session_path and return
    </span><span style="color:#323232;">  
    </span><span style="color:#323232;">  @product = Product.new product_params
    </span><span style="color:#323232;">
    </span><span style="color:#323232;">  if @product.save
    </span><span style="color:#323232;">    flash[:success] = "New product has been created!"
    </span><span style="color:#323232;">    redirect_to edit_product_path(@product) and return
    </span><span style="color:#323232;">  else
    </span><span style="color:#323232;">    flash[:error] = "Something went wrong!
    </span><span style="color:#323232;">    render :new
    </span><span style="color:#323232;">  end
    </span><span style="color:#323232;">end
    </span>
    

    This is working code that I simplified a bit from an old project of mine.

    olafurp ,

    Ruby syntax is nice although I prefer python way of enforcing indentation instead of adding "end"s. Personally I just want a statically typed language with enforced indent as syntax.

    VonReposti ,

    Funny, the forced indentation is what I hate about Python. If you think a missing semicolon can be hard to catch, don’t ever think about a missing whitespace :p

    The end keyword really isn’t a big deal for me. I find it to be a good way to easily spot the end of a method. But if you wouldn’t like it I’d still find it a good compromise to avoid syntax issues due to whitespace.

    hglman ,

    i can count on one hand how many times ive had white space issues in 15 years of using python. its just not an issue

    0ops ,

    Same and agreed, especially if you keep your functions small and focused as you should. 3-5 indents is nbd to keep track of, and if you need more than that… No you don’t, refactor.

    I’ve had way more hangups with brackets then indentation, personally, not that either is a super frequent issue, but I’m indenting anyway, so brackets are redundant and just another thing I have to keep track of

    JackbyDev ,

    } helps me easily spot the end of stuff. end just blends into the statements.

    JackbyDev ,

    Just add a linter to your build lol. Now if it’s indented wrong it breaks!

    barsoap ,

    That’s just Algol instead of B. Most languages use the one or the other, then there’s sexpr-based languages (lisp, scheme), lua (technically Algol but not needing semicolons while also not needing newlines so it’s definitely special), and layout syntax (Haskell, or, if you want a bad implementation, python).

    bss03 ,

    Might check out the Haskell layout rules.

    Basically, when you leave out the ‘{’ then Haskell uses your intendation to insert ‘;}’ on later lines between the leading whitespace and the first token.

    There some really old Haskell code out there that lines up the ‘{;}’ characters on the left under block-introduction keywords.

    barsoap ,

    It’s not just old Haskell code that’s how you write Haskell if you want explicit braces. Well, mostly generate, but it’s still the idiomatic formatting (and when you generate you always generate braces because it’s easy to get layout subtly wrong when generating).

    Haskell also does the whole

    
    <span style="font-weight:bold;color:#a71d5d;">data </span><span style="color:#0086b3;">Foo </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">Bar
    </span><span style="color:#323232;">         </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Baz
    </span><span style="color:#323232;">         </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Quux
    </span><span style="color:#323232;">
    </span><span style="color:#323232;">foo </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> [ </span><span style="color:#0086b3;">Bar
    </span><span style="color:#323232;">      , </span><span style="color:#0086b3;">Baz
    </span><span style="color:#323232;">      , </span><span style="color:#0086b3;">Quux
    </span><span style="color:#323232;">      ]
    </span>
    

    thing, makes sense to apply it to braces especially as they’re seen only very rarely. Single-line, yes, but not multi-line.

    Binette , in Brace Style

    Pseudo-python

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines