xw3.org:/blog/2024/02/10/code/../../../../
This is just a test with syntax highlighting and some examples made by Rouge.
Bash
#!/bin/bash
echo "Hello World!";
C
#include <stdio.h>
int main() {
// printf() displays the string inside quotation
printf("Hello, World!");
return 0;
}
JSON
{
"firstName": "John",
"lastName": "Smith",
"age": 25
}
Perl
#!/usr/bin/env perl
use warnings;
print "a: ";
my $a = "foo";
print $a;
PHP
<?php
echo "Hello World!";
?>
Python
#!/usr/bin/env python
def hello(name):
print("Hello ", name)
hello("World")
Ruby
class Greeter
def initialize(name="World")
@name = name
end
def say_hi
puts "Hi #{@name}!"
end
end
Rust
use core::*;
fn main() {
for ["Alice", "Bob", "Carol"].each |&name| {
do task::spawn {
let v = rand::Rng().shuffle([1, 2, 3]);
for v.each |&num| {
io::print(fmt!("%s says: '%d'\n", name, num))
}
}
}
}
SQL
SELECT * FROM `users` WHERE `user`.`id` = 1