Skip to content

Instantly share code, notes, and snippets.

View kpalmvik's full-sized avatar

Kristofer Palmvik kpalmvik

View GitHub Profile
@miguelmota
miguelmota / external_link_arrow.txt
Last active April 30, 2024 15:17
Unicode UTF-8 external link arrow symbol (closest thing to it)
@wilsonpage
wilsonpage / swr.ts
Last active June 1, 2024 02:09
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',
@joranquinten
joranquinten / generate-sitemap.js
Created January 22, 2019 14:03
Generate sitemap XML for NextJs static sites based on exportPathMap
/*
Generates a sitemap based on the entries in exportPathMap in next.config.js file
Author: Joran Quinten
Don't forget to add the domain name as process variable PUBLIC_DOMAIN!
Trigger the file with a separate script in your package.json and add it to your build command in Netlify
(for instance, set Build command to: "npm run production && npm run postexport")
@jimmywarting
jimmywarting / readme.md
Last active June 9, 2024 22:20
Cors proxies
Exposed headers
Service SSL status Response Type Allowed methods Allowed headers
@ohanhi
ohanhi / joy-of-composition.md
Last active May 6, 2024 05:21
The Joy of Composition - Why stateless rendering is pure bliss

This is a proposal for a lightning talk at the Reactive 2015 conference.

NOTE: If you like this, star ⭐ the Gist - the amount of stars decides whether it makes the cut!

The Joy of Composition

Why stateless rendering is pure bliss

React just got stateless components, meaning that they are in essence pure functions for rendering. Pure functions make it dead simple - even fun - to refactor your views

@henrik
henrik / dokku_on_digital_ocean.md
Last active May 12, 2022 14:38
Notes from running Dokku on Digital Ocean.

My notes for Dokku on Digital Ocean.

These may be a bit outdated: Since I originally wrote them, I've reinstalled on a newer Dokku and may not have updated every section below.

Commands

Install dokku-cli (gem install dokku-cli) for a more Heroku-like CLI experience (dokku config:set FOO=bar).

# List/run commands when not on Dokku server (assuming a "henroku" ~/.ssh/config alias)

ssh henroku dokku

@voxpelli
voxpelli / SASS_Calculcate_Alpha.md
Last active September 26, 2018 21:00
Pure SASS script for calculating the needed alpha channel of a top color to result in a target color on top of a specified bottom color.

A pure SASS-script to calculate what alpha channel that is needed for a color to achieve a certain target color when rendered on top of a specified bottom color.

This can be useful when extracting colors from a flat image where you can estimate two colors that are rendered on top of another, but need help with figuring out the alpha number of the top color to achieve the target color in the image.

Imagine eg. a sligthly transparent black box on top of an image. By color picking to adjacent pixels on the corner of the box – the one outside the box as the bottom color and the one in the box as the target color – and then specifying the top color as black and putting all of thos colors into this function – then you'll get back the approximate alpha color needed to achieve the wanted result.

Update 1: Addaded a function for also calculating what color to use to achieve a specific target color when the alpha channel is known (perhaps you have calculated the alpha for an adjacent element and want to figure out w

require 'rubygems'
require 'mechanize'
FIRST_NAME = 'FIRST_NAME'
LAST_NAME = 'LAST_NAME'
PHONE = 'PHONE'
EMAIL = 'EMAIL@provider.com'
PARTY_SIZE = 2
SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' }
@ddol
ddol / gist:1445736
Created December 8, 2011 01:51
TLDs with MX records
ai. 14170 IN MX 10 mail.offshore.ai. ;; Anguilla
as. 21371 IN MX 10 cmh.relay.gdns.net. ;; American Samoa
as. 21371 IN MX 10 dca.relay.gdns.net. ;; American Samoa
bj. 86176 IN MX 20 mail6.domain-mail.com. ;; Benin
cf. 3379 IN MX 10 mail.intnet.cf. ;; Central African Republic
dj. 345488 IN MX 5 relais2.intnet.dj. ;; Djibouti