Instantly share code, notes, and snippets.

View zip_xyz_axis_calc.sql
select
zip
, cos(radians(latitude)) * cos(radians(longitude)) xaxis
, cos(radians(latitude)) * sin(radians(longitude)) yaxis
, sin(radians(latitude)) zaxis
from zip_axis
/* credit https://stackoverflow.com/a/2233208/812377 */
View sfmc-ampscript-one-click-unsubscribe.html
%%[
var @debug
var @jid
var @listid
var @batchid
var @email
var @skey
var @reason
var @unsubscribeAll
View CNX18-ECAS-template.html
<div data-type="slot" data-key="init"></div>
<html>
<head>
<style>
body, a, input {font-family:sans-serif;}
</style>
<div data-type="slot" data-key="head"></div>
</head>
<body>
<div data-type="slot" data-key="body"></div>
View CNX18-ECAS-subscriberReferrals.amp
%%[
var @sk, @rows, @row, @rowCount, @i
set @sk = AttributeValue("_subscriberkey")
set @rows = LookupRows("SubscriberReferrals", "SubscriberKey", @sk)
set @rowCount = rowcount(@rows)
if @rowCount > 0 then
]%%
View CNX18-ECAS-init.amp
%%[
var @debug, @sk, @rows, @row, @rowCount
set @debug = 1
set @sk = AttributeValue("_subscriberkey")
set @rows = LookupRows("LoyaltyDemographics", "SubscriberKey", @sk)
set @rowCount = rowcount(@rows)
View CNX18-RASA-contact-delete.js
<script type="javascript" runat="server">
Platform.Load("core","1.1.5");
var DE = "Contacts_To_Delete";
var logDE = "Contacts_To_Delete_Log";
var log = DataExtension.Init(logDE);
var url = 'https://auth.exacttargetapis.com/v1/requestToken';
var contentType = 'application/json';
View CNX18-RASA-contact-delete-rest-api-postman.txt
POST /contacts/v1/contacts/actions/delete?type=listReference HTTP/1.1
Host: www.exacttargetapis.com
Content-Type: application/json
Authorization: Bearer ACCESS_TOKEN_GOES_HERE
Cache-Control: no-cache
{
"deleteOperationType": "ContactAndAttributes",
"targetList": {
"listType": {
View CNX18-ECAS-banner.amp
%%[
var @imageKey, @imageKeyFallBack, @imageTag
set @imageKey = concat("limedash-header-", Format(Now(1),"MM","Date"))
set @imageKeyFallBack = "limedash-header-default"
set @imageTag = Image(@imageKey, @imageKeyFallBack)
]%%
<a href="https://limedash.com">%%=v(@imageTag)=%%</a>
View sfmc-ampscript-send-logging-data-source-name.html
%%[
var @dataSourceName
set @dataSourceName = AttributeValue("_datasourcename")
]%%
<br>@dataSourceName: %%=v(@dataSourceName)=%%
View sfmc-sql-counts-from-multiple-tables-in-one-query.sql
select
de1.count1
, de2.count2
from (
select count(*) as count1
from DataExtension1
) as de1
cross join (
select count(*) as count2
from DataExtension2