Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. A tale in 3 pictures.

A tale in 3 pictures.

Scheduled Pinned Locked Moved Uncategorized
programming
103 Posts 56 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • citizen428@chaos.socialC citizen428@chaos.social

    A tale in 3 pictures. In which our hero wonders if he can and doesn't stop to ask if he should.

    #c #programming

    hirunatan@xarxa.cloudH This user is from outside of this forum
    hirunatan@xarxa.cloudH This user is from outside of this forum
    hirunatan@xarxa.cloud
    wrote last edited by
    #79

    @citizen428 this is funny, because this idea is real (more or less). The https://penpot.app is made this way!

    It's written in Clojure language, that also has a feature of creating macros (although with better syntax checks). We use the `rumext` framework, that defines macros that are expanded in compile time into HTML, react style.

    Link Preview Image
    GitHub - penpot/penpot: Penpot: The open-source design tool for design and code collaboration

    Penpot: The open-source design tool for design and code collaboration - penpot/penpot

    favicon

    GitHub (github.com)

    So here is your idea working in a hugely complex application, with the (little) issue that it's in a language with good macros... ๐Ÿ˜…

    hirunatan@xarxa.cloudH citizen428@chaos.socialC 2 Replies Last reply
    0
    • hirunatan@xarxa.cloudH hirunatan@xarxa.cloud

      @citizen428 this is funny, because this idea is real (more or less). The https://penpot.app is made this way!

      It's written in Clojure language, that also has a feature of creating macros (although with better syntax checks). We use the `rumext` framework, that defines macros that are expanded in compile time into HTML, react style.

      Link Preview Image
      GitHub - penpot/penpot: Penpot: The open-source design tool for design and code collaboration

      Penpot: The open-source design tool for design and code collaboration - penpot/penpot

      favicon

      GitHub (github.com)

      So here is your idea working in a hugely complex application, with the (little) issue that it's in a language with good macros... ๐Ÿ˜…

      hirunatan@xarxa.cloudH This user is from outside of this forum
      hirunatan@xarxa.cloudH This user is from outside of this forum
      hirunatan@xarxa.cloud
      wrote last edited by
      #80

      @citizen428 this is a real example of the code in the app:

      [:div {:class (stl/css :modal-overlay)}
      [:div {:class (stl/css :modal-dialog)
      :data-testid "token-theme-update-create-modal"}
      [:> icon-button* {:class (stl/css :close-btn)
      :on-click modal/hide!
      :aria-label (tr "labels.close")
      :variant "action"
      :icon i/close}]
      [:> themes-modal-body*]]]

      1 Reply Last reply
      0
      • citizen428@chaos.socialC citizen428@chaos.social

        The horrors:

        Link Preview Image
        C preprocessor abuse

        C preprocessor abuse. GitHub Gist: instantly share code, notes, and snippets.

        favicon

        Gist (gist.github.com)

        dragonfi@social.jsteuernagel.deD This user is from outside of this forum
        dragonfi@social.jsteuernagel.deD This user is from outside of this forum
        dragonfi@social.jsteuernagel.de
        wrote last edited by
        #81

        @citizen428 Thanks for sharing the code.

        In a weird way, this is exactly what the C preprocessor is designed to do.

        I still don't want to debug a bigger website though.

        citizen428@chaos.socialC 1 Reply Last reply
        0
        • dragonfi@social.jsteuernagel.deD dragonfi@social.jsteuernagel.de

          @citizen428 Thanks for sharing the code.

          In a weird way, this is exactly what the C preprocessor is designed to do.

          I still don't want to debug a bigger website though.

          citizen428@chaos.socialC This user is from outside of this forum
          citizen428@chaos.socialC This user is from outside of this forum
          citizen428@chaos.social
          wrote last edited by
          #82

          @dragonfi@jsteuernagel.de $DEITY no, I'd never want to actually work with this outside of a little late-night hack session.

          1 Reply Last reply
          0
          • ryanc@infosec.exchangeR ryanc@infosec.exchange

            @citizen428 Fine. I will not inflict further ideas upon you, but why do you hate fun?

            citizen428@chaos.socialC This user is from outside of this forum
            citizen428@chaos.socialC This user is from outside of this forum
            citizen428@chaos.social
            wrote last edited by
            #83

            @ryanc I'm just trying to avoid getting nerd sniped into spending any more time on this. I have a much bigger preprocessor abuse planned ๐Ÿ˜„

            1 Reply Last reply
            0
            • citizen428@chaos.socialC citizen428@chaos.social

              @wonka @Lemmus I did (do?) have a soft spot for Perl ๐Ÿ™‚

              stefanct@chaos.socialS This user is from outside of this forum
              stefanct@chaos.socialS This user is from outside of this forum
              stefanct@chaos.social
              wrote last edited by
              #84

              @citizen428 @wonka @Lemmus that's exactly the place where it stabs you with a rusty spoon.

              1 Reply Last reply
              0
              • siguza@infosec.spaceS siguza@infosec.space

                @citizen428 omg, you even serve it right from C code?! God, I want to unsee this...

                citizen428@chaos.socialC This user is from outside of this forum
                citizen428@chaos.socialC This user is from outside of this forum
                citizen428@chaos.social
                wrote last edited by
                #85

                @siguza Maximum cursed is what I was going for, so yes. If you prefer CGI and another web server you could use kcgi:

                Link Preview Image
                kcgi: minimal CGI and FastCGI library for C/C++

                A C/C++ library for security-oriented web applications.

                favicon

                (kristaps.bsd.lv)

                1 Reply Last reply
                0
                • hirunatan@xarxa.cloudH hirunatan@xarxa.cloud

                  @citizen428 this is funny, because this idea is real (more or less). The https://penpot.app is made this way!

                  It's written in Clojure language, that also has a feature of creating macros (although with better syntax checks). We use the `rumext` framework, that defines macros that are expanded in compile time into HTML, react style.

                  Link Preview Image
                  GitHub - penpot/penpot: Penpot: The open-source design tool for design and code collaboration

                  Penpot: The open-source design tool for design and code collaboration - penpot/penpot

                  favicon

                  GitHub (github.com)

                  So here is your idea working in a hugely complex application, with the (little) issue that it's in a language with good macros... ๐Ÿ˜…

                  citizen428@chaos.socialC This user is from outside of this forum
                  citizen428@chaos.socialC This user is from outside of this forum
                  citizen428@chaos.social
                  wrote last edited by
                  #86

                  @hirunatan Yeah, there are plenty of versions of this in all kinds of languages. But most of them have actual syntactic macros working on an AST, not just simple text replacement.

                  1 Reply Last reply
                  0
                  • fx@chaos.socialF fx@chaos.social

                    @citizen428 finally, webdev in C

                    citizen428@chaos.socialC This user is from outside of this forum
                    citizen428@chaos.socialC This user is from outside of this forum
                    citizen428@chaos.social
                    wrote last edited by
                    #87

                    @fx You might be the right kind of person to find https://learnbchs.org interesting then.

                    1 Reply Last reply
                    0
                    • malwareminigun@infosec.exchangeM malwareminigun@infosec.exchange

                      @citizen428 This is extra bad because cpp isn't specified in a way you can necessarily cough up matching text and different compilers resolve that problem in their preprocessed output in different ways...

                      citizen428@chaos.socialC This user is from outside of this forum
                      citizen428@chaos.socialC This user is from outside of this forum
                      citizen428@chaos.social
                      wrote last edited by
                      #88

                      @malwareminigun Does the first image not make it clear that this is not a serious post?

                      malwareminigun@infosec.exchangeM 1 Reply Last reply
                      0
                      • mirabilos@toot.mirbsd.orgM mirabilos@toot.mirbsd.org

                        @citizen428 ok, thatโ€™s a different kind of using cpp(1) as a webpage templating engine than what I did.

                        Wonโ€™t escape, of courseโ€ฆ

                        citizen428@chaos.socialC This user is from outside of this forum
                        citizen428@chaos.socialC This user is from outside of this forum
                        citizen428@chaos.social
                        wrote last edited by
                        #89

                        @mirabilos It won't escape and won't do many other things anyone would reasonably want. It's just a late night shitpost.

                        1 Reply Last reply
                        0
                        • aartaka@merveilles.townA aartaka@merveilles.town

                          @citizen428 yes, thatโ€™s a thing I built my website on, at some point <https://aartaka.me/this-post-is-cpp.html> (migrated to ed(1) since then.)

                          citizen428@chaos.socialC This user is from outside of this forum
                          citizen428@chaos.socialC This user is from outside of this forum
                          citizen428@chaos.social
                          wrote last edited by
                          #90

                          @aartaka Love the cursors, instant follow. Keep the web weird!

                          aartaka@merveilles.townA 1 Reply Last reply
                          0
                          • L luc0x61@mastodon.gamedev.place

                            @citizen428 The fact you can jump off the window isn't a good reason to do it. And don't mention someone brave who did: they're on the ground floor, stupid.

                            citizen428@chaos.socialC This user is from outside of this forum
                            citizen428@chaos.socialC This user is from outside of this forum
                            citizen428@chaos.social
                            wrote last edited by
                            #91

                            @luc0x61 Really? A cartoon calling it an "extremely bad idea" and an implementation covering a handful of tags wasn't enough of an indication that this was not a serious post?

                            L 1 Reply Last reply
                            0
                            • prlg@mastodon.onlineP prlg@mastodon.online

                              @citizen428 *points and snaps* Nord Theme.

                              citizen428@chaos.socialC This user is from outside of this forum
                              citizen428@chaos.socialC This user is from outside of this forum
                              citizen428@chaos.social
                              wrote last edited by
                              #92

                              @prlg Always Nord theme, on everything. I even made one for the OCaml's utop so it looks less out of place in my terminal:

                              Link Preview Image
                              ~citizen428/nord-utop - A Nord color theme for OCaml's utop toplevel - sourcehut git

                              favicon

                              (git.sr.ht)

                              1 Reply Last reply
                              0
                              • citizen428@chaos.socialC This user is from outside of this forum
                                citizen428@chaos.socialC This user is from outside of this forum
                                citizen428@chaos.social
                                wrote last edited by
                                #93

                                @nabijaczleweli You glorious madman, have a follow ๐Ÿ™‚

                                1 Reply Last reply
                                0
                                • ruenahcmohr@infosec.exchangeR ruenahcmohr@infosec.exchange

                                  @citizen428 for GCC, add #define true 1

                                  citizen428@chaos.socialC This user is from outside of this forum
                                  citizen428@chaos.socialC This user is from outside of this forum
                                  citizen428@chaos.social
                                  wrote last edited by
                                  #94

                                  @RueNahcMohr Works fine as-is. The Makefile targets `-std=c23` where `true` is an actual keyword. Unless I misunderstood your intention here.

                                  1 Reply Last reply
                                  0
                                  • citizen428@chaos.socialC citizen428@chaos.social

                                    @aartaka Love the cursors, instant follow. Keep the web weird!

                                    aartaka@merveilles.townA This user is from outside of this forum
                                    aartaka@merveilles.townA This user is from outside of this forum
                                    aartaka@merveilles.town
                                    wrote last edited by
                                    #95

                                    @citizen428 yay, I didnโ€™t make these in vain ๐Ÿคฉ

                                    1 Reply Last reply
                                    0
                                    • citizen428@chaos.socialC citizen428@chaos.social

                                      @luc0x61 Really? A cartoon calling it an "extremely bad idea" and an implementation covering a handful of tags wasn't enough of an indication that this was not a serious post?

                                      L This user is from outside of this forum
                                      L This user is from outside of this forum
                                      luc0x61@mastodon.gamedev.place
                                      wrote last edited by
                                      #96

                                      @citizen428 I've seen enough to witness that some humorous exits have been chosen as real solutions ๐Ÿ˜€
                                      Would you believe that I've seen someone printing a variable as binary text to further process it with binary logic on single ASCII digits, instead of using the logical operators native of any CPU?

                                      citizen428@chaos.socialC 1 Reply Last reply
                                      0
                                      • citizen428@chaos.socialC citizen428@chaos.social

                                        A tale in 3 pictures. In which our hero wonders if he can and doesn't stop to ask if he should.

                                        #c #programming

                                        exec@furry.engineerE This user is from outside of this forum
                                        exec@furry.engineerE This user is from outside of this forum
                                        exec@furry.engineer
                                        wrote last edited by
                                        #97

                                        @citizen428 Several years ago I had the idea of doing the same in Lua (though not a preprocessor, of course)

                                        1 Reply Last reply
                                        0
                                        • L luc0x61@mastodon.gamedev.place

                                          @citizen428 I've seen enough to witness that some humorous exits have been chosen as real solutions ๐Ÿ˜€
                                          Would you believe that I've seen someone printing a variable as binary text to further process it with binary logic on single ASCII digits, instead of using the logical operators native of any CPU?

                                          citizen428@chaos.socialC This user is from outside of this forum
                                          citizen428@chaos.socialC This user is from outside of this forum
                                          citizen428@chaos.social
                                          wrote last edited by
                                          #98

                                          @luc0x61 Fair enough.

                                          And yes, I'll believe almost everything at this point, though your example is definitely one of the more bizarre ones.

                                          I once had to work with an API we paid good money for, which essentially was configurable through bit flags via `?options=<32-digit or so binary string>`. And to generate that option string they gave you an Excel sheet.

                                          L 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups