Skip to content

Instantly share code, notes, and snippets.

@devandy
Created August 27, 2012 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devandy/3487738 to your computer and use it in GitHub Desktop.
Save devandy/3487738 to your computer and use it in GitHub Desktop.
production code
exports.Archive = class Archive
constructor: (@set = 'm12') ->
@items = []
load: (cb) ->
http.get {host: 'magiccards.info', path: "/query?q=e%3A#{@set}&v=list&s=cname"}, (res) =>
rawDataset = ''
res.on 'data', (chunk) =>
rawDataset += chunk.toString()
res.on 'end', =>
@parse(rawDataset)
cb()
top: (amount) ->
_.first(@items, amount)
readAll: ->
@items
#private
parse: (rawDataset) ->
@console.log 'parsing'
@items = $('tr.even,tr.odd', $(rawDataset)).map (index, tr) =>
id = $('td', $(tr)).first().text()
{
id: id
imageUrl: "http://magiccards.info/scans/en/#{@set}/#{id}.jpg"
}
@devandy
Copy link
Author

devandy commented Aug 27, 2012

info: Creating snapshot 0.0.1-14
info: Updating app pol
info: Activating snapshot 0.0.1-14 for pol
info: Starting app pol
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
error:
error: There was an error while attempting to start your application.
error: Error spawning drone
error: Script prematurely exited
error:
error: This type of error is usually a user error.
error: Error output from your application:
error:
error: TypeError: Cannot read property 'prototype' of undefined
error: at create
(/opt/haibu/apps/devandy/pol/package/node_modules/jquery/lib/node-jquery.js:10:26)
error: at
/opt/haibu/apps/devandy/pol/package/node_modules/jquery/lib/node-jquery.js:9435:18
error: at Object.
(/opt/haibu/apps/devandy/pol/package/node_modules/jquery/lib/node-jquery.js:9437:2)
error: at Module._compile (module.js:449:26)
error: at Object.Module._extensions..js (module.js:467:10)
error: at Module.load (module.js:356:32)
error: at Function.Module._load (module.js:312:12)
error: at Module.require (module.js:362:17)
error: at require (module.js:378:17)
error: at Object.
(/opt/haibu/apps/devandy/pol/package/code/server/storage.coffee:6:7)
info: Nodejitsu not ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment