Sha256: c5105a42a0317be01e1a98f618eb28bdb5780ea1c94364f89cf3621a2793da0b

Contents?: true

Size: 499 Bytes

Versions: 2

Compression:

Stored size: 499 Bytes

Contents

###
Sort integers from the command line in a very ridiculous way: leveraging timeouts :P
###

system = require 'system'

if system.args.length < 2
  console.log "Usage: phantomjs sleepsort.coffee PUT YOUR INTEGERS HERE SEPARATED BY SPACES"
  phantom.exit()
else
  sortedCount = 0
  args = Array.prototype.slice.call(system.args, 1)
  for int in args
    setTimeout (do (int) ->
      ->
        console.log int
        ++sortedCount
        phantom.exit() if sortedCount is args.length),
      int

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
phantomjs.rb-0.0.2 vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/sleepsort.coffee
phantomjs.rb-0.0.1 vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/sleepsort.coffee