Skip to content

Instantly share code, notes, and snippets.

@RobinStamer
Created June 24, 2011 18:01
Show Gist options
  • Select an option

  • Save RobinStamer/1045316 to your computer and use it in GitHub Desktop.

Select an option

Save RobinStamer/1045316 to your computer and use it in GitHub Desktop.
$ node tmp.js;cat tmp.js
Name: ???
Next: Sat Jun 25 2011 13:30:50 GMT-0600 (MDT)
URL: http://twokinds.keenspot.com
Regex: /images\/[0-9]/
Name: XKCD
Next: Fri Jun 24 2011 22:31:50 GMT-0600 (MDT)
URL: http://xkcd.com/
Regex: /\/imgs.xkcd.com\/comics\//
Name: 2nd Shift - 74. Non-Date
Next: Sat Jun 25 2011 03:00:50 GMT-0600 (MDT)
URL: http://2ndshiftcomic.com/
Regex: /image.php/
Name: 70-Seas
Next: Fri Jun 24 2011 18:39:51 GMT-0600 (MDT)
URL: http://70-seas.com/
Regex: //proper//
Notes: Needs to have nextTime removed.
Name: A Girl and Her Fed
Next: Fri Jun 24 2011 19:43:50 GMT-0600 (MDT)
URL: http://agirlandherfed.com/
Regex: //strip//
Notes: Needs to have nextTime removed.
var g = require('genoce')
g.DB().open(function(err, client) {
if (err) {
throw err
}
var temp = g.XTemplate([
'Name: {[values.name || "???"]}<br />',
'\tNext: {nextDate}<br />',
'\tURL: {_id}<br />',
'\tRegex: {regex}<br />',
'<tpl if="nextTime">',
'\tNotes: Needs to have nextTime removed.<br />',
'</tpl>'
])
var cur = client.getCollection('comics').find({})
cur.limit(5)
cur.each(function(err, doc) {
if (err) {
throw err
}
if (null === doc) {
client.close()
return
}
console.log(temp(doc).replace(new RegExp('<br />', 'g'), '\n'))
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment