miti.sh/code.md

104 lines
1.7 KiB
Markdown

## `nil`
```
this is jsut some test
this block has no label
```
## `snickerdoodle`
```snickerdoodle
This block's lable is set so something that doesn't exist.
```
## `heex`
```heex
<.header>
Listing Posts
</.header>
<.table id="posts" rows={@posts} row_click={&JS.navigate(~p"/posts/#{&1}")}>
<:col :let={post} label="id"><%= post.id %></:col>
<:action :let={post}>
<div class="sr-only">
<.link navigate={~p"/posts/#{post}"}>Show</.link>
</div>
</:action>
</.table>
```
## `elixir`
```elixir
if config_env() != :prod do
# Configure pandoc (the version is required)
config :pandoc,
version: "3.6.1",
hello: [
args: fn extra_args ->
{_, [input_file], _} = OptionParser.parse(extra_args, switches: [])
~w(--output=../priv/static/posts/#{Path.rootname(input_file)}.html)
end,
cd: Path.expand("../documents", __DIR__)
]
end
```
## `moonscript`
```moon
-- This is a comment
-- @param str A string.
class Thing
this = self
name: "unknown"
class Person extends Thing
say_name: => print "Hel#lo, I am #{@name}!"
with Person!
.name = "MoonScript"
\say_name!
export my_func
x = 2323
collection =
height: 32434
hats: {"tophat", "bball", "bowler"}
my_func = (a) -> x + a
print my_func 100
import concat, insert from table
double_args = (...) ->
[x * 2 for x in *{...}]
tuples = [{k, v} for k,v in ipairs my_table]
```
## `CoffeeScript`
```coffeescript
author = "Wittgenstein"
quote = "A picture is a fact. -- #{ author }"
sentence = "#{ 22 / 7 } is a decent approximation of π"
```
## `JavaScript`
```javascript
let a = "what is this?"
```
## `Lua`
```lua
local test = "this is a string"
```