Skip to content

Instantly share code, notes, and snippets.

@wilsonpage
wilsonpage / swr.ts
Last active April 22, 2024 08:58
An implementation of stale-while-revalidate for Cloudflare Workers
export const CACHE_STALE_AT_HEADER = 'x-edge-cache-stale-at';
export const CACHE_STATUS_HEADER = 'x-edge-cache-status';
export const CACHE_CONTROL_HEADER = 'Cache-Control';
export const CLIENT_CACHE_CONTROL_HEADER = 'x-client-cache-control';
export const ORIGIN_CACHE_CONTROL_HEADER = 'x-edge-origin-cache-control';
enum CacheStatus {
HIT = 'HIT',
MISS = 'MISS',
REVALIDATING = 'REVALIDATING',
@paf31
paf31 / 24days.md
Last active August 8, 2023 05:53
24 Days of PureScript

This blog post series has moved here.

You might also be interested in the 2016 version.

@cvogt
cvogt / gist:d9049c63fc395654c4b4
Created May 17, 2014 20:04
This code implements a facility for Slick 2.0 to inject custom SQL instead of the Slick produced SQL to be used when running a query
import scala.slick.lifted.{TableQuery => _}
import scala.slick.ast._
import scala.slick.driver._
import scala.language.implicitConversions
/** Extends QueryInvoker to allow overriding used SQL statement when executing a query */
trait OverridingInvoker extends JdbcDriver{
// get the extended QueryInvoker into the .simple._ implicits
override val Implicit: Implicits = new Implicits
override val simple: Implicits with SimpleQL = new Implicits with SimpleQL
@alvin2ye
alvin2ye / proxychains.rb
Created December 14, 2011 08:48
proxychains_formula
# copy from https://github.com/lxneng/homebrew/commit/25da1bef5a9631315e078a5124c91ec785ff5efe#commitcomment-792526
# install
# curl -sL https://raw.github.com/gist/1475782/proxychains.rb > /usr/local/Library/Formula/proxychains.rb
# brew install proxychains
require 'formula'
class Proxychains < Formula
url 'http://pkgs.fedoraproject.org/repo/pkgs/proxychains/proxychains-3.1.tar.gz/4629c156001ab70aa7e98960eb513148/proxychains-3.1.tar.gz'
@zqwell
zqwell / init-loader.el
Created June 12, 2011 16:07
init-loader.el 修正版(elc優先読込み、load-path問題修正、windows/linux設定ファイル読込みPrefix追加)
;;; -*- coding: utf-8; mode: emacs-lisp; -*-
;;; init-loader.el ---
;; Author: IMAKADO <ken.imakado@gmail.com>
;; Author's blog: http://d.hatena.ne.jp/IMAKADO (japanese)
;; Prefix: init-loader-
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)