Congrats on all the labor you saved.
If you think folks here are uniquely unreasonable you could try lemmy.world/c/selfhosted .
Congrats on all the labor you saved.
If you think folks here are uniquely unreasonable you could try lemmy.world/c/selfhosted .
On the off chance that you truly don’t understand:
The nice thing to do would be to accept the feedback and add a short description. It’s confusing to others why you are staunchly opposed to performing that small courtesy, and instead jump to never posting here again.
Well FWIW CodeWars has plenty of Factor katas, and I try to gather related resources at https://programming.dev/c/concatenative
I’m trying to keep up with the Perl Weekly Challenges, but with Factor, and am posting some Factor solutions to Exercism’s 48in24 series.
Two books that may be helpful:
I’m more familiar with the former, and think it’s very good, but it may not give you the basic introduction to object oriented programming (classes and all that) you’re looking for; the latter should.
I’ve never had a Statamic site myself, didn’t know about it till this thread. I like site generators but don’t want to invest energy in ones that don’t handle colors very well. I don’t want to have to override colors, either as a user or developer, though I often do. For a an SSG anyway I want to be able to trust the tool to handle legibility.
I’m also terrible with HTML and CSS.
No. In addition to browsers’ prefers-dark-mode setting, there is also the fallback foreground and background color choice, used whenever a website does not specify a foreground or background color. One common case is when viewing a plain unstyled site or txt file.
A dark-mode preferring user might choose for these fallbacks a light foreground and dark background. The problem is then that some designers will carelessly specify either the foreground or background color (and not both), assuming that their choice will happen to have good contrast with every user’s browser preferences.
More low contrast examples from the Statamic docs:
In Firefox’s preferences page those settings are accessed with the “Manage Colors” button just below dark-mode selection, and look like this:
Notice that I am not overriding any colors specified by the page.
The main site isn’t made with Statamic?
Anyway the docs pages fail in certain parts, too, anyway:
FWIW Statamic (like many sites) fails my basic “is everything on the main site legible for dark-mode preferring users?” test:
I mentioned it in a reply but it deserves its own top-level answer.
All of these languages are relatively succinct, and I rely on that to reduce visual and mental clutter, because I have a pea brain.
Factor, Nim, Roc, and Zsh each offer, to differing extents, some argument-then-function ordering in the syntax, which strikes me as elegant and fun, and maybe even wise. In that order, Factor does this the most (using postfix/reverse-polish-notation and managing a data stack), and Zsh the least (piping output from one command as the input for the next command).
Roc is a functional language, and an offshoot of Elm in spirit. The lead developer and community are great. Relative to Elm, it’s more inclusive and experimental in the development process, and does not primarily or exclusively target web stuff. They aim to create an ambitiously integrated development environment, especially taking advantage of any guarantees the functional design can offer.
Here’s a sample, using the |>
operator a lot, which lets you order the first argument to a function before the function IIRC:
getData = \filepath ->
filepath
|> Path.fromStr
|> File.readUtf8
|> Task.attempt \result ->
result
|> Result.withDefault ""
|> Task.succeed
Nim is so darn flexible and concise, has great compilation targets, and employs Uniform Function Call Syntax to more implicitly enable the kind of ordering in the Roc example. And you can often leave out parentheses entirely.
Factor is a full-on postfix and concatenative language, tons of fun, and turns my brain inside out a bit. I made a community for concatenative languages here on programming.dev, and while there’s little activity so far, I’ve filled the sidebar with a bunch of great resources, including links to active chats.
EDIT: !concatenative@programming.dev
The Factor REPL (“listener”) provides excellent and speedy documentation and definitions, and a step-through debugger.
One idea that seems absurd at first is that for the most part, you don’t name data variables (though you can, and you do name function parameters). It’s all about whatever’s on the top of the stack.
In some languages it’s awkward to approximate multiple return values, but in a stack-oriented language it’s natural.
In Factor, everything is space-separated, so functions (“words”) can and do include or consist of symbols. [
is not semantically something between brackets, it’s just a function that happens to be named ][
. It pops 1 item off the top of the stack (an integer), and pushes a range from 1 to that integer on to the top of the stack. ]
Here it is in my solution to the code.golf flavor of Fizz Buzz:
USING: io kernel math.functions math.parser ranges sequences ;
100 [1..b] [
dup [ 3 divisor? ] [ 5 divisor? ] bi 2dup or [
[ drop ] 2dip
[ "Fizz" "" ? ] [ "Buzz" "" ? ] bi* append
] [ 2drop number>string ] if
print
] each
And in image form for glorious syntax highlighting:
Anything between spaced brackets is a “quotation” (lambda/anonymous function).
So:
each
at the bottom.each
consumes the range and the quotation.
For each element of the range, it pushes the element then calls the quotation.dup
pushes a copy of the stack’s top item.
Say we’re in the ninth iteration of the each
loop, we’ve got 9 9
on the stack.9 9 [...] [...]
),
then bi
applies them each in turn to the single stack item directly beneath,
leaving us with 9 t f
(true, it’s divisble by three, false, it’s not by 5).2dup
copies the top two, so: 9 t f t f
or
combines the last two booleans: 9 t f t
if
(9 t f t [...] [...] if
),
which pops that final t
and calls only the first quotation.[ drop ] 2dip
takes us from 9 t f
to t f
–
it dips under the top two, drops the temporary new top, then restores the original top two.?
is like a ternary.
That first quotation will push "Fizz"
if called with t
(true) on the stack, ""
otherwise.bi*
applies the last two items (quotations) to the two values before them,
each only taking one value.
The Fizz one applies to t
and the Buzz to f
,
taking us from t f [...] [...]
to "Fizz" ""
append
joins those strings, as it would any sequence: "Fizz"
print
the string, leaving us with an empty stack,
ready for the next iteration.EDIT: Walkthrough in image form, more granular:
The ones I can get things done with:
My current obsession:
Honorable mentions:
I meant to communicate that the Redirector addon uses the given pattern to see if the entire URL string matches, not part of it. So the malicious URL does not match.
I’m wondering if there’s a real URL for which the Redirector approach will not work.
I’m not trying to be combative, I’m trying to understand. I’d like to see the failure in action so I can appreciate and pursue the proposed solution.
But when I added the community bit to the first URL, the browser resolved it and stripped the credentials, so the resulting URL matched. But the example credentials weren’t real so it’s not a great test; if there’s an real example I can test, please share it. Though I don’t see why I’d auth to an instance just to view it from a different instance.
When I added the community bit to the second URL, it was not a match, as it shouldn’t be. The pattern must match the entire URL.
HtTpS://user:pw@lemdro.id:443 is a valid url to lemdro.id and should match but will not
Well that one:
Http://maliciouswebsite.to/?q=http://lemdro.id will match but should not
No, it does not match.
AFAICT, this solution is working properly, but if you can find a URL that breaks it, please let me know.
Can you provide an example URL that breaks this solution?
I just posted this on the post you linked, but yeah I am hardcoding a list of instances into my solution. Here’s my comment, copied:
I’m using the Firefox addon Redirector, and one of my rules there redirects community links using regex. I keep adding to the pattern as I encounter more instances. Currently it’s:
Pattern: https://(lemdro\.id|lemmy\.run|beehaw\.org|lemmy\.ml|sh\.itjust\.works|lemmy\.fmhy\.ml|lemmy\.dbzer0\.com|lemmy\.world|sopuli\.xyz|lemmy\.kde\.social|lemmygrad\.ml|mander\.xyz|lemmy\.ca|zerobytes\.monster)/c/(.*)
Redirect to: https://programming.dev/c/$2@$1
For anyone else wondering: