Skip to content

Instantly share code, notes, and snippets.

@ghostbar
Last active December 14, 2015 09:08
Show Gist options
  • Save ghostbar/5062311 to your computer and use it in GitHub Desktop.
Save ghostbar/5062311 to your computer and use it in GitHub Desktop.
Figuring out how many colors got used on a css-file.
_ = require "lodash"
fs = require "fs"
array = fs.readFileSync("css-colors.txt").toString().split("\n")
result = _.countBy array, (data) ->
return data
console.log result
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)
#!/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