From 032dc37f47a71a8e05bdef2b650651d1aaf507ed Mon Sep 17 00:00:00 2001 From: Will Faught Date: Fri, 6 Jan 2023 18:27:00 -0800 Subject: [PATCH] Add more code shortcode examples --- exampleSite/content/blog/code-shortcode.md | 158 ++++++++++++++++++++- 1 file changed, 152 insertions(+), 6 deletions(-) diff --git a/exampleSite/content/blog/code-shortcode.md b/exampleSite/content/blog/code-shortcode.md index c7d904bf..c9e0cac2 100644 --- a/exampleSite/content/blog/code-shortcode.md +++ b/exampleSite/content/blog/code-shortcode.md @@ -10,26 +10,172 @@ Code: ```go-text-template {{}} -c = 'c = %r; print(c %% c)'; print(c % c) +q = 'q = %r; print(q %% q)'; print(q % q) {{}} ``` Result: {{< paige/code >}} -c = 'c = %r; print(c %% c)'; print(c % c) +q = 'q = %r; print(q %% q)'; print(q % q) {{< /paige/code >}} --- +Code: + +```go-text-template +{{}} +q = 'q = %r; print(q %% q)'; print(q % q) +{{}} + +{{}} +q = 'q = %s%s%s; print(q %% (chr(39), q, chr(39)))'; print(q % (chr(39), q, chr(39))) +{{}} +``` + +Result: + +{{< paige/code >}} +q = 'q = %r; print(q %% q)'; print(q % q) +{{< /paige/code >}} + +{{< paige/code >}} +q = 'q = %s%s%s; print(q %% (chr(39), q, chr(39)))'; print(q % (chr(39), q, chr(39))) +{{< /paige/code >}} + +--- + +Code: + +```go-text-template +{{}} +q = 'q = %r; print(q %% q)'; print(q % q) +{{}} +``` + +Result: + +{{< paige/code caption="Python quine" >}} +q = 'q = %s%s%s; print(q %% (chr(39), q, chr(39)))'; print(q % (chr(39), q, chr(39))) +{{< /paige/code >}} + +--- + +Code: + +```go-text-template +{{}} +q = 'q = %r; print(q %% q)'; print(q % q) +{{}} + +{{}} +q = 'q = %s%s%s; print(q %% (chr(39), q, chr(39)))'; print(q % (chr(39), q, chr(39))) +{{}} +``` + +Result: + +{{< paige/code caption="Python quine" >}} +q = 'q = %r; print(q %% q)'; print(q % q) +{{< /paige/code >}} + +{{< paige/code caption="Another Python quine" >}} +q = 'q = %s%s%s; print(q %% (chr(39), q, chr(39)))'; print(q % (chr(39), q, chr(39))) +{{< /paige/code >}} + +--- + +Code: + ```go-text-template -{{}} -c = 'c = %r; print(c %% c)'; print(c % c) +{{}} + --- + - -- + --( / \ )XXXXXXXXXXXXX + --XXX( O O )XXXXXXXXXXXXXXX- + /XXX( U ) XXXXXXX\ + /XXXXX( )-- XXXXXXXXXXX\ + /XXXXX/ ( O ) XXXXXX \XXXXX\ + XXXXX/ / XXXXXX \ \XXXXX---- + XXXXXX / XXXXXX \ ---- - +--- XXX / XXXXXX \ --- + -- -- / /\ XXXXXX / ---= + - / XXXXXX '--- XXXXXX + --\/XXX\ XXXXXX /XXXXX + \XXXXXXXXX /XXXXX/ + \XXXXXX /XXXXX/ + \XXXXX-- / -- XXXX/ + --XXXXXXX--------------- XXXXX-- + \XXXXXXXXXXXXXXXXXXXXXXXX- + --XXXXXXXXXXXXXXXXXX- {{}} ``` Result: -{{< paige/code lang="python" caption="Python quine" >}} -c = 'c = %r; print(c %% c)'; print(c % c) +{{< paige/code caption="Who you gonna call?" >}} + --- + - -- + --( / \ )XXXXXXXXXXXXX + --XXX( O O )XXXXXXXXXXXXXXX- + /XXX( U ) XXXXXXX\ + /XXXXX( )-- XXXXXXXXXXX\ + /XXXXX/ ( O ) XXXXXX \XXXXX\ + XXXXX/ / XXXXXX \ \XXXXX---- + XXXXXX / XXXXXX \ ---- - +--- XXX / XXXXXX \ --- + -- -- / /\ XXXXXX / ---= + - / XXXXXX '--- XXXXXX + --\/XXX\ XXXXXX /XXXXX + \XXXXXXXXX /XXXXX/ + \XXXXXX /XXXXX/ + \XXXXX-- / -- XXXX/ + --XXXXXXX--------------- XXXXX-- + \XXXXXXXXXXXXXXXXXXXXXXXX- + --XXXXXXXXXXXXXXXXXX- +{{< /paige/code >}} + +--- + +Code: + +```go-text-template +{{}} +float Q_rsqrt( float number ) +{ + long i; + float x2, y; + const float threehalfs = 1.5F; + + x2 = number * 0.5F; + y = number; + i = * ( long * ) &y; + i = 0x5f3759df - ( i >> 1 ); + y = * ( float * ) &i; + y = y * ( threehalfs - ( x2 * y * y ) ); + + return y; +} +{{}} +``` + +Result: + +{{< paige/code lang="python" caption="Fast inverse square root" options="linenos=true,hl_lines=10" >}} +float Q_rsqrt( float number ) +{ + long i; + float x2, y; + const float threehalfs = 1.5F; + + x2 = number * 0.5F; + y = number; + i = * ( long * ) &y; + i = 0x5f3759df - ( i >> 1 ); + y = * ( float * ) &i; + y = y * ( threehalfs - ( x2 * y * y ) ); + + return y; +} {{< /paige/code >}}