Skip to content

Instantly share code, notes, and snippets.

View nickmalcolm's full-sized avatar

Nick Malcolm nickmalcolm

View GitHub Profile
# Use Warden's on_request hook to track each page view
# (every GET request that isn't for an asset)
Warden::Manager.on_request do |proxy|
if proxy.request.get? && !proxy.request.original_fullpath.start_with?("/assets")
payload = {
ip: proxy.request.remote_ip,
user_agent: proxy.request.user_agent,
verb: 'page-view',
object: {
url: proxy.request.original_url
@nickmalcolm
nickmalcolm / AWSLambdaSimpleVoice.js
Last active October 8, 2023 06:18 — forked from stevebowman/AWSLambdaSimpleSMS.js
AWS Lambda Function to make Voice calls via the Twilio API
// 2016 MIT licence. Nick Malcolm.
// Based on https://gist.github.com/stevebowman/7cff9dd80b227c899728
// Makes a call using Twilio's API.
// Expects the following Lambda environment variables:
// TWILIO_ACCOUNT_SID - your account ID
// TWILIO_AUTH_TOKEN - an auth token generated in the Twilio console e.g. ABCD1234
// TWILIO_FROM_NUMBER - the number you've purchased to make calls from e.g. +14243700000
// We'll call this number
@nickmalcolm
nickmalcolm / SecuritySubscriber-updated.php
Last active February 27, 2017 11:31
Code example from "Subscribing to Symfony's Security Events" https://thisdata.com/blog/subscribing-to-symfonys-security-events/
namespace AppBundle\EventSubscriber;
use AppBundle\Entity\User;
...
use ThisData\Api\ThisData;
use ThisData\Api\Endpoint\EventsEndpoint;
class SecuritySubscriber implements EventSubscriberInterface
{