Skip to content

Instantly share code, notes, and snippets.

@tonylukasavage
Last active December 26, 2015 14:19
Show Gist options
  • Save tonylukasavage/7164221 to your computer and use it in GitHub Desktop.
Save tonylukasavage/7164221 to your computer and use it in GitHub Desktop.
Javascript for properly emphasizing Beastie Boys lyrics (tested in node.js 0.10.21)
var always = new RegExp('(?:' + ['style', 'johnny ryall', 'sabotage', 'brooklyn', 'root down'].join('|') + ')', 'gim');
function droppinScienceLikeGalileoDroppedTheOrange(lyrics) {
return lyrics
.replace(always, function(m, p1) {
return m.toUpperCase();
})
.replace(/\b([^\s]+?)(\r\n|\n|\r|$)/g, function(m, p1, p2) {
return p1.toUpperCase() + p2;
});
}
Well Now don't you tell me to SMILE
You stick around I'll make it worth your WHILE
Got numbers beyond what you can DIAL
Maybe it's because I'm so VERSATILE
STYLE profile I SAID
It always brings me back when I hear Ooh CHILD
From the Hudson River out to the NILE
I run the marathon til the very last MILE
If you battle me I will REVILE
People always say my STYLE is WILD
You've got gall you've got GUILE
To step to me I'm a RAPOPHILE
If you want to battle you're in DENIAL
Coming from Uranus to check my STYLE
Go ahead put my rhymes on TRIAL
Cast you off into EXILE
var lyrics = "Well Now don't you tell me to smile\n" +
"You stick around I'll make it worth your while\n" +
"Got numbers beyond what you can dial\n" +
"Maybe it's because I'm so versatile\n" +
"Style profile I said\n" +
"It always brings me back when I hear Ooh Child\n" +
"From the Hudson River out to the Nile\n" +
"I run the marathon til the very last mile\n" +
"If you battle me I will revile\n" +
"People always say my style is wild\n" +
"You've got gall you've got guile\n" +
"To step to me I'm a rapophile\n" +
"If you want to battle you're in denial\n" +
"Coming from Uranus to check my style\n" +
"Go ahead put my rhymes on trial\n" +
"Cast you off into exile\n";
console.log(droppinScienceLikeGalileoDroppedTheOrange(lyrics));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment