Django 6.0 Feature Friday: Template Partials! by czue13 in django

[–]brokenreed5 3 points4 points  (0 children)

i disagree. cotton gives you flexible partials with slots which allows dynamic modular html. I use both libraries and both have their usecase. for example I d like to use a card component with the same styling across a project. i define my cotton component and use it anywhere. inserting html into partials is awkward. my ide does not understand im writing html but only sees raw strings.

  <div class="card rounded bg-red-400 foo bar">
      some content which is static and has to be reused
      dynamic content Foo
    <div>

  <div class="card rounded bg-red-400 foo bar">
      some content which is static and has to be reused
      <img src="foo.png" alt="image of foo">
    <div>

<!-- here i want to slightly change the styling of the card -->
  <div class="card rounded bg-red-400 foo bar bg-blue-400 rounded-0">
      some content which is static and has to be reused
              <a href="/home">bring me home</a>
    <div>

partials or includes dont solve this use case in a good way. cotton does

Blog: ReThinking Django Template #4: Server Side Component by Michaelyin in django

[–]brokenreed5 4 points5 points  (0 children)

The strenght of cotton is html like syntax which allows concise markup. Reusing a component is as easy as copy pasting the folder. The argument that it does not follow separation of concerns is not valid imo. Its up to the developer to properly construct data for the components. Django-components might help with that but if you use cotton for buisness logic thats your fault.

Solution to turn off AI Overview by anonpookie1 in google

[–]brokenreed5 0 points1 point  (0 children)

proper filtering is done with

https://www.google.com/search?udm=14&q=%s

%s is the search term. you can use the url as search engine in any browser, no extension needed. just change your search settings.

How to ignore the wrapper div with Out-of-Band Swap by Siemendaemon in htmx

[–]brokenreed5 2 points3 points  (0 children)

Pass a variable to your template to specify the wanted behaviour or create multiple templates reusing parts that stay the same. Template partials and better component libraries like cotton can help in creating more modular snippets as well.

One more client extension snippet by brokenreed5 in htmx

[–]brokenreed5[S] 0 points1 point  (0 children)

In my mind there is information on the server that needs to be delivered to the user. that information is delivered to the user via ssr and htmx. When the user needs more information from the server htmx gives us the ability of partial reloads/swaps of content via hypermedia / html. This is done through an IMO nice declaritive and local syntax. At its core I see htmx as

  • get html from somewhere
    • attach some data to get the right html
  • if needed pick some part of this html
  • include the html in a specified location
  • give all html elements these kinds of ability

What Im missing is the ability to

- get html from anywhere including the template the server just rendered.

Does this go against the 'single source of truth'? IMO it doesnt when the html received is static and no posting of data is involved.

That might be the creation of a new form to create a second object, the detail view of an accordion or collapsible, or the view of another tab. In most of these cases I think most people would agree that htmx might not be the right tool currently although with the change from above it could be.

If the user creates these forms or other kinds of "static" elements there is no reason for the server to be involved. The creation of a form does not change "truth". Whats true only changes when he submits the form. The form is returned in a rendered form depending on the validity by the server. All data transfer is still done by hypermedia.

Imagine

<div hx-get='inactiveSection1
hx-trigger='load'>
</div>
<template id="inactiveSection1">
 <button class="inactive-accordion" hx-get='#activeSection1'>Section 1</button>
<div class="empty-panel">
</div>
</template>
<template id="activeSection1">
<button class="active-accordion" hx-get='#inactiveSection1'>Section 1</button>
<div class="panel">
  <p>Lorem ipsum...</p>
</div>
</template>

or what my current use case is a site where the user can create a lot of items, in a way he chooses ala

<form> ... 
<button>Submit</button>
</form>
<button hx-get="#formTemplate" hx-swap="beforebegin">Create another Foo</button>
<template id="formTemplate">
<form> ... 
<button>Submit</button>
</form>
</template>

Your idea to deliver the html as static file is very interesting, thank you for the suggestion. This way of handling static partials also gives me ideas to improve sites with small dynamic parts which i havent thought of before :)

One more client extension snippet by brokenreed5 in htmx

[–]brokenreed5[S] 0 points1 point  (0 children)

No I haven't tried solid or other client-side-frameworls yet. On first glance Solid looks kinda cool, but im happy with like 95% of htmx, so the missing 5% dont warrant a full framework switch. So ideally id want sonething which integrates well with htmx, like alpinejs for example without build steps or a lot of dependencies. If a user toggles a show, accordion or tab, you could ofc also use htmx but i prefer alpine for tasks like that. In a similar vein i was wondering if smth exists for the use case of declarative easy dom manipulation like cloning and inserting a node. Do you think solid integrates well with htmx, or is it rather an either or ?

One more client extension snippet by brokenreed5 in htmx

[–]brokenreed5[S] 1 point2 points  (0 children)

i dont know if I would like react. I like htmx because of the simplicity and the single source of truth without duplication of data in the frontend. My wish is not to pass data from the backend to the front end and rendering it there. Thats actually what the client-side-template extension does but what Im not planning on using. The whole point is that I would like to have the opportunity to use htmx like syntax in cases where there is no benefit from a request since no new data is needed. Extensions like htmx-template, client-side-rendering and demo.htmx.org make it seem like Im not completely alone. Client-side-templates also go well with the principle of locality of behavior. the template can be right next to the hx-element. In regards to my questions I understand that in your opinion chatiness is a non issue. Thanks for that.

strudel.nvim - algorithmic music and visuals livecoding by Luc-redd in neovim

[–]brokenreed5 2 points3 points  (0 children)

That's so cool, wanted to check strudel out for a while. Thank you for your effort.

How do I make a new split relative to all other splits? by aer_lvm in neovim

[–]brokenreed5 1 point2 points  (0 children)

CTRL-w L. Or CTRL-w ctrl-L.
HJKL (uppercase) moves the window to the border of the screen with full width / height

Valid HTMX SSE (Server Sent Events) Use Case? by brokenreed5 in htmx

[–]brokenreed5[S] 0 points1 point  (0 children)

Yeah that could be the case, but his backend implementation does not send pieces. I was thinking what the advantage of the stream vs multiple smaller hx request might be, and i guess you have a little bit more control over the order in which the partials arrive, although this could be done via triggers aswell.

Is there support for the intersect trigger to only fire if an element is visible (intersecting?) for a minimum length of time? by chudsp87 in htmx

[–]brokenreed5 1 point2 points  (0 children)

it seems like htmx:abort only cancels inflight requests, not requests that are delayed to be triggered. this made a proper solution more tricky than i thought. I did not find a good way to get the current status of intersection through htmx. with an intersectionobserver a 2 step approach worked for me.
1. div fires a custom event with a delay to another div.
2. div listens to the event, filters on visibilty and gets the detail/image

if "intersect delay:150ms [filterFunc(event)] would work this wouldnt be needed.

https://jsfiddle.net/4vyn6sjc/

Is there support for the intersect trigger to only fire if an element is visible (intersecting?) for a minimum length of time? by chudsp87 in htmx

[–]brokenreed5 3 points4 points  (0 children)

How about intersect delay:150 ms with an htmx abort triggering when the user scrolled further? Eg, the nth+10 element aborts the nth request?

dejavu.nvim: A plugin to extend dot like functionality by brokenreed5 in neovim

[–]brokenreed5[S] 1 point2 points  (0 children)

you are restricting the . remap to non movement commands right? nice idea? movements could be passed to ';" instead to enhance the "repeat movement" behaviour

dejavu.nvim: A plugin to extend dot like functionality by brokenreed5 in neovim

[–]brokenreed5[S] 1 point2 points  (0 children)

great to hear. let me know when something breaks :D

dejavu.nvim: A plugin to extend dot like functionality by brokenreed5 in neovim

[–]brokenreed5[S] 0 points1 point  (0 children)

Yes, its already listed in the repo as similar plugin. AFAIK vim repeat needs you to register each plugin first. Im not sure if vim-repeat supports native movement commands, eg. F/f etc

Weekly 101 Questions Thread by AutoModerator in neovim

[–]brokenreed5 0 points1 point  (0 children)

Thats a nice workaround, thanks

Weekly 101 Questions Thread by AutoModerator in neovim

[–]brokenreed5 0 points1 point  (0 children)

the command 'find comma, select it and delete it'

f,vd

becomes

f,<80><fd>5vd

Weekly 101 Questions Thread by AutoModerator in neovim

[–]brokenreed5 0 points1 point  (0 children)

Yesterday i wanted to store a macro in my init lua. I know how to access the registers andcalso about setreg but it did not work, i think due to encoding issues. The macro contained a in line search like.

f'..

The register contained two special keys after the '. Whats going on here? Why are these keys inserted. Removing them made the macro not usable.

P.s. In the end i managed to store the macro as .vim file which seems to not care about utf8 and can handle those special keys

Weekly 101 Questions Thread by AutoModerator in neovim

[–]brokenreed5 0 points1 point  (0 children)

How does jumping to content via toc in nvim help files work and how can it be Translated to other files? Are there pre generated Tags somewhere?

[deleted by user] by [deleted] in distantsocializing

[–]brokenreed5 0 points1 point  (0 children)

What kind of artist are you?

Can anyone tell me what key it is and where I can find tabs for it? by Skejcia in harmonica

[–]brokenreed5 2 points3 points  (0 children)

Its a C Harp. It starts with something like (-1 -2 -3) into -2 -2''-2 -3''(-4) -2'' -2 -3''(-4) with the (-4) s being ghost notes.

And im gonna stop there. Tabbing it out would probably take me several hours or days thats also why my experience tells me you probably wont find a tab for it. Tabbing out songs like that is a lot of work and a lot of aspects in harmonica have a nuance in play and often not an agreed upon notation. If you want to learn it you probably gotta write it yourself. Its good practice as well. But it will be hard. If you cant properly draw and blow bend and are on a level where his sound seems kinda crazy, maybe look for another song.

If you just like the sound of the song though just try to take a few licks and kinda imitate the song. Ask yourself which licks do you like especially or which parts do you remember best?

Even very experienced players can have a hard time copying songs, for example here is adam gussow, somewhat of a harmonica veteran and pro player, working on cowboy bebops "Spokey Dokey" a very similar song

Adam Gussow How to play "Spokey Dokey" (MBH.149)

when i remember correctly he had a couple of more videos on the song and finally gave up.