- Feb 2024
-
unix.stackexchange.com unix.stackexchange.com
-
#!/bin/sh if [ "$#" -eq 0 ]; then set -- /dev/stdin fi for pathname do gawk -f awk_prac.awk "$pathname" done
-
-
unix.stackexchange.com unix.stackexchange.com
-
if (( ${#} == 0 )) ; then while read -r __my_function ; do my_function "${__my_function}" done else target_utility "${@}" fi
I like it pretty well, in many ways more than G-Man's answer. I like the use of while read. I'd probably prefer non-recursive solution most of the time though, esp. if instead of a function we would be spawning a subshell (script) to achieve the recursion, like in ...
-
Also unclear why the answer is criticized for providing a "more general case" since the OP said "You are right, this [base64] was just used as an example, though.
-
(It seems reasonable to assume users are often expected to occasionally adapt answers rather than expect to use them verbatim.)
-
This answer is one of various possible solutions for a "Bash function that accepts input from parameter or pipe" since the OP indicated [in a comment] that base64 was not the actual problem domain. As such, it makes no attempt to assure input is able to be directly read from a file.
-
but in a different situation target_utility "${@}" could represent more complex code
-
Though the OP's issue may not present a problem ideally resolved through use of recursion, other reader's problems may benefit from using it, or, from considering use of an wrapper function:
-
The title of the question is what triggered the process of finding this Q/A for material that aided development of the above to solve a real life problem described by the title. The OP declared that base64 decode was not the "real" problem; pedantic constraint of answers to a particular "example" seems less helpful. When this question and its answers were key to helping solve real problems, alternate answers can be gifts to the community in recognition of the fact that many more people will use this Q/A to solve problems. Since the answer is on-topic per the title, I feel it is "game on".
-
- Jan 2024
-
gitlab.com gitlab.com
-
Another example are issue boards. They represent elegant use of a good infrastructure — it is all just a smart use of labels. It would be very complex feature without the use of labels.
-
Issue relations are meant to be the basic infrastructure to build on (at least that is how I meant it when I posted the original feature request). Just like the labels are just a binary relation between a issue and a "label", the relations should be just a ternary relation between two issues and a "label". Then you can build issue task lists on top of the relations like you've built issue boards on top of the labels.
-
We already have a very nice example of such tool and its great use: the Board, where labels are used to store metadata and the Board is built above this storage. Do the same with the relations -- simple metadata storage to build on.
-
Such a generic approach will allow the Relations to fit any reasonable workflow, because possible relations are defined by users, just like the Labels are.
-
- Apr 2022
-
stackoverflow.com stackoverflow.com
-
This would work if your transaction only wraps a single model's save operation. I need to wrap at least Node + Version + Attachment
looking for a callback that you can register to happen after current transaction is committed, not just after_commit of model -- though actually, that might fire precisely when current transaction is committed, too (except that it might only get triggered for nested transactions, not the top-most transaction), so it could maybe go there ... but I think the problem is just that it doesn't belong there, because it's not specific to the model...
I guess the OP said it best:
I am not looking for model based after commits on update/create/etc, I want to be able to dynamically define a block that will be executed only if the current (top-most) transaction passes:
-
- Jan 2022
-
-
Boilerplate is only boilerplate if it's the same everywhere, which it shouldn't be.
-
- Sep 2021
-
stackoverflow.com stackoverflow.com
-
This works in my application where there's only one shadow-dom at the time, but it's not a generic solution.
-
- Aug 2021
-
github.com github.com
-
I'd like to update my proposal to be more general, following your answer on Stack Overflow and hack mentioned at the top of #14520
-
- Jul 2021
-
unix.stackexchange.com unix.stackexchange.com
-
Any tips on how to make it exclusive (for any generic situation, not just OP's)?
-
- Mar 2021
-
bugs.ruby-lang.org bugs.ruby-lang.org
-
A one-liner alternative for hash-only cases can be implemented using Enumerable#reduce: root = {} [:a, :b, :c].reduce(root){@1[@2]||={}}[:d] = 'E' # root => {:a=>{:b=>{:c=>{:d=>"E"}}}}
-
I think the issues/problems specified in the comments are not present with a Hash-only implementation. :) I would be supportive of re-considering this feature just for use with a Hash, where I believe 80% of the real-life use cases would (and do) exist. I have encountered this need before in the wild, but not with Arrays.
-
-
askubuntu.com askubuntu.com
-
xdg-open should do the same thing - actually, it will call gnome-open, or kde-open, or whatever, depending on your desktop environment. Thus it's more portable.
-
The advantage is that you can use gnome-open for almost all file-types, URIs and directories. It's one command to learn, instead of trying to remember about obscure commands like sensible-browser
-
- Feb 2021
-
www.schneems.com www.schneems.com
-
One way to alleviate this configuration fatigue is by making configuration consistent and composable. That’s what Sprocket’s new “manifest.js” seeks to do.
-
-
sobolevn.me sobolevn.me
-
Not all cases can be covered and easily restored. And sometimes when we will reuse this function for different use-cases we will find out that it requires different restore logic.
-
But why do we return 0? Why not 1? Why not None? And while None in most cases is as bad (or even worse) than the exceptions, turns out we should heavily rely on business logic and use-cases of this function.
-
So, the sad conclusion is: all problems must be resolved individually depending on a specific usage context. There’s no silver bullet to resolve all ZeroDivisionErrors once and for all. And again, I am not even covering complex IO flows with retry policies and expotential timeouts.
-
-
-
I do think it's a common pattern that should be solved, and I am probably going to try and solve it as a Gem as opposed to simply writing code that we use in our code base
-
-
-
while ActiveForm currently fits 99% of my use cases, I do sometimes make modifications based on the product requirements
-
I will continue to use form objects and push changes into the repo when I feel they are universally relevant and valuable.
new tag?:
- code that is universally relevant/valuable
- non - _-specific logic
-
-
en.wikipedia.org en.wikipedia.org
-
As with other software patterns, MVC expresses the "core of the solution" to a problem while allowing it to be adapted for each system.
-
- Jan 2021
-
github.com github.com
-
Or just watch the value with a reactive statement instead of an event handler on the input like: $: inputValue, onInput() This is a good solution and seems to work in all cases.
-
-
github.com github.com
-
A Svelte component that monitors an element enters or leaves the viewport/parent element. Performant and efficient thanks to using Intersection Observer under the hood. Can be used in multiple projects including lazy loading images, infinite scrolling, playing/pausing the video when in the viewport, tracking user behaviour firing link pre-fetching and animations and many many more.
-
-
atomiks.github.io atomiks.github.io
-
It's a generic abstraction for the logic and styling of elements that pop out from the flow of the document and float next to a reference element, overlaid on top of the UI.
-
- Oct 2020
-
unix.stackexchange.com unix.stackexchange.com
-
An even more general version that allows using find options:
"find up" command
-
-
medium.com medium.com
-
In the many projects I have maintained so far, sooner or later I always run into the same issue: circular module dependencies. Although there are many strategies and best practices on how to avoid circular dependencies. There is very little on how to fix them in a consistent and predictable way.
-
This is how I solve circular dependency issues nowadays.
-
-
svelte.dev svelte.dev
-
As we've briefly seen already, you can listen to any event on an element with the on: directive:
-
- Sep 2020
-
github.com github.com
-
Maybe good for some cases but not a general solution for this I think.
-
- Apr 2020
-
www.techopedia.com www.techopedia.com
-
A language that features polymorphism allows developers to program in the general rather than program in the specific. $(document).ready(function() { recordAdModuleData(2964, "impressions","Dictionary Ad"); });
-
- Jan 2020
-
stackoverflow.com stackoverflow.com
-
I understand this is a relational division type problem, involving having and count. These posts describe what I want to do, but I can't figure out how to apply the examples to the particular case above:
-