Skip to content

Instantly share code, notes, and snippets.

@ewandennis
ewandennis / UnityStencilledObject.shader
Created January 2, 2018 20:44
A simple surface shader for Unity which honours a specific stencil buffer value
Shader "Custom/Stencilled" {
Properties {
_StencilMask("Stencil mask", Int) = 0
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader {
Tags { "RenderType"="Opaque" }
@ewandennis
ewandennis / UnityStencilMask.shader
Created January 2, 2018 20:42
A simple stencil buffer masking shader for Unity
Shader "Custom/StencilMask" {
Properties {
_StencilMask("Stencil mask", Int) = 0
}
SubShader {
Tags {
"RenderType" = "Opaque"
"Queue" = "Geometry-100"
}
@ewandennis
ewandennis / extractRelayAttachments.js
Last active January 11, 2017 11:37
SparkPost relay webhooks sample
'use strict';
/* Receive and extract email attachments using SparkPost relay webhooks.
*
* Prerequisites:
* - An inbound domain: https://developers.sparkpost.com/api/inbound-domains.html
* - A relay webhook: https://developers.sparkpost.com/api/relay-webhooks.html
*/
/*
@ewandennis
ewandennis / extractRelayAttachments.py
Created November 17, 2016 15:54
SparkPost relay webhooks sample
"""Receive an extract email attachments using SparkPost relay webhooks.
Prerequisites:
- An inbound domain: https://developers.sparkpost.com/api/inbound-domains.html
- A relay webhook: https://developers.sparkpost.com/api/relay-webhooks.html
Dependencies:
- flask
"""
@ewandennis
ewandennis / extractRelayAttachments.php
Created November 17, 2016 14:31
SparkPost relay webhooks sample
<?php
/* Dependencies:
* - php-mime-mail-parser (https://github.com/php-mime-mail-parser/php-mime-mail-parser)
* - The mailparse extension (http://php.net/manual/en/book.mailparse.php)
*/
require 'vendor/autoload.php';
$messages = json_decode(file_get_contents('php://input'));
foreach ($messages as $msg) {
@ewandennis
ewandennis / transmissions-speed.php
Created November 15, 2016 19:14
A cURL connection reuse speed test
<?php
function setoptions($session) {
curl_setopt($session, CURLOPT_TCP_NODELAY, TRUE);
curl_setopt($session, CURLOPT_ENCODING, 'gzip');
// curl_setopt($session, CURLOPT_TCP_FASTOPEN, TRUE);
}
$trans = "{
\"options\": {
@ewandennis
ewandennis / sendSMSTransmission.js
Created November 9, 2016 12:39
Sending SMS with SparkPost Enterprise
'use strict';
var SparkPost = require('sparkpost');
let client = new SparkPost('YOUR_API_KEY', {
endpoint: 'https://yourservice.sparkpostelite.com/'
});
client.transmissions.send({
campaign_id: "SMS notifications",
@ewandennis
ewandennis / setDynamicFromReplyTo.js
Last active June 13, 2016 10:19
Split fromEmail into local part and domain substitution variables
'use strict';
/*
* Update a SparkPost template to use substitution variables
* in content.from.name, content.from.email and content.reply_to
*
* Usage: node setDynamicFromReplyTo.js <API KEY> <template ID>
*
* Note: your API KEY must have template write privileges.
*

Introduction

This integration consumes Segment events and uses them to create and maintain recipient lists within SparkPost. For example, when you send 'page' events into Segment.com, a recipient list is created for each page containing the users that visit that page.

The Recipient Lists

  • Everyone
  • Page X visited last 7 days
  • Group X members
  • Screen X visited last 7 days

Keybase proof

I hereby claim:

  • I am ewandennis on github.
  • I am ewandennis (https://keybase.io/ewandennis) on keybase.
  • I have a public key whose fingerprint is C73D 48F9 0FBA 9E3F 45C9 28E0 05F5 3946 98F1 F247

To claim this, I am signing this object: