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
| use strict; | |
| use warnings; | |
| use HTTP::Server::PSGI; | |
| use Plack::Request; | |
| use Plack::Response; | |
| my $app = sub { | |
| my $env = shift; | |
| my $req = Plack::Request->new($env); |
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
| use strict; | |
| use warnings FATAL => 'all'; | |
| # The Request object ($req) | |
| # - method(): Returns GET, POST, etc. | |
| # | |
| # - path(): The path itself (e.g., /user/profile). | |
| # | |
| # - query($key): Extracts values from the query string after the ?. | |
| # |
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
| #!/usr/bin/env -S cargo +nightly -Zscript -q | |
| ---cargo | |
| [package] | |
| edition = "2024" | |
| [dependencies] | |
| rand = "0.9.2" | |
| clap = { version = "4", features = ["derive"] } | |
| --- |
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
| (function() { | |
| const e = document.createElement("style"); | |
| e.textContent = `.spahn-widget{background-color:#7c86ff;color:#fff;font-family:-apple-system,BlinkMacSystemFont,'SegoeUI',Roboto,Oxygen,Ubuntu,sans-serif;max-width:600px;padding:2rem;margin:1rem | |
| auto;text-align:center;border-radius:8px}.spahn-widget h1{font-size:4rem}.spahn-widget .answer{font-size:3rem;font-weight:bold;margin-bottom:1rem}.spahn-widget .description{font-size:1.5rem;line-height:1.4}`; | |
| document.head.appendChild(e); | |
| const t = document.createElement("div"); | |
| t.className = "spahn-widget", t.innerHTML = `<h1>Ist Spahn noch im Amt?</h1><div class="answer" id="spahn-answer">Lade...</div><div class="description" id="spahn-description"></div>`, document.body.appendChild(t), fetch("https://istspahnnochimamt.de/api/v1/inOffice").then(e => e.json()).then(e => { | |
| document.getElementById("spahn-answer").textContent = e.isSpahnStillInOffice ? "Leider ja" : "Endlich Nein 🥳", document.getElementById("spahn-description").innerHTM |
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
| 10 MODE 1:INK 0,0:INK 1,19:PAPER 0: PEN 1:CLS | |
| 20 w=40: h=25: l=5 | |
| 30 dx=1: dy=0 | |
| 35 PEN 2 | |
| 40 FOR xw=1 TO w | |
| 50 LOCATE xw,1: PRINT "#" | |
| 60 LOCATE xw,h: PRINT "#"; | |
| 70 NEXT | |
| 80 FOR yh=1 TO h | |
| 90 LOCATE 1,yh: PRINT "#"; |
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
| Object>>chain | |
| ^ ChainProxy new setTarget: self | |
| ChainProxy>>doesNotUnderstand: aMessage | |
| target := aMessage sendTo: target. | |
| ^ target | |
| ChainProxy>>setTarget: anObject | |
| target := anObject. | |
| ^ self |
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
| #[allow(dead_code)] | |
| fn f1(a: i32) -> i32 { | |
| a | |
| } | |
| #[allow(dead_code)] | |
| fn f2(a: i32, b: i32) -> i32 { | |
| a+b | |
| } | |
| #[allow(dead_code)] |
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
| macro_rules! avg { | |
| ($($t:expr),*) => (sum!($($t),*)/count!($($t),*)); | |
| } | |
| macro_rules! count { | |
| ($h:expr) => (1); | |
| ($h:expr, $($t:expr),*) => | |
| (1 + count!($($t),*)); | |
| } |
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
| import writer | |
| import string_writer | |
| pub fn main() { | |
| string_writer.create() | |
| |> writer.write("Text1") | |
| |> writer.write("Text2") | |
| |> string_writer.print() | |
| } |
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 MyApp do | |
| use Application | |
| def start(_type, _args) do | |
| import Supervisor.Spec, warn: false | |
| children = [ | |
| Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [ | |
| dispatch: dispatch | |
| ]) |
NewerOlder