Skip to content

Instantly share code, notes, and snippets.

@gunslinger
gunslinger / sane-caching.nginx.conf
Created May 21, 2018 11:28 — forked from philipstanislaus/sane-caching.nginx.conf
Sample Nginx config with sane caching settings for modern web development
# Sample Nginx config with sane caching settings for modern web development
#
# Motivation:
# Modern web development often happens with developer tools open, e. g. the Chrome Dev Tools.
# These tools automatically deactivate all sorts of caching for you, so you always have a fresh
# and juicy version of your assets available.
# At some point, however, you want to show your work to testers, your boss or your client.
# After you implemented and deployed their feedback, they reload the testing page – and report
# the exact same issues as before! What happened? Of course, they did not have developer tools
# open, and of course, they did not empty their caches before navigating to your site.
@gunslinger
gunslinger / rgb_to_xy.js
Last active December 21, 2022 22:48
RGB to XY function
function rgb_to_xy(red, green, blue){
let redC = (red / 255)
let greenC = (green / 255)
let blueC = (blue / 255)
let redN = (redC > 0.04045) ? Math.pow((redC + 0.055) / (1.0 + 0.055), 2.4): (redC / 12.92)
let greenN = (greenC > 0.04045) ? Math.pow((greenC + 0.055) / (1.0 + 0.055), 2.4) : (greenC / 12.92)
let blueN = (blueC > 0.04045) ? Math.pow((blueC + 0.055) / (1.0 + 0.055), 2.4) : (blueC / 12.92)
let X = redN * 0.664511 + greenN * 0.154324 + blueN * 0.162028;