Skip to content

Testing Zone

Info

This is a dummy page with various Material MkDocs controls and features scattered throughout for testing.

Custom Admonitions

Nexus Admonition

An admonition featuring a Nexus logo. My source is in Stylesheets/extra.css as Custom 'nexus' admonition.

Heart Admonition

An admonition featuring a heart; because we want to contribute back to the open source community.
My source is in Stylesheets/extra.css as Custom 'nexus heart' admonition.

Mermaid Diagram

Flowchart (Source: Nexus Archive Library):

flowchart TD
    subgraph Block 2
        BigFile1.bin
    end

    subgraph Block 1
        BigFile0.bin
    end

    subgraph Block 0
        ModConfig.json -.-> Updates.json 
        Updates.json -.-> more["... more .json files"]        
    end

Sequence Diagram (Source: Reloaded3 Specification):

sequenceDiagram

    % Define Items
    participant Mod Loader
    participant Virtual FileSystem (VFS)
    participant CRI CPK Archive Support
    participant Persona 5 Royal Support
    participant Joker Costume

    % Define Actions
    Mod Loader->>Persona 5 Royal Support: Load Mod
    Persona 5 Royal Support->>Mod Loader: Request CRI CPK Archive Support API
    Mod Loader->>Persona 5 Royal Support: Receive CRI CPK Archive Support Instance

    Mod Loader->>Joker Costume: Load Mod
    Mod Loader-->Persona 5 Royal Support: Notification: 'Loaded Joker Costume'
    Persona 5 Royal Support->>CRI CPK Archive Support: Add Files from 'Joker Costume' to CPK Archive (via API)

State Diagram (Source: Mermaid Docs):

stateDiagram-v2
    [*] --> Still
    Still --> [*]

    Still --> Moving
    Moving --> Still
    Moving --> Crash
    Crash --> [*]

Class Diagram (Arbitrary)

classDiagram
    class Animal
    `NexusMobileâ„¢` <|-- Car

Note

At time of writing, version of Mermaid is a bit outdated here; and other diagrams might not render correctly (even on unmodified theme); thus certain diagrams have been omitted from here.

Code Block

Snippet from C# version of Sewer's Virtual FileSystem (VFS):

/// <summary>
/// Tries to get files for a specific folder, assuming the input path is already in upper case.
/// </summary>
/// <param name="folderPath">The folder to find. Already lowercase.</param>
/// <param name="value">The returned folder instance.</param>
/// <returns>True if found, else false.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool TryGetFolderUpper(ReadOnlySpan<char> folderPath, out SpanOfCharDict<TTarget> value)
{
    // Must be O(1)
    value = default!;        

    // Compare equality.
    // Note to devs: Do not invert branches, we optimise for hot paths here.
    if (folderPath.StartsWith(Prefix))
    {
        // Check for subfolder in branchless way.
        // In CLR, bool is length 1, so conversion to byte should be safe.
        // Even suppose it is not; as long as code is little endian; truncating int/4 bytes to byte still results 
        // in correct answer.
        var hasSubfolder = Prefix.Length != folderPath.Length;
        var hasSubfolderByte = Unsafe.As<bool, byte>(ref hasSubfolder);
        var nextFolder = folderPath.SliceFast(Prefix.Length + hasSubfolderByte);

        return SubfolderToFiles.TryGetValue(nextFolder, out value!);
    }

    return false;
}

Something more number heavy, Fast Inverse Square Root from Quake III Arena (unmodified).

float Q_rsqrt( float number )
{
    long i;
    float x2, y;
    const float threehalfs = 1.5F;

    x2 = number * 0.5F;
    y  = number;
    i  = * ( long * ) &y;                       // evil floating point bit level hacking
    i  = 0x5f3759df - ( i >> 1 );               // what the fuck? 
    y  = * ( float * ) &i;
    y  = y * ( threehalfs - ( x2 * y * y ) );   // 1st iteration
//  y  = y * ( threehalfs - ( x2 * y * y ) );   // 2nd iteration, this can be removed

    return y;
}

Default Admonitions

Note

Test

Abstract

Test

Info

Test

Tip

Test

Success

Test

Question

Test

Warning

Test

Failure

Test

Danger

Test

Bug

Test

Example

Test

Quote

Test

Tables

Method Description
GET Fetch resource
PUT Update resource
DELETE Delete resource