Skip to content

Instantly share code, notes, and snippets.

@wvpv
wvpv / sfmc-ampscript-regex-tests.amp
Last active February 7, 2022 10:41
SFMC AMPScript RegEx
%%[
var @s, @o, @p, @m
output(concat("<br>Strip leading zeroes from a string"))
set @s = "0000012345"
set @p = "^0*(\d+)$"
set @o = RegExMatch(@s, @p, 1)
output(concat("<br>input: ", @s))
output(concat('<br>pattern: "', @p, '"'))
output(concat("<br>output: ", @o))
@wvpv
wvpv / sfmc-custom-preference-center-boilerplate.html
Last active July 15, 2024 21:58
SFMC Custom Preference Center Boilerplate
<script runat="server" language="JavaScript">
// src: https://gist.github.com/wvpv/19777e1167d6ac91e2e8
// demo: https://pub.s7.exacttarget.com/yo3hzpktgmu?qs=7145718410d87e2af4e5001112e1de43e2e457b69041ac21&mid=7203368
Platform.Load("core", "1");
var debug = true;
var request = {};
@eliotharper
eliotharper / request.xml
Last active September 10, 2018 20:53
Update Email Address for existing Subscriber on Salesforce Marketing Cloud
<!--
Use the following cURL command to execute this request:
curl -XPOST -H "Content-type: text/xml; charset=utf-8" -H "SOAPAction: Update" -d @request.xml https://webservice.s7.exacttarget.com/Service.asmx
Replace 's7' with your SOAP endpoint as required
-->
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<fueloauth xmlns="http://exacttarget.com">insertAccessTokenHere</fueloauth>
@jakebellacera
jakebellacera / ICS.php
Last active July 9, 2025 11:20
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
@unruthless
unruthless / CSS for <sup> and <sub>
Created May 26, 2010 01:31
CSS for <sub> and <sup>
sub, sup {
/* Specified in % so that the sup/sup is the
right size relative to the surrounding text */
font-size: 75%;
/* Zero out the line-height so that it doesn't
interfere with the positioning that follows */
line-height: 0;
/* Where the magic happens: makes all browsers position