book1 | enwik8 | |||||
---|---|---|---|---|---|---|
size | encode time | decode time | size | encode time | decode time | |
order0 | 388'064 | 70ms | 100ms | 55'068'843 | 10.3s | 13.3s |
order0 entropy hashing | 354'005 | 470ms | 490ms | 53'672'845 | 60.9s | 63.2s |
order0 entropy hashing 8-bit cache | 354'005 | 450ms | 470ms | 53'672'845 | 58.0s | 59.5s |
order0 entropy hashing 16-bit cache | 354'005 | 250ms | 290ms | 53'672'845 | 35.5s | 41.6s |
order1 | 303'964 | 70ms | 100ms | 42'054'383 | 9.6s | 13.6s |
order1 entropy hashing | 264'464 | 1.1s | 1.1s | 35'392'005 | 138s | 144s |
order1 entropy hashing 8-bit cache | 264'464 | 1s | 1.1s | 35'392'005 | 131s | 136s |
// https://twitter.com/Lucretiel/status/1413692836755685378 | |
fn main() { | |
let fizz = ["Fizz", "", ""]; | |
let buzz = ["Buzz", "", "", "", ""]; | |
fizz.iter().cycle() | |
.zip(buzz.iter().cycle()) | |
.enumerate().skip(1).take(100) | |
.for_each(|(i, (&f, &b))| { | |
println!("{f}{b}{}", if f.is_empty() && b.is_empty() { i.to_string() } else { "".to_string() }) | |
}) |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Login</title> | |
<style> | |
html, body { margin: 0; padding: 0; } | |
body { | |
display: grid; |
CSS has a ::first-letter
and ::first-line
pseudo elements.
Unfortunately, it does not have a ::first-word
(or ::last-word
for that matter).
The main workaround posted is to use javascript but most of the reason to build my blog SSG style is to avoid javascript, plus no one likes delayed styling.
I'm using Zola, which relies on the Tera engine and the proper (static) way to do this is with shortcodes. However, turns out Zola doesn't render shortcodes in templates, only markdown pages. Thankfully, I'm not the first to stumble at this and @bluejekyll suggests using Tera Macros.
{% macro style_first_word(string) %} | |
{% set words = string | split(pat=" ") %} | |
{% set first_word = words | first %} | |
{% set remaining_words = words | slice(start=1) | join(sep=" ") %} | |
<span class="first-word"> | |
{{ first_word }} | |
</span> | |
{{ remaining_words }} | |
{% endmacro style_first_word %} |
{% macro style_first_word(string) %} | |
{% set words = string | split(pat=" ") %} | |
{% set first_word = words | first %} | |
{% set remaining_words = words | slice(start=1) | join(sep=" ") %} | |
<span class="first-word"> | |
{{ first_word }} | |
</span> | |
{{ remaining_words }} | |
{% endmacro style_first_word %} |
If you hate git submodule
, then you may want to give git subtree
a try.
When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add
command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.
When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.
Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:
public void A(Func<string> x) | |
{ | |
for (int i = 0; i < 10; i++) | |
{ | |
var data = x.Invoke(); | |
Console.WriteLine(data); | |
Console.WriteLine(i); | |
} | |
} |