This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Convert a hex color string to RGB array | |
* @param {String} hex Hex color string | |
*/ | |
function hexToRgb(hex) { | |
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); | |
return result ? [ | |
parseInt(result[1], 16), | |
parseInt(result[2], 16), | |
parseInt(result[3], 16) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Compare color difference in RGB | |
* @param {Array} rgb1 First RGB color in array | |
* @param {Array} rgb2 Second RGB color in array | |
*/ | |
export function deltaRgb (rgb1, rgb2) { | |
const [ r1, g1, b1 ] = rgb1, | |
[ r2, g2, b2 ] = rgb2, | |
drp2 = Math.pow(r1 - r2, 2), | |
dgp2 = Math.pow(g1 - g2, 2), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {Builder, By, Key, until, remote} = require('selenium-webdriver'); | |
const sauceUsername = process.env.SAUCELABS_USER, | |
sauceApiToken = process.env.SAUCELABS_APITOKEN; | |
(async function example() { | |
let driver = await new Builder() | |
.forBrowser('firefox') | |
.build(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let touches = { | |
touchstart: Object.assign({}, { | |
x: -1, | |
y: -1 | |
}), | |
touchmove: Object.assign({}, { | |
x: -1, | |
y: -1 | |
}) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GOAL: | |
Make flow understand *.css files and map them to an exported Object or whatever type you need... also to prevent this dreaded module not found error. | |
STEPS: | |
In your project folder, create a file helpers/CSSModule.js with following content: | |
//@flow | |
export default {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch | grep '3\.2' | xargs git branch -d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.danschnau.com/multiple-versions-of-a-package-in-bower/ | |
"dependencies": { | |
"jquery-1.9.1": "jquery#1.9.1", | |
"jquery-1.8.1": "jquery#1.8.1" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://unix.stackexchange.com/questions/102647/how-to-rename-multiple-files-in-single-command-or-script-in-unix | |
for file in aro_tty-mIF-*_opt | |
do | |
mv -i "${file}" "${file/-mIF-/-mImpFRA-}" | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://unix.stackexchange.com/questions/61907/how-do-i-create-a-directory-in-all-subdirectories | |
for dir in */; do mkdir -- "$dir/tmp1"; done |