Skip to content

Instantly share code, notes, and snippets.

@theophani
theophani / gist:1122508
Created August 3, 2011 12:22 — forked from remy/gist:804414
Simple CSS parser
function parseCSS(str) {
function trim(str) {
return (str||'').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}
var i, j, k,
split = '}',
cur_key = '',
cur_key_split,
css = str.replace(/\t*/g, '').replace(/\s{2}/, ' ').replace(/[\n|\r]/g, ' ').replace(/\/\*.*?\*\//g, '').split(split),
Q: i want to choose 4 people out of 4 couples. i want a group with at least 1 couple.
4 couples:
ab
cd
ef
gh
> > > selecting among the four couples is:
> > > (4 choose 1) = 4