package sihl
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
The Sihl web framework
Install
dune-project
Dependency
Authors
Maintainers
Sources
3.0.4.tar.gz
md5=8a2754d6e5b9eafb8ff332abdb1ceb7d
sha512=3230a1315686b0b6f90a41ceda27ab036e178184ab13d5a98f64d6d987caf4a8a5d94ed78bc8e79b0ee3b40ccbb1dbdc71ffe171f1aef1f18aba81fc720e3a1b
doc/src/sihl/core_random.ml.html
Source file core_random.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32let () = Caml.Random.self_init () let rec chars result n = if n > 0 then chars (List.cons (Char.chr (Caml.Random.int 255)) result) (n - 1) else result |> List.to_seq |> String.of_seq ;; let bytes nr = chars [] nr let base64 nr = Base64.encode_string ~alphabet:Base64.uri_safe_alphabet (bytes nr) ;; exception Exception of string let random_cmd = Core_command.make ~name:"random" ~help:"<number of bytes>" ~description: "Generates a random string with the given length in bytes. The string is \ base64 encoded. Use the generated value for SIHL_SECRET." (function | [ n ] -> (match int_of_string_opt n with | Some n -> print_endline @@ base64 n; Lwt.return @@ Some () | None -> failwith "Invalid number of bytes provided") | _ -> Lwt.return None) ;;
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>