This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO: escaping | |
enum Attribute { | |
Boolean(String), | |
Normal(String, String), | |
} | |
pub struct Element { | |
name: &'static str, | |
attributes: Vec<Attribute>, | |
child: Node, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Nubnub do | |
@moduledoc """ | |
Documentation for `Nubnub`. | |
""" | |
@doc """ | |
## Examples | |
iex> Nubnub.nub([1, 2, 3, 1, 2, 3]) | |
[1, 2, 3] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule End do | |
defmodule Region do | |
defstruct name: "", population: 0, south_edge: 0 | |
end | |
defp tally(lines, regions) do | |
Enum.reduce(lines, regions, fn line, regions -> | |
fields = String.split(line, "\t") | |
{latitude, _} = Enum.at(fields, 4) |> Float.parse() | |
{population, _} = Enum.at(fields, 14) |> Integer.parse() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type p5; | |
type sketch; | |
type button; | |
type state = | |
| Initializing | |
| NotStarted(button) | |
| Running(button, int) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Alpine Stopwatch</title> | |
<script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.js" defer></script> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const source = fs.readFileSync("./left_pad.wasm"); | |
const sourceArray = new Uint8Array(source); | |
WebAssembly.instantiate(sourceArray, {}).then(result => { | |
const leftPad = left_pad.bind(result.instance.exports); | |
const paddedStr = leftPad("hello zig", 20, '*'); | |
console.log(paddedStr); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const fmt = std.fmt; | |
extern fn hostcall_kvstore_upsert( | |
key_ptr: [*]const u8, | |
key_len: usize, | |
value_ptr: [*]const u8, | |
value_len: usize, | |
) bool; |