This is an example post for irresponsible.dev. A place for programming notes, small experiments, and things I’d otherwise forget.
The site is deliberately small: Markdown files go in, static HTML comes out. Fonts, styles, and any scripts are bundled with the site rather than loaded from third-party services.
One greeting, eight languages
Each example below comes from a source file bundled with this post. A line range selects the function, and the file link opens the complete source.
Elixir
def hello(name, site) do
"Hello, #{name}. Welcome to #{site}!"
endGo
func Greet(name string) string {
return "Hello, " + name + "!"
}Python
def greet(name: str) -> str:
return f"Hello, {name}!"TypeScript
export function greet(name: string): string {
return `Hello, ${name}!`;
}PHP
function greet(string $name): string {
return "Hello, " . $name . "!";
}Rust
pub fn greet(name: &str) -> String {
format!("Hello, {name}!")
}Bash
greet() {
printf 'Hello, %s!\n' "$1"
}Odin
greet :: proc(name: string) -> string {
return fmt.aprintf("Hello, %s!", name)
}Plain fences still work
For a short example that doesn’t need a separate file, a language-tagged fence is enough:
["write something", "keep it small", "publish"]
|> Enum.each(&IO.puts/1)