Skip to content

Instantly share code, notes, and snippets.

@m5r
m5r / color-conversion-algorithms.js
Created October 21, 2017 23:50 — forked from mjackson/color-conversion-algorithms.js
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@m5r
m5r / README.md
Created April 9, 2017 17:55 — forked from Dr-Nikson/README.md
Auth example (react + redux + react-router)
#!/usr/bin/env bash
set -e # Exit on errors
# A configurable, strict IPTables firewall
# Save this to /usr/local/bin and modify to your needs
# Config - edit this!
ETH_INTERFACE="eth0"
ALLOW_PORTS="22 80 443"
@m5r
m5r / keybase.md
Last active August 3, 2018 23:21

Keybase proof

I hereby claim:

  • I am m5r on github.
  • I am mokhtar (https://keybase.io/mokhtar) on keybase.
  • I have a public key whose fingerprint is BED9 087A 5805 6E8B 0B7D 4F94 FE60 7C32 6598 010A

To claim this, I am signing this object:

@m5r
m5r / xhr.js
Created October 28, 2016 20:29
ES6 XHR from Mackan from Devcord Discord
function loadData(url){
return new Promise((resolve, reject) => {
let xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState === XMLHttpRequest.DONE){
if(xmlhttp.status === 200){
resolve(xmlhttp.responseText);
}else{
reject(xmlhttp.status);
}