Skip to content

Instantly share code, notes, and snippets.

View psapir's full-sized avatar

Pato Sapir psapir

View GitHub Profile
// Change these settings with your Webhook URL and the options for your notification body
var webhookURL = "[YOUR SLACK WEBHOOK URL]";
var slackNotificationBody = {
"text": "",
"attachments": [
{
"text": "",
"color":"#9C1A22"
}
]
<script type="text/javascript">
function yourSubmitFunction(e, $) {
e.preventDefault();
try {
var formdata = $('form').serialize();
$.ajax({
type: "POST",
url: "http://cloud.mktgmtdcanada.ca/emailNewsletterSingUp",
data: formdata
/*
This query populates an author DE by Selecting everyone who is in the MacAlertList who is also in the Subscriptions DE
*/
SELECT a.[Subscriber Key]
FROM MacAlertList a
WHERE Alerts like '%2658519%'
AND EXISTS (SELECT [Subscriber Key] FROM Subscriptions s WHERE s.[SubscriberKey] = a.[Subscriber Key] AND s.[DE Name] = 'Alan Weisman author alert - 2658519')
@psapir
psapir / Writing a REST Service with Cloud Pages - GET Method Secured
Created August 3, 2017 15:20
Writing a REST Service with Cloud Pages - GET Method Secured
if not empty (@token) then
set @rows = LookupRows("Rest api authorization","AccessToken",@token)
set @rowCount = rowcount(@rows)
if @rowCount > 0 then
If @action=="get" and not empty (@entrycode) then
set @rows = LookupRows("Register","EntryCode",@entrycode)
set @rowCount = rowcount(@rows)
If @rowCount==0 then
output(v(@JsonNotFound))
@psapir
psapir / Writing a REST Service with Cloud Pages - GetAccessToken Method
Created August 3, 2017 15:17
Writing a REST Service with Cloud Pages - GetAccessToken Method
If @action == "GetAccessToken" and not empty (@pass) and not empty (@Email)then
set @rows = LookupRows("Register","EmailAddress",@Email,"Pass",@pass)
set @rowCount = rowcount(@rows)
If @rowCount == 0 then
set @json= '{"Status":"error", "message":" the Email address or password are incorrect"}'
output(v(@json))
Endif
If @rowCount > 0 then
set @row = row(@rows,1)
@psapir
psapir / Writing a REST Service with Cloud Pages - PUT Method
Created August 3, 2017 15:14
Writing a REST Service with Cloud Pages - PUT Method
If @action=="put" and not empty (@entrycode) and not empty(@Email) and not empty(@Lname) and not empty (@Name) and not empty (@phone) then
Set @rowsAffected = UPSERTDATA("Register",1,"EmailAddress", @Email,"EntryCode",@entrycode,"FirstName",@Name,"LastName",@Lname,"PhoneNumber",@phone)
If (@rowsAffected >0) then
set @Json= '{"status": "ok","message": "Your information was saved correctly"}'
output(v(@Json))
Endif
if(@rowsAffected ==0)then
set @Json= '{"status": "Error","message": "Invalid EntryCode"}'
%%[
var @action,@entrycode,@Json,@JsonNotFound,@EmailAddress,@FristName,@LastName,@phone,@rowCount,@row,@rows
set @action=Requestparameter("action")
set @entrycode=Requestparameter("entrycode")
set @JsonNotFound=' {"status": "error","message": "Could not find record with entrycode" }'
If @action=="get" and not empty (@entrycode) then
set @rows = LookupRows("Register","EntryCode",@entrycode)
set @rowCount = rowcount(@rows)
@psapir
psapir / piezas-gratis.html
Created March 28, 2017 13:17
piezas gratis modificado
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div align="center">
<table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td colspan="4" >
<img src="http://image.S7.exacttarget.com/lib/fe9213727262047e71/m/1/piezas+gratis_pic1.JPG" border="0" alt="" style="float:left" />
</td>
</tr>
<tr>
@psapir
psapir / landing.html
Created February 16, 2017 01:32
anz landing
<!-- before started block--><div class="content-block before-started"><div class="block-title">BEFORE YOU GET STARTED</div><div class="paragraph1 clearfix"><div class="paragraph1-logo"><img src="../../images/before_logo.png" style="max-width: 100%"/></div><div class="paragraph1-content"><span>Please consider which card is suitable
for your needs and be aware that the
interest rate and annual fee for each
type can vary. You can view the&nbsp;<a href="" class="blue">Credit Card Key Facts Sheet</a>&nbsp;for more
information about each card.</span></div></div><p>If your application is approved, a new card
account will be opened. Your existing card
account will be closed 14 days after ANZ's
receipt of this application, or on activation of
your new card(s), whichever is the sooner. You
will not receive a final statement on your
<!-- Start RealTime Email Embed - Patents Pending -->
<img src="https://em.realtime.email/service/rte?kind=weather&id=1187086557&esp_uid=%%Hash_ID%%&dim0=%%Hash_ID%%"/>
<!-- End RealTime Email Embed - Patents Pending -->