I hereby claim:
- I am reckenrode on github.
- I am reckenrode (https://keybase.io/reckenrode) on keybase.
- I have a public key ASBPJ4FGo-Gwg6iUItotbZDQnC_fPv4DSwu9Uk_9CVyVzAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
enum JSON: Decodable { | |
case bool(Bool) | |
case double(Double) | |
case string(String) | |
indirect case array([JSON]) | |
indirect case dictionary([String: JSON]) | |
init(from decoder: Decoder) throws { | |
if let container = try? decoder.container(keyedBy: JSONCodingKeys.self) { | |
self = JSON(from: container) |
struct User: Codable { | |
var name: String | |
var email: String | |
var id: String | |
var metadata: [String: MetadataType] | |
enum CodingKeys: String, CodingKey { | |
case name, email, id, metadata | |
} | |
} |
let router = try container.make(Router.self) | |
let blog = try container.make(BlogController.self) | |
router.get("blog", use: Template(path: "Blog/listing") | |
.bind(blog.posts, to: "posts") | |
.bind(blog.isOldestFirst, to: "oldest-first").fn()) | |
router.get("blog", ":author", use: Template(path: "Blog/author-post").fn()) | |
router.post("blog", ":save", use: (blog.save >>> { $0.redirect(to: "/blog") })) | |
router.get("blog", String.parameter, use: Template(path: "Blog/view-post") | |
.bindObject(blog.post).fn()) |
$env:PATH = { | |
# Powershell doesn’t understand paths.d, nor does it put sbin in the path. | |
# Fix-up the paths to have the same ones as bash. | |
$pathPrefixes = "/usr/local/bin" | |
$pathSuffixes = "/usr/sbin", "/sbin", ` | |
[System.String]::Join(":", (Get-ChildItem -Path "/etc/paths.d" | Get-Content)) | |
"$([System.String]::Join(':', $pathPrefixes)):$($env:PATH):$([System.String]::Join(':', $pathSuffixes))" | |
}.Invoke() | |
function Format-Path { |
// Requires Swift 4.2. Compile with `swiftc -O abilityGen.swift`. Run with ./abilityGen <type> > <output.csv> | |
import Foundation | |
let costs = [ | |
8: 0, | |
9: 1, | |
10: 2, | |
11: 3, | |
12: 4, | |
13: 5, |
use rand::{Rng, thread_rng}; | |
use std::{ | |
collections::HashMap, | |
io::Write, | |
thread | |
}; | |
fn encounters_per_week<R: Rng>(rng: &mut R) -> u32 { | |
let mut count = 0; | |
for _ in 1..=(7*6) { |
use num::Unsigned; | |
use structopt::StructOpt; | |
#[derive(Debug)] | |
enum NumberType { | |
Unit(usize), Prime(usize), Composite(usize) | |
} | |
impl NumberType { |
[package] | |
name = "ability-scores" | |
version = "0.1.0" | |
authors = ["Randy Eckenrode <[email protected]>"] | |
edition = "2018" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
rand = "0.7" |
open System.Text | |
open System | |
open ICU4N.Text | |
let reverse (str: string) = | |
if str.Length <= 0 then | |
str | |
else | |
let span = str.AsSpan () | |
let breaks = seq { |