Skip to content

Instantly share code, notes, and snippets.

@phamann
phamann / worker.js
Last active August 29, 2015 14:03
Simple ServiceWorker for Guardian hackday
console.log("Worker startup");
this.oninstall = function(event) {
console.log('Worker install');
event.waitUntil(
caches.create('static').then(function(cache) {
return cache.add(
//Templates
id first_name last_name email gender ip_address
1 Jerry Simpson jsimpson0@vimeo.com Male 65.216.136.96
@phamann
phamann / index.js
Created March 20, 2017 15:27
Delete all services within a Fastly acconut
require('dotenv').config();
const fetch = require('node-fetch');
const API = 'https://api.fastly.com';
const TOKEN = process.env.FASTLY_API_TOKEN;
const OPTIONS = {
headers: {
'Fastly-Key': TOKEN,
'Accept': 'application/json'
}

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@phamann
phamann / cae_nel_report.json
Created August 11, 2020 12:23
Compute@Edge NEL example report
{
"timestamp": 1597148043,
"client": {
"client_ip": "",
"client_user_agent": "Chrome 84.0.4147",
"client_asn": 5089,
"client_asname": "virgin media limited",
"client_city": "haringey",
"client_country_code": "GB",
"client_continent_code": "EU",
#[macro_use]
extern crate lazy_static;
use fastly::http::{Method, StatusCode};
use fastly::{
Body, Error, PendingRequest, Request, RequestBuilderExt, RequestExt, Response, ResponseExt,
};
use regex::Regex;
use std::convert::From;
import { Request, Response, Fastly } from "@fastly/as-compute";
const HTTPBIN_BACKEND = "httpbin";
function badRequest(): Response {
return new Response(String.UTF8.encode("Bad request"), {
status: 400
});
}