To be able to edit code and run cells, you need to run the notebook yourself. Where would you like to run the notebook?

This notebook takes about 20 seconds to run.

In the cloud (experimental)

Binder is a free, open source service that runs scientific notebooks in the cloud! It will take a while, usually 2-7 minutes to get a session.

On your computer

(Recommended if you want to store your changes.)

  1. Copy the notebook URL:
  2. Run Pluto

    (Also see: How to install Julia and Pluto)

  3. Paste URL in the Open box

Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

Author 1
👀 Reading hidden code
using HypertextLiteral
: @htl, @htl_str

23.9 ms
h (generic function with 1 method)
👀 Reading hidden code
h(x) = Text(repr(MIME"text/html"(), x))
2.9 ms
embed_pluto_notebook (generic function with 1 method)
👀 Reading hidden code
function embed_pluto_notebook(; kwargs...)
@htl """
<div class="embed-pe">
<pluto-editor
id=$("pe-$(rand(1:1000000))")
$(kwargs)
>
</pluto-editor>
</div>

<style>
.embed-pe {
height: 300px;
overflow-y: auto;
border-radius: 4px;
}
</style>
"""
end
477 ms
👀 Reading hidden code
# embed_pluto_notebook(;
# notebookfile="https://featured.plutojl.org/basic/Basic%20mathematics.jl",
# notebookfile_integrity="sha256-gQ80NOuWT2AIckkUMVh2scKYdSD8wnurFqZ/R+WpI3c=",
# statefile="https://featured.plutojl.org/basic/Basic%20mathematics.plutostate",
# disable_ui=true,
# slider_server_url="https://fonsi.armada.silentech.gr/",
# )
17.8 μs
👀 Reading hidden code
import Downloads
146 μs
import URIs
👀 Reading hidden code
12.9 ms
get (generic function with 1 method)
function get(args...; kwargs...)
local resp
s = sprint() do io
resp = Downloads.request(args...; kwargs..., output=io, throw=false)
end
s, resp
end
👀 Reading hidden code
2.0 ms
get(turtles)
👀 Reading hidden code
319 ms
import JSON
👀 Reading hidden code
60.1 ms
find_root_json (generic function with 1 method)
function find_root_json(start_url)
url = URIs.URI(start_url)
path_parts = split(url.path, "/")
for i in eachindex(path_parts)
newpath = join([path_parts[begin:i]..., "pluto_export.json"], "/")
newurl = URIs.URI(url; path=newpath)

htmlpath_relative = join(path_parts[i+1:end], "/")

data, resp = get(string(newurl))
if resp.status ∈ 200:299
data_parsed = JSON.parse(data)
nbs = data_parsed["notebooks"]

matches_html = filter(nbs) do (_jl, nbdata)
lowercase(nbdata["html_path"]) == lowercase(htmlpath_relative)
end

jlpath_relative = only(keys(matches_html))
notebook_data = only(values(matches_html))
return (
json_url=newurl,
json_data=data_parsed,
htmlpath_relative,
jlpath_relative,
notebook_data,
)
end
end
error("Not found. Are you sure that this website is generated with PlutoSliderServer or PlutoPages?")
end
👀 Reading hidden code
3.1 ms
frj = find_root_json(turtles)
👀 Reading hidden code
707 ms
{"license_url":"https://github.com/JuliaPluto/featured/blob/2a6a9664e5428b37abe4957c1dca0994f4a8b7fd/LICENSES/Unlicense","author":[{"name":"Pluto.jl","url":"https://github.com/JuliaPluto"}],"image":"https://github.com/JuliaRegistries/General/assets/6933510/9a925232-6a75-47e7-9ab9-f384bc389602","order":"5.1","title":"Turtles – showcase","date":"2024-08-10","tags":["turtle","basic"],"description":"🐢 A couple of cool artworks made with simple Julia code","license":"Unlicense"}
frj.notebook_data["frontmatter"] |> JSON.json |> Text
👀 Reading hidden code
278 ms
"https://featured.plutojl.org/basic/turtles-art.html"
turtles = "https://featured.plutojl.org/basic/turtles-art.html"
👀 Reading hidden code
10.4 μs
"https://featured.plutojl.org/basic/turtles-art.html"
start_url = turtles
👀 Reading hidden code
10.8 μs
URI("https://featured.plutojl.org/basic/turtles-art.html")
url = URIs.URI(start_url)
👀 Reading hidden code
5.7 ms
"/basic/turtles-art.html"
url.path
👀 Reading hidden code
12.3 μs
split(url.path, "/")
👀 Reading hidden code
18.2 μs
embed_pluto_notebook_from_index (generic function with 1 method)
function embed_pluto_notebook_from_index(just_an_html_path::String)
result = find_root_json(turtles)
Markdown.MD([
Markdown.Paragraph("Use this instead:")
Markdown.Code("julia", "embed_pluto_notebook_from_index(\n\t$(repr(string(result.json_url))),\n)")
])
end
👀 Reading hidden code
643 μs
embed_pluto_notebook_from_index (generic function with 2 methods)
function embed_pluto_notebook_from_index(
root_site,
)



end
👀 Reading hidden code
354 μs

Use this instead:

embed_pluto_notebook_from_index(
	"https://featured.plutojl.org/pluto_export.json",
)
embed_pluto_notebook_from_index(
"https://featured.plutojl.org/basic/Basic%20mathematics.jl"
)
👀 Reading hidden code
22.1 ms
# embed_pluto_notebook(;
# notebook_id="a9823594-1137-11f0-1703-6550d1b2018d"
# )
👀 Reading hidden code
17.5 μs

And here is a live Pluto notebook:

👀 Reading hidden code
197 μs

Here is a featured notebook!

👀 Reading hidden code
196 μs
Error message

syntax: incomplete: premature end of input

this suckz 💣
function fancyu
👀 Reading hidden code
---