Pen Settings

↑ Insert the most common viewport meta tag

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource
via CSS Lint

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource
via JS Hint

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Want a Run Button?

If active, the preview will update automatically when you change code.


  h1 Automatically Directed Drama with Async2.js
  h2 A.K.A. Soap Opera/Reality TV Series Episode Generator



              @import compass

  background: #ccc
  color: #333
  padding: 1em
  font: normal 16px/1.3em Monaco, monospace
  font-weight: bold
  font-size: 1.5em
  text-decoration: underline
  margin: .5em 0
  font-size: 1.2em
  margin: .5em 0 1em 0
  color: #999
  font-weight: bold
  color: #333
  font-weight: normal
  font-weight: bold
  color: #000
  font-style: italic
  color: #000
  text-decoration: underline


              # lights and stage props
start=new Date; log=(s)->
  jQuery('<p>').text("[#{(new Date-start)/1000}s] ").append('<span>').find('span').html(s.replace('<','&lt;').replace('>','&gt;').replace(rx1,'<strong>$1</strong>').replace(rx2,'<i>$1</i>')).end().appendTo('body')
# dramatic helpers
push=(room, action)->
  log "<*Boss* heads toward the #{room} room to see who is in there.>"
  async.push room, action
  log "*Boss*: \"*#{name}*, #{request}\""
  [reply, action, subject] = reply_to_subject request, script
  log "<*#{name}* invoked.> *#{name}*: \"#{reply} BRB +#{ms}ms.\""
  async.delay ms, ->
    log "<*#{name}* appears.> *#{name}*: \"back with your #{subject}. need me to #{action} any more?\""
    next() if next
  log "<*#{name}* turns to exit.>"
Wade=asynchronous_blocking_process 'Wade', 8000, "Ok. Hmm. Well I guess I'll put everything on hold and go $1 your $2 now."
Mark=asynchronous_blocking_process 'Mark', 10000, "Well, ok. You want me to $1 $2? Sure."
Jim=asynchronous_blocking_process 'Jim', 5000, "Oh, I almost forgot to $1 the $2."

jQuery ->
  log '<curtains go up.>'
  log '<async2.js is on stage.>'

  push 'Accounting', -> Wade "If you're not busy can you please _prepare_ me an updated *P&L report*?", @
  push 'Marketing',  -> Jim "How are we doing on sales? Did you _mail_ those *flyers* yet?", @
  push 'Accounting', -> Wade "I know you're just dicking around. How about you _call_ up *Papa John's* and order us some pizza for lunch?", @
  push 'Accounting', -> Wade "And don't forget to _order_ *the sauce* this time.", @
  push 'Marketing', ->
    Jim "I want you to _follow-up on_ some *reports from Dr. Smith*. Find out if he's cheating us.";
    Jim "While you're doing that, also _call_ *Dr. Johnson*. Tell him he owes us for last week.";
  push 'Legal', -> Mark "A former employee's site is ranking higher on Google than our own. Can't we _threaten_ *legal action*?", @
Loading ..................