952 points · by Symmetry · 6y ago · 179 comments
Here is my favorite, Capsized by Zak Kain for Stanford's Code Poetry Slam:
.ocean {
color: cornflowerblue;
pitch: high;
overflow: visible;
}
.boat {
color: firebrick;
transform: rotate(94deg);
float: none;
}
.rescue-team {
visibility: visible;
}
.crew {
widows: none;
}
https://web.archive.org/web/20170522035639/http://stanford.e...This guy is amazing: https://aem1k.com/
for(b=i=[X=3772];i--;)b[i]=68*i%9%2;setInterval('for(a=b,b=[h="<pre>"],i=0;i++<X;i%w||(h+="\\n")){for(d=j=0;e=[1,91,w,93][j++];)d+=a[i+e]+a[i-e];h+=".#"[b[i]=3==d|a[i]&2==d]}document.body.innerHTML=h',w=92)> A quine is a computer program which takes no input and produces a copy of its own source code as its only output.
So a parthenogenic Scotswoman would be a double quine.
I do think that, in specific technical contexts, a useful distinction (though still fuzzy on the margins) can be made between programming languages and markup languages.
I also did not say HTML is not a programming language.
It's not turing complete. There are limits to the types of computation that can be performed with it.
It's not silly -- it's a meaningful distinction.
HTML with either CSS3 or JavaScript is definitely a program, though.
<?xml-stylesheet type="text/css" href="style.css"?>
Bonus points if you mix that with XSLT.An argument determined if you wanted the page as XML, html or RSS. If you opted for XML, and your browser supported XSL, the XSL would be applied client-side. We still applied the XSL server-side by default to avoid having to deal with compatibility issues for the XSL, but it worked perfectly in most browsers and was great for testing.
XSLT was/is a massive pain, though.
And you can even mix-and-match it with SPAs, and Vue.js with it's "hydration" system. That's an very power trick to slash data consumption, and improve cache hits for a "portal" style website. One showstopper: gazillion XSLT/XML bugs in Chrome left unfixed for 10+ years.
Another particularly interesting application is that you can turn XML data into SVG visualisation solely with XSLT, or you can add some JS with interactivity cod into XSL to run on the client side as a finishing step.
Is it, though? I would think its only real win over a template system based on a scripting language is when the template author is untrusted. And that niche is now much better covered by Liquid: https://shopify.github.io/liquid/
Since DSSSL (precursor of XSLT) is based on Scheme, I've always wondered if some HNers will pick-up OpenJade as its reference implementation.
This was a missed opportunity to link back to the very same page.
It literally explains the meaning of each bit of markup.
Discussed here: https://news.ycombinator.com/item?id=21035313
Kidding, of course, America has a famously low-touch approach to financial crimes.
[1] https://www.nytimes.com/2020/10/01/technology/bitmex-bitcoin...
like, just because operating a crypto exchange that doesn't follow KYC laws is convenient and nice doesn't mean that we should get rid of all the laws. It would be convenient and nice if regular banking didn't have to follow KYC too, then you could pay for murder hitmen to take out your business partner with your regular bank account instead of needing crypto at all!
It is truly surprising that:
* { display:block; }
actually displays the whole contents of <head>. It makes no sense, but neither does most of HTML, so why not?Why so? <head> is a conventional place for tags with document metadata semantics to live, but <head> has no semantic meaning itself. (I think the only thing one could say about how UAs treat <head> is that some scraping robots might only parse <head>, discarding <body> entirely.)
And read my words above again: tags with document metadata semantics. Not “metadata tags.” All tags are just containers for DOM nodes or text, whatever additional implications they carry for the document. HTML is "a markup language for text first, and a container format for web pages second."
IMHO, <title> especially should be styled for display more often. It works great as an effective “<h0>“ tag, rather than duplicating <title>'s text into an explicit <h1> somewhere in the <body>. That way, the document only embeds its own title in one canonical location—a title which both gets rendered on the page, and displayed in the title bar. (And if you’re worried about positioning, there’s nothing saying you can’t put your <title> in your <body>. Yes, it will do the right thing.)
Tangent: in fact, there's really no reason to have <head> and <body> in your document at all. You can just declare <html> and start spitting tags. IMHO, despite going against a long-standing trend, it's a much more practical arrangement—especially if you keep all your "outside the content" formatting to CSS, and apply that CSS using a response header (https://www.w3.org/TR/html401/present/styles.html#h-14.6). If done correctly, your "full document" HTML can look exactly like your XHR-response "patch" HTML, such that your API endpoints can themselves render as full documents when viewed separately—without changing what they return! (I really need to blog about this.)
Well, the specification says you can't.
>You can just declare <html> and start spitting tags.
Strictly speaking, <html> is not required too. This is compliant HTML:
<!DOCTYPE html> <title>something</title> hello
But that's just notation thing, implicit element will be automatically opened/closed, all rules still apply. Thus <!DOCTYPE html> hello <title>something</title>
is not valid, because 'hello' implicitly opens <body>, and <title> is not allowed to be there. Of course all of these would probably work in practice, because there's no junk that browser wouldn't happily accept. Discussed quine also violates standard, because it misses doctype and places <style> tags in body. title
body ...
vs default title content
same in h1 content. body...
Search engines claims that's error and may (I'm not sure) penalize. Have to use <meta description> to fix search results (its absence claimed as error too).Yeah, it enables some whacky stuff. There's something funny about <style style="..."> actually working...
For lolz I hacked up the following piece of code where an "article" is rendered entirely from <head> (probably not the cleanest implementation, but it works, and passes the nu validator with flying colors too):
<!DOCTYPE html>
<html>
<head>
<title>.</title>
<style>
head {
display: block;
max-width: 600px;
margin: 0.5em auto;
}
style.show {
display: block;
/* Create new stacking context. */
position: relative;
z-index: 0;
white-space: pre-wrap;
margin-bottom: -1em;
background-color: #fff;
}
style.show::first-line {
font-size: 0;
}
</style>
<style class="show" style="font-weight: bold">/*
An article rendered entirely from <head>
*/</style>
<style class="show">/*
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ut viverra purus. Ut enim ligula, luctus nec mi sed, molestie mattis purus. Praesent quis mauris orci. Nunc blandit eget ligula sollicitudin pretium. Duis at est porttitor, feugiat est ac, volutpat magna. Nulla varius nunc ut blandit porttitor. Vestibulum tempus eros quis massa efficitur, quis condimentum nunc condimentum.
*/</style>
<style class="show">/*
Duis porttitor lobortis nulla pretium aliquet. Nulla in dignissim magna, eget tincidunt odio. Interdum et malesuada fames ac ante ipsum primis in faucibus. Sed quis vestibulum ligula. Vestibulum nec nibh quis neque venenatis sodales vel et purus. Duis purus lorem, facilisis vitae dictum in, mattis eget est. Suspendisse porta ornare elit, vel dictum felis. Cras mattis erat nec sapien scelerisque faucibus. Donec quis odio porta, pretium nunc at, laoreet massa.
*/</style>
<style class="show">/*
Nullam bibendum ornare malesuada. Phasellus eget sollicitudin lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nulla eget diam sed erat interdum lobortis. Curabitur sed posuere magna. Donec ornare pulvinar gravida. Sed ante ipsum, laoreet vitae rhoncus in, vulputate a est. Maecenas a ligula eu leo fringilla commodo ac cursus ante.
*/</style>
<style class="show" style="padding: 1em 0"></style>
</head>
</html>
Here's a fiddle: https://jsfiddle.net/zfs2rabc/http://web.archive.org/web/20201019103343/https://secretgeek...
Here’s a HTML reference https://www.w3.org/TR/CSS2/selector.html#pseudo-elements
(honest question) As someone who used pseudo before/after in my own code, I'd be interested in their potential downsides or issues.
<style type="text/css">
.code-line::before {content: '>>> ';}
</style>
<div class="code-line">print 12</div>
<div class="code-line">a = [i**2 for i in range(10)]</div>
Then the reader can copy the actual code without the interpreter's prompt.There needs to be a CSS property that makes the visible text selectable and copyable.
The idea that beautiful forms can come from purely functional design without needing to cover things up with baroque decoration is really a central theme. As is making these huge structures with small, modular elements designed at human scale to get something that's truly people-focused. All of this stems from a utopian idea that scaling production can provide functional, beautifully designed buildings for use by all people, rather than just the privileged few. While the style is polarizing, I'd say it often accomplished its goals. In my experience, well-designed brutalist buildings are easy to navigate, have large open spaces, have lots of little nooks and crannies to foster human interaction, and have really beautiful forms.
While the page has nice enough lines and makes good use of color, the html tags have quite the opposite effect that a brutalist-era designer would hope to bestow upon the user. In this way, I'd say that this website is a far better example of brutalism than that website.
It's why so many modern buildings[1] are white or brown.
Also, brutalism is beautiful[2]. Even in its stark outside, it fosters an equal-and-opposite beauty within, like if Nine Inch Nails was buildings.
0: https://en.wikipedia.org/wiki/Truth_to_materials
1: https://en.wikipedia.org/wiki/Modern_architecture#Internatio...
2: https://images.jacobinmag.com/wp-content/uploads/2018/10/151...
> The idea that beautiful forms can come from purely functional design without needing to cover things up with baroque decoration is really a central theme.
Huh? These two are contradictory statements. I recommend giving this a read, Architecture is where brutalism first sprung up: https://www.nytimes.com/2016/10/06/t-magazine/design/brutali...
They are not remotely contradictory. Something being beautiful because the architect or a stylist added beautiful decorations is entirely different from something being beautiful because the lines, forms, and overall composition of the functional form, by itself, is beautiful. Much of the material on a brick victorian is purely for decoration. A small cinder block box, unless it was purpose-built to store boxes, was not built carefully to consider how it interacts with its occupants.
I'm not sure if you just skimmed most of my comment, but it was pretty clearly discussing architecture.
The bare minimum I believe is <HTML></HTML> ...which on its own wouldn't be a HTML quine.
<!DOCTYPE html>
<title>x</title>This thread has a surprising amount of not knowing the difference between HTML and HTTP. The original post is entirely about HTML and does not involve HTTP transmission at all.
HTML <meta> tags are a thing, to invoke browser behavior typically associated with HTTP headers. I'm not sure if that can get you there; I would guess that to visually output the meta tag would require the same * { display:block } shenanigan that the original post is about.
Live: https://gistpreview.github.io/?0b8b18ca9dbd5a648d9fa21d7f146...
Source: https://gist.github.com/MarkTiedemann/0b8b18ca9dbd5a648d9fa2...
I implemented a copy/paste feature using dummy elements that are only visible when being selected, so that when someone wants to copy text from my website, it will be copied as markdown notation (which was the originating article format before being statically rendered into the HTML code).
Technically, this would work with HTML+CSS only, but I decided to go with JS generating these nodes automatically to keep my sanity alive - because there were some quirks along the way with getting paragraphs to be copied correctly across the major Web Browsers. [2] and [3]
And, it feels absolutely comfortable to be inside.
I value the experience of being inside the building, more than how it looks from the outside. As such, I find it hard to understand when people associate brutalism with ugliness.
First search result, by way of example: https://www.independent.co.uk/news/what-it-s-live-inside-bar...
It's a script you execute using curl | bash but it uses bash comments to contain HTML and CSS to prettyprint itself in the browser.
As far as I know he invented this technique.
E.g. ctrl-f "max-width": zero results in Chrome (but it's used in the final <style> tag).
[1]: https://addons.mozilla.org/en-US/firefox/addon/fire-source-v...
Show HN from last year: https://news.ycombinator.com/item?id=20094866
(Kind of a statement on how horrible web tech has gotten, but that's a philosophical, not technical, discussion. Technically this is awesome!)
As was Haskell Curry: https://en.wikipedia.org/wiki/Haskell_Curry