Skip to content

Instantly share code, notes, and snippets.

@capotej
Created July 25, 2012 16:19
Show Gist options
  • Save capotej/3177047 to your computer and use it in GitHub Desktop.
Save capotej/3177047 to your computer and use it in GitHub Desktop.
scrubs useless stories from prismatic based on banned sites, tags, or words; install dotjs to use http://defunkt.io/dotjs/
var banned_sites = ['Bits', 'Forbes.com', 'TechCrunch', 'PCWorld', 'AllThingsD'];
var banned_tags = ['Venture Capital', 'Social', 'Startups', 'PHP', 'Social Media'];
var banned_words = ['Node', 'PHP', 'Zend', 'Cloud'];
var scrubber = function(){
$('.article').each(function(index, object){
var hideit = false;
var publisher = $(object).find('.publisher').find('.interest').text();
var title = $(object).find('.title').find('.external').text();
//loop through interests against our banned tags
$(object).find('.meta').find('.interest').each(function(i, rawinterest){
var interest = $(rawinterest).text();
$(banned_tags).each(function(index, object){
if(object.toLowerCase() == interest.toLowerCase()){
hideit = true;
}
});
});
//loop through our sites checking if it matches the publisher
$(banned_sites).each(function(index, object){
if(object.toLowerCase() == publisher.toLowerCase()){
hideit = true;
}
});
//check title against banned_words
$(banned_words).each(function(index, object){
if(title.toLowerCase().indexOf(object.toLowerCase()) != -1){
hideit = true;
}
});
//hide the article if deemed garbage
if(hideit == true){
$(object).hide();
}
});
}
setInterval(scrubber, 2000);
@jumph4x
Copy link

jumph4x commented Jul 25, 2012

Hahahhaha. Gold.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment