Code Snippets

Ampscript, SSJS (server-side JavaScript) & SQL code for you to use


  • Ampscript Slot Machine as a Picture Subject Generator

    Ampscript Slot Machine as a Picture Subject Generator

    I was a spectator at a battle of illustrators yesterday. They fought in turns, in which the topic to draw was seemingly randomized and produced such combinations: The drawings for the third prompt, for example, were of an elder frog wizard supporting himself with a cane (the fifth leg) using magic to stop time, and…


  • Better Formatting of Ampscript and SSJS Error Messages on CloudPages

    Better Formatting of Ampscript and SSJS Error Messages on CloudPages

    When building various solutions on CloudPages like consent management centers, surveys or tools used be internal teams, you might run into errors during the development phase. Here’s a code snippet for you if you don’t like feeling like trying to find a needle in the haystack of code that could land in the output of…


  • Basic Scripts to Work with HTTP Request Properties in SSJS

    Basic Scripts to Work with HTTP Request Properties in SSJS

    I developed a script to make working with HTTP requests on CloudPages and in Code Resources easier. Of course feel free to edit and remove any properties as as necessary – you might not need each of the listed properties in every script. Example Response This would be returned after hitting a code resource with…