Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a79f109
Showing
9 changed files
with
1,418 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
New Age Bullshit Generator | ||
========================== | ||
|
||
Does what it says on the box :) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<!DOCTYPE html> | ||
|
||
<html lang="en"> | ||
|
||
<head> | ||
|
||
<link rel="shortcut icon" href="favicon.ico" /> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<link rel="stylesheet" href="reset.css" /> | ||
<link rel="stylesheet" href="style.css" /> | ||
|
||
<title>New-Age Bullshit Generator</title> | ||
|
||
<meta name="twitter:card" content="summary"> | ||
<meta name="twitter:site" content="@_sebu_"> | ||
<meta name="twitter:creator" content="@_sebu_"> | ||
<meta name="twitter:title" content="New Age Bullshit Generator"> | ||
<meta name="twitter:description" content="We are in the midst of a cosmic flowering of synchronicity that will remove the barriers to the dreamscape itself."> | ||
<meta name="twitter:image:src" content=""> | ||
<meta name="twitter:domain" content="sebpearce.com"> | ||
|
||
<!-- social media stuff --> | ||
<link rel="image_src" href=""> | ||
<meta property="og:title" content="New Age Bullshit Generator"> | ||
<meta property="og:image" content=""> | ||
<meta property="og:url" content="http://sebpearce.com/bullshit/"> | ||
<meta property="og:site_name" content="sebpearce.com"> | ||
<meta property="og:type" content="website"> | ||
<meta property="og:description" content="We are in the midst of a cosmic flowering of synchronicity that will remove the barriers to the dreamscape itself."> | ||
<meta property="fb:admins" content="673372761" /> | ||
<meta property="fb:app_id" content="1484271161787269" /> | ||
|
||
</head> | ||
|
||
<body> | ||
<!-- FB like button --> | ||
<div id="fb-root"></div> | ||
<script>(function(d, s, id) { | ||
var js, fjs = d.getElementsByTagName(s)[0]; | ||
if (d.getElementById(id)) return; | ||
js = d.createElement(s); js.id = id; | ||
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=611704965575973"; | ||
fjs.parentNode.insertBefore(js, fjs); | ||
}(document, 'script', 'facebook-jssdk'));</script> | ||
|
||
<!-- Twitter button --> | ||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> | ||
|
||
|
||
|
||
<div class="links"> | ||
<div style="float:left"> | ||
<div class="fb-like" data-href="http://sebpearce.com/bullshit/" data-width="100" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div> | ||
</div> | ||
<div style="float:left"> | ||
<a href="https://twitter.com/share" class="twitter-share-button" data-lang="en" data-count="button" data-url="http://sebpearce.com/bullshit/" data-text="@_sebu_ New Age Bullshit Generator" data-hashtags="">Tweet</a> | ||
</div> | ||
</div> | ||
<div style="clear: both;"></div> | ||
|
||
<div class="topbar"> | ||
<button>Reionize electrons</button> | ||
</div> | ||
|
||
<div class="master"> | ||
|
||
<h1>New Age Bullshit Generator</h1> | ||
|
||
<h2>Namaste. Do you want to sell a New Age product and/or service? Tired of coming up with meaningless copy for your starry-eyed customers? Want to join the ranks of bestselling self-help authors? We can help.</h2> | ||
|
||
<h3>Just click and the truth will manifest</h3> | ||
|
||
<p>Click the <em>Reionize electrons</em> button at the top of the page to generate a full page of New Age poppycock.</p> | ||
|
||
<img src="http://placeimg.com/640/480/nature" /> | ||
|
||
<p>The inspiration for this project came from watching philosophy debates (such as <a href="http://youtu.be/0E99BdOfxAE">this</a> and <a href="http://youtu.be/f4c_CrQzUGw?t=14m5s">this</a>) in which Deepak Chopra was a participant.</p> | ||
|
||
<p>After sitting through hours of New Age rhetoric, I decided to have a crack at writing code to generate it automatically and speed things up a bit. I cobbled together a list of New Age buzzwords and cliché sentence patterns and this is the result.</p> | ||
|
||
<blockquote> | ||
You’ll get some profound-sounding nonsense here, too. | ||
</blockquote> | ||
|
||
<p>So, what is this for? Put it on your website as placeholder text. Print it out as a speech for your yoga class and see if anyone can guess a computer wrote it. Use it to write the hottest new bestseller in the self-help section, or give false hope to depressed friends and family members.</p> | ||
|
||
<p>(If you haven’t seen it, check out <a href="http://www.wisdomofchopra.com/">wisdomofchopra.com</a> — unfortunately they beat me to it! I came across that page a few days after I’d finished the vocabulary list for this one. Must be synchronicity at work.)</p> | ||
|
||
<div style="clear: both;"></div> | ||
</div> | ||
| ||
|
||
<div class="comments"> | ||
|
||
<div id="disqus_thread"></div> | ||
<script type="text/javascript"> | ||
/* * * CONFIGURATION VARIABLES * * */ | ||
var disqus_shortname = 'sebpearce'; | ||
var disqus_identifier = 'new_age_bs'; | ||
|
||
/* * * DON'T EDIT BELOW THIS LINE * * */ | ||
(function() { | ||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; | ||
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; | ||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); | ||
})(); | ||
</script> | ||
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> | ||
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a> | ||
|
||
</div> | ||
|
||
|
||
|
||
<script src="http://code.jquery.com/jquery-latest.min.js"></script> | ||
<script src="vocab.js"></script> | ||
<script src="patterns.js"></script> | ||
<script src="main.js"></script> | ||
|
||
</body> | ||
|
||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,261 @@ | ||
|
||
// http://james.padolsey.com/javascript/deep-copying-of-objects-and-arrays/ | ||
function deepCopy(obj) { | ||
if (Object.prototype.toString.call(obj) === '[object Array]') { | ||
var out = [], i = 0, len = obj.length; | ||
for ( ; i < len; i++ ) { | ||
out[i] = arguments.callee(obj[i]); | ||
} | ||
return out; | ||
} | ||
if (typeof obj === 'object') { | ||
var out = {}, i; | ||
for ( i in obj ) { | ||
out[i] = arguments.callee(obj[i]); | ||
} | ||
return out; | ||
} | ||
return obj; | ||
} | ||
|
||
function removeSentence(topic, element) { | ||
|
||
if (element > -1) { | ||
sentencePatternsClone[topic].splice(element, 1); | ||
} | ||
|
||
} | ||
|
||
function capitalizeFirstLetter(string) { | ||
return string.charAt(0).toUpperCase() + string.slice(1); | ||
} | ||
|
||
function randomInt(max) { | ||
return Math.floor(Math.random()*(max+1)); | ||
} | ||
|
||
|
||
function retrieveRandomWordOfType(type) { | ||
|
||
// find how long the array of words is for given type | ||
var max = type.length - 1; | ||
|
||
// get a random number to represent a word in the array | ||
var rand = randomInt(max); | ||
|
||
var result = type[rand]; | ||
|
||
// type.splice(rand,1); | ||
// console.log(type); | ||
|
||
return result; | ||
|
||
} | ||
|
||
function generateSentence(topic) { | ||
|
||
var length = sentencePatternsClone[topic].length; | ||
|
||
// generate random sentence pattern | ||
var patternNumber = randomInt(length - 1); | ||
|
||
// console.log('sentencePatternsClone[' + topic + '].length = ' + (patternNumber+1)); | ||
|
||
var pattern = sentencePatternsClone[topic][patternNumber]; | ||
|
||
|
||
if (typeof pattern == 'undefined') { | ||
console.log('ran out.'); | ||
return ":( "; | ||
} | ||
|
||
var pattern = pattern.replace(/([\.,;\?])/g,' $1'); | ||
var pattern = pattern.split(' '); | ||
|
||
// remove the pattern from the sentence array so it isn't re-used | ||
removeSentence(topic, patternNumber); | ||
|
||
// console.log('sentencePatternsClone.length is now ' + sentencePatternsClone.length); | ||
if (sentencePatternsClone[topic].length == 0) { | ||
sentencePatternsClone.splice(topic, 1); | ||
// console.log('topic removed!'); | ||
// console.log('sentencePatternsClone.length is now ' + sentencePatternsClone.length); | ||
} | ||
|
||
var result = ""; | ||
|
||
for (var x in pattern) { | ||
|
||
/* | ||
nCosmos | ||
nPerson | ||
nPersonPlural | ||
nMass | ||
nMassBad | ||
nPath | ||
nOf | ||
ing | ||
adj | ||
adjBig | ||
adjWith | ||
adjPrefix | ||
vtMass | ||
vtPerson | ||
vtDestroy | ||
viPerson | ||
nTheXOf | ||
ppPerson | ||
ppThingPrep | ||
fixedAdvP | ||
fixedNP | ||
*/ | ||
|
||
|
||
switch (pattern[x]) { | ||
case 'nCosmos': result += retrieveRandomWordOfType(nCosmos); | ||
break; | ||
case 'nPerson': result += retrieveRandomWordOfType(nPerson); | ||
break; | ||
case 'nPersonPlural': result += retrieveRandomWordOfType(nPersonPlural); | ||
break; | ||
case 'nMass': result += retrieveRandomWordOfType(nMass); | ||
break; | ||
case 'nMassBad': result += retrieveRandomWordOfType(nMassBad); | ||
break; | ||
case 'nPath': result += retrieveRandomWordOfType(nPath); | ||
break; | ||
case 'nOurPlural': result += retrieveRandomWordOfType(nOurPlural); | ||
break; | ||
case 'nOf': result += retrieveRandomWordOfType(nOf); | ||
break; | ||
case 'ing': result += retrieveRandomWordOfType(ing); | ||
break; | ||
case 'adj': result += retrieveRandomWordOfType(adj); | ||
break; | ||
case 'adjBig': result += retrieveRandomWordOfType(adjBig); | ||
break; | ||
case 'adjWith': result += retrieveRandomWordOfType(adjWith); | ||
break; | ||
case 'adjPrefix': result += retrieveRandomWordOfType(adjPrefix); | ||
break; | ||
case 'vtMass': result += retrieveRandomWordOfType(vtMass); | ||
break; | ||
case 'vtPerson': result += retrieveRandomWordOfType(vtPerson); | ||
break; | ||
case 'vtDestroy': result += retrieveRandomWordOfType(vtDestroy); | ||
break; | ||
case 'viPerson': result += retrieveRandomWordOfType(viPerson); | ||
break; | ||
case 'nTheXOf': result += retrieveRandomWordOfType(nTheXOf); | ||
break; | ||
case 'ppPerson': result += retrieveRandomWordOfType(ppPerson); | ||
break; | ||
case 'ppThingPrep': result += retrieveRandomWordOfType(ppThingPrep); | ||
break; | ||
case 'fixedAdvP': result += retrieveRandomWordOfType(fixedAdvP); | ||
break; | ||
case 'fixedAdvPPlace': result += retrieveRandomWordOfType(fixedAdvPPlace); | ||
break; | ||
case 'fixedNP': result += retrieveRandomWordOfType(fixedNP); | ||
break; | ||
case 'nSubject': result += retrieveRandomWordOfType(nSubject); | ||
break; | ||
case 'vOpenUp': result += retrieveRandomWordOfType(vOpenUp); | ||
break; | ||
case 'vTraverse': result += retrieveRandomWordOfType(vTraverse); | ||
break; | ||
default: result += pattern[x]; | ||
} | ||
|
||
result += ' '; | ||
// console.log(result); | ||
} | ||
|
||
result = result.trim(); | ||
result = capitalizeFirstLetter(result); | ||
|
||
if (result.charAt(result.length-1) != '?') { | ||
result += '. '; | ||
} else { | ||
result += ' '; | ||
} | ||
|
||
// remove spaces before commas/periods/semicolons | ||
result = result.replace(/ ([,\.;\?])/g,'$1'); | ||
|
||
return result; | ||
} | ||
|
||
function generateText(numberOfSentences, sentenceTopic) { | ||
|
||
var fullText = ""; | ||
|
||
for (var i = 0; i < numberOfSentences; i++) { | ||
|
||
fullText += generateSentence(sentenceTopic); | ||
|
||
// in case the topic got deleted | ||
if (typeof sentencePatternsClone[sentenceTopic] == 'undefined') { | ||
sentenceTopic = randomInt(sentencePatternsClone.length - 1); | ||
// console.log('topic reset to ' + sentenceTopic); | ||
} | ||
|
||
} | ||
|
||
// replace 'a [vowel]' with 'an [vowel]' | ||
// I added a \W before the [Aa] because one time I got | ||
// "Dogman is the antithesis of knowledge" :) | ||
fullText = fullText.replace(/(^|\W)([Aa]) ([aeiou])/g,'$1$2n $3'); | ||
|
||
// take care of prefixes (delete the space after the hyphen) | ||
fullText = fullText.replace(/- /g,'-'); | ||
|
||
return fullText; | ||
|
||
} | ||
|
||
$('.topbar button').click(function(){ | ||
|
||
sentencePatternsClone = deepCopy(sentencePatterns); | ||
|
||
// generate random topic | ||
var sentenceTopic = 0; | ||
|
||
$('h1').text(generateText(1, sentenceTopic)); | ||
|
||
$('h2').text(generateText(2, sentenceTopic)); | ||
|
||
sentenceTopic = randomInt(sentencePatternsClone.length - 2); | ||
|
||
$('h3').text(generateText(1, sentenceTopic)); | ||
|
||
|
||
$('p').each(function( i ) { | ||
sentenceTopic = randomInt(sentencePatternsClone.length - 1); | ||
$(this).text(generateText(3, sentenceTopic)); | ||
}); | ||
|
||
sentenceTopic = randomInt(sentencePatternsClone.length - 1); | ||
|
||
$('blockquote').text(generateText(1, sentenceTopic)); | ||
|
||
// change image | ||
$('img').hide(); | ||
$('img').attr('src', 'http://placeimg.com/640/480/nature'); | ||
$('img').fadeIn(400); | ||
|
||
|
||
}); | ||
|
||
|
||
$(document).ready(function() { | ||
|
||
|
||
|
||
}); | ||
|
||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.