This source file modifies the prototype of Generator Function objects to provide the following functions already available to arrays, allowing them to operate on demand on generators:
-
map -
reduce -
join -
forEach
| // THE PAYLOAD SERVER | |
| // by Ethan McTague | |
| // Apr 10, 2023 | |
| // | |
| // This is a single-file HTTP Server. It serves a single file, compressed, | |
| // as quickly as it possibly can, to every single client that connects. | |
| // The entire HTTP response is pre-buffered once at server startup. | |
| // | |
| // Free to use and modify, released as public-domain software. Enjoy! | |
| // |
| type TplRunner interface { | |
| Execute(w io.Writer, data any) error | |
| } | |
| type DebugTplRunner string | |
| func (r DebugTplRunner) Execute(w io.Writer, data any) error { | |
| t, err := template.ParseFiles(string(r)) | |
| if err != nil { | |
| return err |
| ; LHTML | |
| ; ----- | |
| ; | |
| ; Generate HTML code from a sequence of lisp s-expressions. | |
| ; This operates on stdin and prints to stdout. | |
| ; | |
| ; (For clisp.) | |
| ; | |
| ; Please for the love of all that is good do not use this in production. | |
| ; The code is barely readable! |
| function(add_shader TARGET SHADER) | |
| set(ShaderPath ${CMAKE_CURRENT_SOURCE_DIR}/${SHADER}) | |
| set(OutPath ${CMAKE_CURRENT_BINARY_DIR}/${SHADER}) | |
| add_custom_command( | |
| OUTPUT ${OutPath} | |
| COMMAND python3 ${CMAKE_SOURCE_DIR}/glslprepro.py ${ShaderPath} ${OutPath} | |
| DEPENDS ${ShaderPath} ${ARGN} ${CMAKE_SOURCE_DIR}/glslprepro.py | |
| VERBATIM) |
This source file modifies the prototype of Generator Function objects to provide the following functions already available to arrays, allowing them to operate on demand on generators:
map
reduce
join
forEach
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <time.h> | |
| int main() { | |
| srand(time(NULL)); | |
| int allTries = 1000; | |
| int switchWins = 0; |
| /** | |
| # Tuple-to-array for Swift | |
| By Ethan McTague - January 28, 2020 | |
| This source code is in the public domain. | |
| ## Example | |
| To convert a tuple of Ints into an array of ints: | |
| //META{"name":"Gruvbox Hard Dark","description":"Themes your Discord using Gruvbox colors.","author":"Ethan McTague","version":"1.0"}*// | |
| /* BetterDiscord Gruvbox Theme - By Ethan McTague | |
| Compatible with the latest version of Discord (as of Jan 23, 2020.) | |
| Copyright 2020 Ethan McTague <ethan@tague.me> | |
| Licensed under the BSD 3-clause license. | |
| // | |
| // When | |
| // | |
| // Allows for vertain validation rules to only apply under certain conditions, using only an Attribute. | |
| // e.g., if a certain string should match the regex `^.+@.+$` when another property, "WantsEmail", is equal to `true`: | |
| // | |
| // [When("WantsEmail", true, typeof(DoesRegexMatch), "^.+@.+$", Error = "Wants email, but none provided!"] | |
| // public string AProperty { get; set; } | |
| // |