Skip to content

Instantly share code, notes, and snippets.

@ali
Forked from anonymous/wut.coffee
Created December 18, 2012 03:25

Revisions

  1. ali revised this gist Dec 18, 2012. 1 changed file with 6 additions and 7 deletions.
    13 changes: 6 additions & 7 deletions wut.coffee
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,7 @@
    # Learning some Node/Express/Coffeescript :>
    ###

    express = require 'express'
    app = express()
    http = require 'http'

    nouns = [
    'ali', 'pranav', 'wylie', 'spencer',
    @@ -19,12 +18,12 @@ random = (array) ->
    index = Math.floor(Math.random()*array.length)
    array[index]

    app.get '/', (req, res) ->
    http.createServer((req, res) ->
    noun = random nouns
    adjective = random adjectives
    sentence = noun + ' is ' + adjective
    res.send sentence
    res.writeHead 200, {'Content-Type': 'text/plain'}
    res.end sentence
    ).listen 3000

    console.log 'You should hit up 0.0.0.0:3000'

    app.listen 3000
    console.log 'You should hit up 0.0.0.0:3000'
  2. @invalid-email-address Anonymous created this gist Dec 18, 2012.
    30 changes: 30 additions & 0 deletions wut.coffee
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    ###
    # Learning some Node/Express/Coffeescript :>
    ###

    express = require 'express'
    app = express()

    nouns = [
    'ali', 'pranav', 'wylie', 'spencer',
    'dnb', 'cba', 'thang', 'DDS', 'leebot'
    ]

    adjectives = [
    'smelly', 'awesome', 'in need of a rewrite',
    'lazy', 'inefficient', 'radiant'
    ]

    random = (array) ->
    index = Math.floor(Math.random()*array.length)
    array[index]

    app.get '/', (req, res) ->
    noun = random nouns
    adjective = random adjectives
    sentence = noun + ' is ' + adjective
    res.send sentence

    console.log 'You should hit up 0.0.0.0:3000'

    app.listen 3000