Permalink
Browse files

Update coffeescript

  • Loading branch information...
mshafrir committed Jun 13, 2012
1 parent 7477e0a commit 0ebb67d728550599b0720a6060c00ab124e13ac5
Showing with 38 additions and 32 deletions.
  1. +1 −0 public/js/boot.js
  2. +8 −5 public/js/client.js
  3. +18 −16 server.js
  4. +4 −4 src/client/client.coffee
  5. +7 −7 src/server/server.coffee
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -25,13 +25,13 @@ window.initApp = (cusipTableTemplate) ->
(new Image()).src = loader_img_path
loader_img = $("<img src='#{loader_img_path}' class='loader' />")
- form = $('form')
- cusip_field = $('#cusip', form)
- form.submit (evt) ->
+ $form = $('form')
+ cusip_field = $('#cusip', $form)
+ $form.submit (evt) ->
evt.preventDefault()
cusip = cusip_field.val()
- if not _.isEmpty(cusip)
+ unless _.isEmpty(cusip)
if cache[cusip]?
showCusipData(cache[cusip])
else
View
@@ -111,7 +111,7 @@ class FidelityCusipSource extends CusipSource
handler = new htmlparser.DefaultHandler (error, dom) =>
row = select(dom, 'table[width=516] tr')[2]
check_cell = select(row, 'td[nowrap]')
- if not _.isEmpty(check_cell)
+ unless _.isEmpty(check_cell)
cells = select(row, 'td')
name = select(cells[0], 'font')[0].children[0].raw
ticker = select(cells[1], 'font a')[0].children[0].raw
@@ -149,25 +149,25 @@ class QuantumCusipSource extends CusipSource
delisted = null
delisted_epoch = null
- if not error?
+ unless error?
container = select(dom, 'table[bgcolor=#DCFDD7] td')
name_el = select(container, 'font[size=+1] center b')
- if not _.isEmpty(name_el)
+ unless _.isEmpty(name_el)
security_name = name_el[0].children[0].raw
info_el = select(container, 'font[size=-1] center b')
- if not _.isEmpty(info_el)
+ unless _.isEmpty(info_el)
info_text = info_el[0].children[0].raw
ticker = trim(info_text.split('Ticker Symbol: ')[1].split('&nbsp;')[0])
exchange = trim(info_text.split(' Exchange:')[1])
security_type_el = select(container, 'div[align=center] font b a')
- if not _.isEmpty(security_type_el)
+ unless _.isEmpty(security_type_el)
security_type = security_type_el[0].children[0].raw
delisting_date_el = select(container, 'font[color=#0d0d54] center font[color=Red] b')
- if not _.isEmpty(delisting_date_el)
+ unless _.isEmpty(delisting_date_el)
delisting_date_raw = delisting_date_el[0].children[0].raw
[month, day, year] = _.map(_.last(delisting_date_raw.split(' ')).split('/'), (s) -> parseInt(s, 10))
[month_str, day_str] = _.map([month, day], (s) -> _.last("0#{s}".split(''), 2).join(''))
@@ -251,7 +251,7 @@ app.get '/cusips/:cusip', (req, resp) ->
app.get '/cusips', (req, resp) ->
CusipLookup.find {},
- ['cusip', 'found', 'name', 'ticker', 'exchange', 'securityType', 'delisted'],
+ ['cusip', 'found', 'name', 'ticker', 'exchange', 'securityType', 'delisted'], # The fields to return
(err, docs) ->
console.log 'err', err
console.log 'docs', docs

0 comments on commit 0ebb67d

Please sign in to comment.