Skip to content

Instantly share code, notes, and snippets.

View cnunciato's full-sized avatar

Christian Nunciato cnunciato

View GitHub Profile
@cnunciato
cnunciato / index.ts
Last active June 21, 2022 20:33
TypeScript Class encapsulating a StaticWebsite
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
/**
* The StaticWebsite class provisions a cloud storage bucket
* and a content-delivery network for it, exposing the name of
* the storage bucket and the CDN URL for later use.
*/
export class StaticWebsite {
private bucket: aws.s3.Bucket;
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";
const cluster = new aws.ecs.Cluster("default-cluster");
const lb = new awsx.lb.ApplicationLoadBalancer("nginx-lb", {});
const service = new awsx.ecs.FargateService("my-service", {
cluster: cluster.arn,
desiredCount: 2,
@cnunciato
cnunciato / index.js
Created February 28, 2021 16:51
Get the outputs from a Pulumi stack with a Node.js program
const automation = require("@pulumi/pulumi/x/automation");
async function getStackOutputs(stackName, projectName) {
const stack = await automation.LocalWorkspace.selectStack({
stackName,
projectName,
program: () => {},
});
return await stack.outputs();
}
@cnunciato
cnunciato / mapbox-style-provider.ts
Created November 1, 2020 22:26
A Pulumi dynamic provider for Mapbox styles.
import * as pulumi from "@pulumi/pulumi";
const mbxClient = require('@mapbox/mapbox-sdk');
const mbxStyles = require('@mapbox/mapbox-sdk/services/styles');
const mbxTilesets = require('@mapbox/mapbox-sdk/services/tilesets');
const config = new pulumi.Config();
let accessToken = config.requireSecret("access_token");
export interface MapboxStyleResourceInputs {
var kids = ["Oliver", "Sam", "Rosemary"];
var rooms = ["Living room", "Dining room", "Library"];
rooms.sort(() => Math.random() > 0.5 ? 1 : -1).map((o, i) => ({ [kids[i]]: o }));
@cnunciato
cnunciato / gif.sh
Created April 22, 2020 00:22
gif.sh
gif() {
if [ ! "$(ffmpeg -version)" ]; then
echo "It looks like ffmpeg isn't installed. Try installing with Homebrew (e.g., brew install ffmpeg)."
return $?
fi
if [ -z $1 ]; then
echo "Usage: "
echo " gif /path/to/source.mov [width in pixels (640 default)] [frames per second (12 default)]"
return 0
@cnunciato
cnunciato / index.html
Created July 9, 2019 21:17
Pulumi Design: Colors
<div class="p-8 leading-relaxed bg-white flex items-start">
<div class="w-1/4">
<h1 class="text-xl text-gray-800 font-bold">Brand Base Colors</h1>
<ul class="flex flex-col">
<li class="bg-blue-500 text-blue-100 shadow-md whitespace-pre text-xs leading-relaxed text-xs h-32 w-32 p-2 mr-4 my-2"></li>
<li class="bg-orange-500 text-orange-100 shadow-md whitespace-pre text-xs leading-relaxed text-xs h-32 w-32 p-2 mr-4 my-2"></li>
<li class="bg-green-500 text-green-100 shadow-md whitespace-pre text-xs leading-relaxed text-xs h-32 w-32 p-2 mr-4 my-2"></li>
<li class="bg-purple-500 text-purple-100 shadow-md whitespace-pre text-xs leading-relaxed text-xs h-32 w-32 p-2 mr-4 my-2"></li>
</ul>
</div>

Keybase proof

I hereby claim:

  • I am cnunciato on github.
  • I am cnunciato (https://keybase.io/cnunciato) on keybase.
  • I have a public key ASAVjjStuW42xE4lk5AtB5vNA-Xjq_jT-O4GlI_KNjmoIQo

To claim this, I am signing this object:

@cnunciato
cnunciato / index.html
Last active October 6, 2018 16:36
Take a day off!
<h1>Take a Day Off!</h1>
<p>
Behold, a random selection of workdays for you to take off over the next year.
</p>
<p>
Now go do something fun with them!
</p>
<ol class="days"></ol>

Notifications APIs

Based on current designs, we need new APIs that support retrieving lists of notifications, filtered by the requesting user, that allow for:

  • Listing all recent (e.g., most recent 50) notifications, grouped by origin.
  • Listing all notifications within an origin, with optional paging.
  • Deleting all notifications, irrespective of origin.
  • Deleting all notifications within an origin.
  • Deleting a single notification.