Skip to content

Instantly share code, notes, and snippets.

@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
@jakebellacera
jakebellacera / ICS.php
Last active October 11, 2024 10:58
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.
*
@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>
@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 = {};
@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-ampscript-preference-center-test.html
Created December 15, 2015 17:13
SFMC AMPScript preference center test email
<html>
<body style="font-family:sans-serif">
<a href="%%profile_center_url%%">Base - Profile/Preference Center</a>
<br/><a href="%%subscription_center_url%%">Base - Subscription Center</a>
<br/><a href="%%unsub_center_url%%">Base - One-Click Unsubscribe</a>
<br/><a href='%%=MicrositeURL(1111,"subscriberMID", "4444")=%%'>Custom Profile/Preference Center</a>
<br/><a href='%%=MicrositeURL(2222,"subscriberMID", "4444")=%%'>Custom Subscription Center</a>
<br/><a href='%%=MicrositeURL(3333,"subscriberMID", "4444")=%%'>One-Click Unsubscribe</a>
<p>This email was sent by:
<b>%%Member_Busname%%</b>
@wvpv
wvpv / sfmc-sql-enterprise-attributes.sql
Last active June 15, 2019 19:00
SFMC SQL select profile attributes values from the EnterpriseAtrributes data view
select
a.customerID
, s.emailAddress
from EnterpriseAttributes a
inner join _Subscribers s on (s.subscriberID = a.subscriberID)
@wvpv
wvpv / SFMC-SSJS-delete-rows-from-DE.js
Created March 21, 2016 14:44
SFMC SSJS Delete Rows from a Data Extension
<script runat="server">
Platform.Load("core", "1.1.1");
function pruneRows () {
var DERowKeys = DataExtension.Init("DEofRowKeys");
var DERowKeyRows = DERowKeys.Rows.Lookup(["ProcessedFlag"], [0], 50, "RowDate");
var returnString = "";
@wvpv
wvpv / sfmc-lowest-of-three-numbers.html
Created November 11, 2016 14:41
Find the lowest of 3 numbers in AMPScript
%%[
var @num1, @num2, @num3, @lowestNum
/* force strings to be numbers */
set @num1 = add('105.54',0)
set @num2 = add('88.73',0)
set @num3 = add('106.32',0)
/* find lowest with method outlined here: http://stackoverflow.com/a/9424226/812377 */
set @lowestNum = iif(@num1 < iif(@num2 < @num3, @num2, @num3), @num1, iif(@num2 < @num3, @num2, @num3))
@wvpv
wvpv / sfmc-number-suffixes.html
Last active September 19, 2018 21:48
Number Suffixes in AMPScript
%%[
var @day, @suffix
for @day = 1 to 31 do
/* set @day = Format(Now(),"dd") */
/* adapted from http://stackoverflow.com/a/13627586/812377 */
if mod(@day,10) == 1 and mod(@day,100) != 11 then