### Minimal REPLy Example Source: https://github.com/crystal-lang/crystal/blob/master/lib/reply/README.md This is a basic example demonstrating how to initialize and use the REPLy reader in a loop. It prints the evaluated expression back to the console. ```crystal require "reply" reader = Reply::Reader.new reader.read_loop do |expression| # Eval expression here puts " => #{expression}" end ``` -------------------------------- ### Markdown List Example Source: https://github.com/crystal-lang/crystal/blob/master/lib/markd/spec/fixtures/spec.txt An example of equivalent list formatting in Markdown syntax. Demonstrates readability and structure. ```markdown 1. List item one. List item one continued with a second paragraph followed by an Indented block. $ ls *.sh $ mv *.sh ~\/tmp List item continued with a third paragraph. 2. List item two continued with an open block. This paragraph is part of the preceding list item. 1. This list is nested and does not require explicit item continuation. This paragraph is part of the preceding list item. 2. List item b. This paragraph belongs to item two of the outer list. ``` -------------------------------- ### Install Boehm GC from Source Source: https://github.com/crystal-lang/crystal/wiki/All-required-libraries Installs the Boehm Garbage Collector from its Git repository. Ensure you have build tools like autoconf, automake, and a C++ compiler. This method is useful if your distribution's package is outdated. ```shell git clone https://github.com/ivmai/bdwgc.git cd bdwgc ./autogen.sh ./configure --enable-static --disable-shared --enable-large-config make -j CFLAGS=-DNO_GETCONTEXT make check sudo make install ``` -------------------------------- ### AsciiDoc List Example Source: https://github.com/crystal-lang/crystal/blob/master/lib/markd/spec/fixtures/spec.txt An example of list formatting in AsciiDoc syntax. This is provided for comparison with Markdown. ```asciidoc 1. List item one. + List item one continued with a second paragraph followed by an Indented block. + ................. $ ls *.sh $ mv *.sh ~\/tmp ................. + List item continued with a third paragraph. 2. List item two continued with an open block. + -- This paragraph is part of the preceding list item. a. This list is nested and does not require explicit item continuation. + This paragraph is part of the preceding list item. b. List item b. This paragraph belongs to item two of the outer list. -- ``` -------------------------------- ### Install C++ Build Tools for Visual Studio 2019 Source: https://github.com/crystal-lang/crystal/wiki/Porting-to-Windows-(old) Installs the necessary C++ build tools and ATL component for LLVM. Keep the terminal open until the process completes. ```powershell .\vs_buildtools.exe --passive --norestart --wait --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.ATL --includeRecommended ``` -------------------------------- ### Valid ordered list start number (9 digits) Source: https://github.com/crystal-lang/crystal/blob/master/lib/markd/spec/fixtures/spec.txt Ordered list start numbers must be nine digits or less. This example shows a valid start number. ```markdown 123456789. ok ``` -------------------------------- ### Install Debian/Ubuntu Build Dependencies Source: https://github.com/crystal-lang/crystal/wiki/All-required-libraries Installs necessary packages for building Crystal on Debian-based systems like Ubuntu. Includes build tools, development libraries for GMP, event, SSL, PCRE2, and XML/YAML. ```shell sudo apt-get install -y \ automake \ build-essential \ git \ libbsd-dev \ libevent-dev \ libgmp-dev \ libgmpxx4ldbl \ libpcre2-dev \ libssl-dev \ libtool \ libxml2-dev \ libyaml-dev \ lld \ llvm \ llvm-dev \ libz-dev ``` -------------------------------- ### Install Git Pre-commit Hook Source: https://github.com/crystal-lang/crystal/blob/master/CONTRIBUTING.md Install the pre-commit hook to ensure code is formatted correctly before each commit. This hook runs `crystal tool format`. ```sh ln -s scripts/git/pre-commit .git/hooks ``` -------------------------------- ### Build Example Program on Windows Source: https://github.com/crystal-lang/crystal/wiki/Porting-to-Windows-(old) Builds a Crystal program ('hello.cr') on Windows using a locally compiled Crystal executable. Sets necessary environment variables. ```cmd set CRYSTAL_PATH=src set LIB=%LIB%;C:\crystal set TERM=dumb crystal.exe build hello.cr ``` -------------------------------- ### Running an HTTP Server with Crystal Source: https://github.com/crystal-lang/crystal/blob/master/src/compiler/crystal/tools/playground/views/_about.html Demonstrates how to create and run a basic HTTP server using the `http/server` library. This example shows how to handle requests and send responses. ```crystal require "http/server" server = HTTP::Server.new do |context| context.request.path context.response.headers["Content-Type"] = "text/plain" context.response.print("Hello world!") end server.bind_tcp "0.0.0.0", 5678 puts "Listening on http://0.0.0.0:5678" server.listen ``` -------------------------------- ### Install Fedora Build Dependencies Source: https://github.com/crystal-lang/crystal/wiki/All-required-libraries Installs required packages for building Crystal on Fedora. Includes C/C++ compilers, development libraries for GMP, event, SSL, PCRE2, and XML/YAML, along with LLVM and make. ```shell sudo dnf -y install \ gcc \ gcc-c++ \ gmp-devel \ libbsd-devel \ libevent-devel \ libxml2-devel \ libyaml-devel \ llvm-devel \ llvm-static \ libstdc++-static \ make \ openssl-devel \ pcre2-devel \ redhat-rpm-config ``` -------------------------------- ### HTML Block Example with Nested Pre Source: https://github.com/crystal-lang/crystal/blob/master/lib/markd/spec/fixtures/spec.txt Demonstrates how an HTML block, started by '
**Hello**, _world_. |
**Hello**,world.
one
two