Last active
December 14, 2015 09:08
-
-
Save ghostbar/5062311 to your computer and use it in GitHub Desktop.
Figuring out how many colors got used on a css-file.
This file contains 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
_ = require "lodash" | |
fs = require "fs" | |
array = fs.readFileSync("css-colors.txt").toString().split("\n") | |
result = _.countBy array, (data) -> | |
return data | |
console.log result |
This file contains 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
var array, fs, result, _; | |
_ = require("lodash"); | |
fs = require("fs"); | |
array = fs.readFileSync("css-colors.txt").toString().split("\n"); | |
result = _.countBy(array, function(data) { return data;}); | |
console.log(result) |
This file contains 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
#!/bin/sh | |
# runs grep against the file given as argument | |
grep -o '#[a-fA-F0-9]\{6\}' $1 > ./css-colors.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment