Skip to content

Instantly share code, notes, and snippets.

View ntotten's full-sized avatar

Nathan Totten ntotten

View GitHub Profile
import { ZuploContext, ZuploRequest, environment } from "@zuplo/runtime";
type MyPolicyOptionsType = {
bucketName: string;
accountName: string;
};
export default async function policy(
request: ZuploRequest,
context: ZuploContext,
{
"name": "my-request-validation-inbound-policy",
"policyType": "request-validation-inbound",
"handler": {
"export": "RequestValidationInboundPolicy",
"module": "$import(@zuplo/runtime)",
"options": {
"includeRequestInLogs": false,
"logLevel": "info",
"validateBody": "reject-and-log"
import { ZuploContext, ZuploRequest } from "@zuplo/runtime";
export default async function (
request: ZuploRequest,
context: ZuploContext,
options: any,
policyName: string
) {
const url = new URL(request.url);
import { ZuploContext, ZuploRequest, environment } from "@zuplo/runtime";
// {
// "event": "some string",
// "payload": {
// "auth": {
// "email": "email"
// },
// "customFields": {},
// This was generated with ChatGTP as an expiriment. If you find this, don't trust that the
// code works. I didn't test this or anything. See: https://twitter.com/ntotten/status/1657012479942066177
class HubspotSDK {
private apiKey: string;
private baseUrl: string = 'https://api.hubapi.com';
constructor(apiKey: string) {
this.apiKey = apiKey;
}
import { ZuploContext, ZuploRequest, HttpProblems } from "@zuplo/runtime";
export default async function (
request: ZuploRequest,
context: ZuploContext
) {
if (request.user.data.isExpired === true) {
return HttpProblems.forbidden(request, context, {
detail: "This account is expired."
})
import { ZuploContext, ZuploRequest, ZoneCache, environment } from "@zuplo/runtime";
// Get environment variables
// AZURE_AD_TENENT_ID: The tenant ID of your Azure AD (UUID)
// AZURE_AD_CLIENT_ID: The client ID of the "zuplo" Azure AD application (UUID)
// AZURE_AD_CLIENT_SECRET: The secret for the "zuplo" Azure AD application
// API_HOST: The url of your Azure App service i.e. https://zup-demo1.azurewebsites.net/
const { AZURE_AD_TENENT_ID, AZURE_AD_CLIENT_ID, AZURE_AD_CLIENT_SECRET, API_HOST } = environment;
const TOKEN_CACHE_KEY = "ad-token"
import { ZuploRequest, ZuploContext, ResponseFactory, environment } from "@zuplo/runtime";
import { SegmentClient } from "./segment";
export async function postLogin(
request: ZuploRequest,
context: ZuploContext
): Promise<Response> {
if (!environment.SEGMENT_WRITE_KEY) {
throw new Error("SEGMENT_WRITE_KEY environment variable not set")
}
<aura:component implements="flexipage:availableForAllPageTypes" access="global">
<lightning:card title="Walk Score" iconName="custom:custom5">
<div style="padding: 0; margin: 0; border: 0; outline: 0; position: relative; width: 100%; padding-bottom: 30%">
<div style="padding: 0; margin: 0; border: 0; outline: 0; position: absolute; top: 0; bottom: 0; left: 0; right: 0;">
<img src="//pp.walk.sc/badge/walk/1099-Stewart-St-Seattle-98101.svg"
style="border-radius: 0; box-shadow: none; outline: 0; color: transparent; margin: 0 0 0 2.000000%; float: left; padding: 0; width: 30.666667%; background: none; border: 0;"
alt="Walk Score of 1099 Stewart Street Seattle WA 98101" />
<img src="//pp.walk.sc/badge/transit/1099-Stewart-St-Seattle-98101.svg"
style="border-radius: 0; box-shadow: none; outline: 0; color: transparent; margin: 0 0 0 2.000000%; float: left; padding: 0; width: 30.666667%; background: none; border: 0;"
alt="Transit Score of 1099 Stewar