id stringlengths 34 124 | type stringclasses 4
values | prompt stringlengths 0 4.95k | response stringlengths 21 4.89k | source_lang stringclasses 3
values | target_lang stringclasses 2
values | repo stringclasses 75
values | path stringlengths 10 88 | license stringclasses 1
value | commit stringlengths 40 40 | stars int64 431 18.7k | source_url stringlengths 86 176 | line_start int64 1 214 | line_end int64 3 253 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jnordberg/wintersmith:src/plugins/page.coffee:1:completion | completion | module.exports = (env, callback) ->
templateView = (env, locals, contents, templates, callback) ->
### Content view that expects content to have a @template instance var that
matches a template in *templates*. Calls *callback* with output of template
or null if @template is set to 'none'. ###
... | class Page extends env.ContentPlugin
### Page base class, a page is content that has metadata, html and a template that renders it ###
constructor: (@filepath, @metadata) ->
getFilename: ->
if @metadata.filename?
dirname = path.dirname @filepath.relative
return path.join(dirname, @me... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 8419d8107319d194d18a81bf81009dc65d78ddd2 | 3,484 | https://github.com/jnordberg/wintersmith/blob/8419d8107319d194d18a81bf81009dc65d78ddd2/src/plugins/page.coffee | 4 | 53 |
jnordberg/wintersmith:src/plugins/page.coffee:2:raw_corpus | raw_corpus | @property 'intro', 'getIntro'
getIntro: (base) ->
html = @getHtml(base)
cutoffs = ['<span class="more', '<h2', '<hr']
idx = Infinity
for cutoff in cutoffs
i = html.indexOf cutoff
if i isnt -1 and i < idx
idx = i
if idx isnt Infinity
return html.substr ... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 8419d8107319d194d18a81bf81009dc65d78ddd2 | 3,484 | https://github.com/jnordberg/wintersmith/blob/8419d8107319d194d18a81bf81009dc65d78ddd2/src/plugins/page.coffee | 54 | 94 | ||
jnordberg/wintersmith:src/plugins/page.coffee:2:completion | completion | @property 'intro', 'getIntro'
getIntro: (base) ->
html = @getHtml(base)
cutoffs = ['<span class="more', '<h2', '<hr']
idx = Infinity
for cutoff in cutoffs
i = html.indexOf cutoff
if i isnt -1 and i < idx
idx = i
if idx isnt Infinity
return html.substr ... | @property 'date', ->
new Date(@metadata.date or 0)
@property 'rfc822date', ->
env.utils.rfc822(@date)
@property 'hasMore', ->
@_html ?= @getHtml()
@_intro ?= @getIntro()
@_hasMore ?= (@_html.length > @_intro.length)
return @_hasMore
# add the page plugin to the env since... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 8419d8107319d194d18a81bf81009dc65d78ddd2 | 3,484 | https://github.com/jnordberg/wintersmith/blob/8419d8107319d194d18a81bf81009dc65d78ddd2/src/plugins/page.coffee | 54 | 94 |
jnordberg/wintersmith:src/plugins/page.coffee:2:raw_corpus | raw_corpus | @property 'intro', 'getIntro'
getIntro: (base) ->
html = @getHtml(base)
cutoffs = ['<span class="more', '<h2', '<hr']
idx = Infinity
for cutoff in cutoffs
i = html.indexOf cutoff
if i isnt -1 and i < idx
idx = i
if idx isnt Infinity
return html.substr ... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 9b610439cc3dfd0ec295fb31f1ed8e621232db98 | 3,484 | https://github.com/jnordberg/wintersmith/blob/9b610439cc3dfd0ec295fb31f1ed8e621232db98/src/plugins/page.coffee | 54 | 94 | ||
jnordberg/wintersmith:src/plugins/page.coffee:2:completion | completion | @property 'intro', 'getIntro'
getIntro: (base) ->
html = @getHtml(base)
cutoffs = ['<span class="more', '<h2', '<hr']
idx = Infinity
for cutoff in cutoffs
i = html.indexOf cutoff
if i isnt -1 and i < idx
idx = i
if idx isnt Infinity
return html.substr ... | @property 'date', ->
new Date(@metadata.date or 0)
@property 'rfc822date', ->
env.utils.rfc822(@date)
@property 'hasMore', ->
@_html ?= @getHtml()
@_intro ?= @getIntro()
@_hasMore ?= (@_html.length > @_intro.length)
return @_hasMore
# add the page plugin to the env since... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 9b610439cc3dfd0ec295fb31f1ed8e621232db98 | 3,484 | https://github.com/jnordberg/wintersmith/blob/9b610439cc3dfd0ec295fb31f1ed8e621232db98/src/plugins/page.coffee | 54 | 94 |
jnordberg/wintersmith:src/plugins/page.coffee:1:raw_corpus | raw_corpus | module.exports = (env, callback) ->
templateView = (env, locals, contents, templates, callback) ->
### Content view that expects content to have a @template instance var that
matches a template in *templates*. Calls *callback* with output of template
or null if @template is set to 'none'. ###
... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 940f1c0cae6d731c5d07345730d0d70f684223d2 | 3,484 | https://github.com/jnordberg/wintersmith/blob/940f1c0cae6d731c5d07345730d0d70f684223d2/src/plugins/page.coffee | 6 | 55 | ||
jnordberg/wintersmith:src/plugins/page.coffee:1:completion | completion | module.exports = (env, callback) ->
templateView = (env, locals, contents, templates, callback) ->
### Content view that expects content to have a @template instance var that
matches a template in *templates*. Calls *callback* with output of template
or null if @template is set to 'none'. ###
... | class Page extends env.ContentPlugin
### Page base class, a page is content that has metadata, html and a template that renders it ###
constructor: (@filepath, @metadata) ->
getFilename: ->
if @metadata.filename?
dirname = path.dirname @filepath.relative
return path.join(dirname, @me... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 940f1c0cae6d731c5d07345730d0d70f684223d2 | 3,484 | https://github.com/jnordberg/wintersmith/blob/940f1c0cae6d731c5d07345730d0d70f684223d2/src/plugins/page.coffee | 6 | 55 |
jnordberg/wintersmith:src/plugins/page.coffee:2:raw_corpus | raw_corpus | throw new Error 'Not implemented.'
@property 'intro', 'getIntro'
getIntro: (base) ->
html = @getHtml(base)
cutoffs = ['<span class="more', '<h2', '<hr']
idx = Infinity
for cutoff in cutoffs
i = html.indexOf cutoff
if i isnt -1 and i < idx
idx = i
if idx i... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 940f1c0cae6d731c5d07345730d0d70f684223d2 | 3,484 | https://github.com/jnordberg/wintersmith/blob/940f1c0cae6d731c5d07345730d0d70f684223d2/src/plugins/page.coffee | 56 | 98 | ||
jnordberg/wintersmith:src/plugins/page.coffee:2:completion | completion | throw new Error 'Not implemented.'
@property 'intro', 'getIntro'
getIntro: (base) ->
html = @getHtml(base)
cutoffs = ['<span class="more', '<h2', '<hr']
idx = Infinity
for cutoff in cutoffs
i = html.indexOf cutoff
if i isnt -1 and i < idx
idx = i
if idx i... | @metadata.title or 'Untitled'
@property 'date', ->
new Date(@metadata.date or 0)
@property 'rfc822date', ->
moment(@date).format('ddd, DD MMM YYYY HH:mm:ss ZZ')
@property 'hasMore', ->
@_html ?= @getHtml()
@_intro ?= @getIntro()
@_hasMore ?= (@_html.length > @_intro.length)
... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 940f1c0cae6d731c5d07345730d0d70f684223d2 | 3,484 | https://github.com/jnordberg/wintersmith/blob/940f1c0cae6d731c5d07345730d0d70f684223d2/src/plugins/page.coffee | 56 | 98 |
jnordberg/wintersmith:src/plugins/page.coffee:1:raw_corpus | raw_corpus | module.exports = (env, callback) ->
templateView = (env, locals, contents, templates, callback) ->
### Content view that expects content to have a @template instance var that
matches a template in *templates*. Calls *callback* with output of template
or null if @template is set to 'none'. ###
... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 4d2698bb5b44a7eaac9a76baa0c136606170ec64 | 3,484 | https://github.com/jnordberg/wintersmith/blob/4d2698bb5b44a7eaac9a76baa0c136606170ec64/src/plugins/page.coffee | 6 | 55 | ||
jnordberg/wintersmith:src/plugins/page.coffee:1:completion | completion | module.exports = (env, callback) ->
templateView = (env, locals, contents, templates, callback) ->
### Content view that expects content to have a @template instance var that
matches a template in *templates*. Calls *callback* with output of template
or null if @template is set to 'none'. ###
... | class Page extends env.ContentPlugin
### Page base class, a page is content that has metadata, html and a template that renders it ###
constructor: (@filepath, @metadata) ->
getFilename: ->
if @metadata.filename?
dirname = path.dirname @filepath.relative
return path.join(dirname, @me... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 4d2698bb5b44a7eaac9a76baa0c136606170ec64 | 3,484 | https://github.com/jnordberg/wintersmith/blob/4d2698bb5b44a7eaac9a76baa0c136606170ec64/src/plugins/page.coffee | 6 | 55 |
jnordberg/wintersmith:src/plugins/page.coffee:2:raw_corpus | raw_corpus | throw new Error 'Not implemented.'
@property 'intro', 'getIntro'
getIntro: (base) ->
html = @getHtml(base)
idx = ~html.indexOf('<span class="more') or ~html.indexOf('<h2') or ~html.indexOf('<hr')
if idx
return html.substr 0, ~idx
else
return html
### Template proper... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 4d2698bb5b44a7eaac9a76baa0c136606170ec64 | 3,484 | https://github.com/jnordberg/wintersmith/blob/4d2698bb5b44a7eaac9a76baa0c136606170ec64/src/plugins/page.coffee | 56 | 93 | ||
jnordberg/wintersmith:src/plugins/page.coffee:2:completion | completion | throw new Error 'Not implemented.'
@property 'intro', 'getIntro'
getIntro: (base) ->
html = @getHtml(base)
idx = ~html.indexOf('<span class="more') or ~html.indexOf('<h2') or ~html.indexOf('<hr')
if idx
return html.substr 0, ~idx
else
return html
### Template proper... | new Date(@metadata.date or 0)
@property 'rfc822date', ->
moment(@date).format('ddd, DD MMM YYYY HH:mm:ss ZZ')
@property 'hasMore', ->
@_html ?= @getHtml()
@_intro ?= @getIntro()
@_hasMore ?= (@_html.length > @_intro.length)
return @_hasMore
# add the page plugin to the env sin... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 4d2698bb5b44a7eaac9a76baa0c136606170ec64 | 3,484 | https://github.com/jnordberg/wintersmith/blob/4d2698bb5b44a7eaac9a76baa0c136606170ec64/src/plugins/page.coffee | 56 | 93 |
jnordberg/wintersmith:src/plugins/page.coffee:1:raw_corpus | raw_corpus | module.exports = (env, callback) ->
templateView = (env, locals, contents, templates, callback) ->
### Content view that expects content to have a @template instance var that
matches a template in *templates*. Calls *callback* with output of template
or null if @template is set to 'none'. ###
... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | c9efc8b503a1a4248f5b6a14d7bc672f7d9ad89f | 3,484 | https://github.com/jnordberg/wintersmith/blob/c9efc8b503a1a4248f5b6a14d7bc672f7d9ad89f/src/plugins/page.coffee | 6 | 55 | ||
jnordberg/wintersmith:src/plugins/page.coffee:1:completion | completion | module.exports = (env, callback) ->
templateView = (env, locals, contents, templates, callback) ->
### Content view that expects content to have a @template instance var that
matches a template in *templates*. Calls *callback* with output of template
or null if @template is set to 'none'. ###
... | class Page extends env.ContentPlugin
### Page base class, a page is content that has metadata, html and a template that renders it ###
constructor: (@filepath, @metadata) ->
getFilename: ->
if @metadata.filename?
dirname = path.dirname @filepath.relative
return path.resolve(dirname, ... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | c9efc8b503a1a4248f5b6a14d7bc672f7d9ad89f | 3,484 | https://github.com/jnordberg/wintersmith/blob/c9efc8b503a1a4248f5b6a14d7bc672f7d9ad89f/src/plugins/page.coffee | 6 | 55 |
jnordberg/wintersmith:src/plugins/page.coffee:1:raw_corpus | raw_corpus | templateView = (env, locals, contents, templates, callback) ->
if @template == 'none'
# dont render
return callback null, null
template = templates[@template]
if not template?
return callback new Error "page '#{ @filename }' specifies unknown template '#{ @template }'"
ctx =
page: this
con... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 8ea4fef1ec1200537f0cc3fff1c3a1228ab338a5 | 3,484 | https://github.com/jnordberg/wintersmith/blob/8ea4fef1ec1200537f0cc3fff1c3a1228ab338a5/src/plugins/page.coffee | 10 | 28 | ||
jnordberg/wintersmith:src/plugins/page.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
templateView = (env, locals, contents, templates, callback) ->
if @template == 'none'
# dont render
return callback null, null
template = templates[@template]
if not template?
return callback new Error "page '#{ @filename }' specifies unknown t... | var templateView;
templateView = function(env, locals, contents, templates, callback) {
var ctx, template;
if (this.template === 'none') {
// dont render
return callback(null, null);
}
template = templates[this.template];
if (template == null) {
return callback(new Error(`page '${this.filename}' ... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 8ea4fef1ec1200537f0cc3fff1c3a1228ab338a5 | 3,484 | https://github.com/jnordberg/wintersmith/blob/8ea4fef1ec1200537f0cc3fff1c3a1228ab338a5/src/plugins/page.coffee | 10 | 28 |
jnordberg/wintersmith:src/plugins/page.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var templateView;
templateView = function(env, locals, contents, templates, callback) {
var ctx, template;
if (this.template === 'none') {
// dont render
return callback(null, null);
}
template = templates[this.template];
if (template == null) {
... | templateView = (env, locals, contents, templates, callback) ->
if @template == 'none'
# dont render
return callback null, null
template = templates[@template]
if not template?
return callback new Error "page '#{ @filename }' specifies unknown template '#{ @template }'"
ctx =
page: this
con... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 8ea4fef1ec1200537f0cc3fff1c3a1228ab338a5 | 3,484 | https://github.com/jnordberg/wintersmith/blob/8ea4fef1ec1200537f0cc3fff1c3a1228ab338a5/src/plugins/page.coffee | 10 | 28 |
jnordberg/wintersmith:src/plugins/page.coffee:1:completion | completion | templateView = (env, locals, contents, templates, callback) ->
if @template == 'none'
# dont render
return callback null, null
template = templates[@template]
if not template?
return callback new Error "page '#{ @filename }' specifies unknown template '#{ @template }'" | ctx =
page: this
contents: contents
_: underscore
moment: moment
marked: marked
extend ctx, locals
template.render ctx, callback | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 8ea4fef1ec1200537f0cc3fff1c3a1228ab338a5 | 3,484 | https://github.com/jnordberg/wintersmith/blob/8ea4fef1ec1200537f0cc3fff1c3a1228ab338a5/src/plugins/page.coffee | 10 | 28 |
jnordberg/wintersmith:src/plugins/page.coffee:2:raw_corpus | raw_corpus | class Page extends ContentPlugin
### page content plugin, a page is a file that has
metadata, html and a template that renders it ###
constructor: (@filepath, @_content, @_metadata) ->
getFilename: ->
@_metadata.filename or stripExtension(@filepath.relative) + '.html'
getHtml: (base='/') ->
@_c... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 8ea4fef1ec1200537f0cc3fff1c3a1228ab338a5 | 3,484 | https://github.com/jnordberg/wintersmith/blob/8ea4fef1ec1200537f0cc3fff1c3a1228ab338a5/src/plugins/page.coffee | 31 | 80 | ||
jnordberg/wintersmith:src/plugins/page.coffee:2:completion | completion | class Page extends ContentPlugin
### page content plugin, a page is a file that has
metadata, html and a template that renders it ###
constructor: (@filepath, @_content, @_metadata) ->
getFilename: ->
@_metadata.filename or stripExtension(@filepath.relative) + '.html'
getHtml: (base='/') ->
@_c... | @_metadata.view or 'template'
@property 'metadata', ->
@_metadata
@property 'template', ->
@_metadata.template or 'none'
@property 'html', ->
@getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', ->
new Date(@_metadata.date or 0)
@property 'rfc822date', ... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 8ea4fef1ec1200537f0cc3fff1c3a1228ab338a5 | 3,484 | https://github.com/jnordberg/wintersmith/blob/8ea4fef1ec1200537f0cc3fff1c3a1228ab338a5/src/plugins/page.coffee | 31 | 80 |
jnordberg/wintersmith:src/plugins/page.coffee:3:raw_corpus | raw_corpus | @_intro ?= @getIntro()
@_hasMore ?= (@_html.length > @_intro.length)
return @_hasMore
### Exports ### | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 8ea4fef1ec1200537f0cc3fff1c3a1228ab338a5 | 3,484 | https://github.com/jnordberg/wintersmith/blob/8ea4fef1ec1200537f0cc3fff1c3a1228ab338a5/src/plugins/page.coffee | 81 | 85 | ||
jnordberg/wintersmith:src/plugins/page.coffee:3:completion | completion | @_intro ?= @getIntro()
@_hasMore ?= (@_html.length > @_intro.length) | return @_hasMore
### Exports ### | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 8ea4fef1ec1200537f0cc3fff1c3a1228ab338a5 | 3,484 | https://github.com/jnordberg/wintersmith/blob/8ea4fef1ec1200537f0cc3fff1c3a1228ab338a5/src/plugins/page.coffee | 81 | 85 |
jnordberg/wintersmith:src/plugins/page.coffee:1:raw_corpus | raw_corpus | class Page extends ContentPlugin
### page content plugin, a page is a file that has
metadata, html and a template that renders it ###
constructor: (@filepath, @_content, @_metadata) ->
getFilename: ->
@_metadata.filename or stripExtension(@filepath.relative) + '.html'
getHtml: (base='/') ->
@_c... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 5ccd1fc28ab1be1774e7bce58d78af553b635b23 | 3,484 | https://github.com/jnordberg/wintersmith/blob/5ccd1fc28ab1be1774e7bce58d78af553b635b23/src/plugins/page.coffee | 10 | 59 | ||
jnordberg/wintersmith:src/plugins/page.coffee:1:completion | completion | class Page extends ContentPlugin
### page content plugin, a page is a file that has
metadata, html and a template that renders it ###
constructor: (@filepath, @_content, @_metadata) ->
getFilename: ->
@_metadata.filename or stripExtension(@filepath.relative) + '.html'
getHtml: (base='/') ->
@_c... | return (env, locals, contents, templates, callback) ->
# TODO: break out into render template view
if @template == 'none'
# dont render
return callback null, null
async.waterfall [
(callback) =>
template = templates[@template]
if not template?
c... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 5ccd1fc28ab1be1774e7bce58d78af553b635b23 | 3,484 | https://github.com/jnordberg/wintersmith/blob/5ccd1fc28ab1be1774e7bce58d78af553b635b23/src/plugins/page.coffee | 10 | 59 |
jnordberg/wintersmith:src/plugins/page.coffee:2:raw_corpus | raw_corpus | @_metadata
@property 'template', ->
@_metadata.template or 'none'
@property 'html', ->
@getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', ->
new Date(@_metadata.date or 0)
@property 'rfc822date', ->
moment(@date).format('ddd, DD MMM YYYY HH:mm:ss ZZ')
... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 5ccd1fc28ab1be1774e7bce58d78af553b635b23 | 3,484 | https://github.com/jnordberg/wintersmith/blob/5ccd1fc28ab1be1774e7bce58d78af553b635b23/src/plugins/page.coffee | 60 | 84 | ||
jnordberg/wintersmith:src/plugins/page.coffee:2:completion | completion | @_metadata
@property 'template', ->
@_metadata.template or 'none'
@property 'html', ->
@getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', -> | new Date(@_metadata.date or 0)
@property 'rfc822date', ->
moment(@date).format('ddd, DD MMM YYYY HH:mm:ss ZZ')
@property 'intro', ->
@getIntro()
@property 'hasMore', ->
@_html ?= @getHtml()
@_intro ?= @getIntro()
@_hasMore ?= (@_html.length > @_intro.length)
return @_hasMore | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 5ccd1fc28ab1be1774e7bce58d78af553b635b23 | 3,484 | https://github.com/jnordberg/wintersmith/blob/5ccd1fc28ab1be1774e7bce58d78af553b635b23/src/plugins/page.coffee | 60 | 84 |
jnordberg/wintersmith:src/plugins/page.coffee:1:raw_corpus | raw_corpus | class Page extends ContentPlugin
### page content plugin, a page is a file that has
metadata, html and a template that renders it ###
constructor: (@filepath, @_content, @_metadata) ->
getFilename: ->
@_metadata.filename or stripExtension(@filepath.relative) + '.html'
getHtml: (base='/') ->
@_c... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 1cad02556f9f384086b05d7d914be5dcacc13294 | 3,484 | https://github.com/jnordberg/wintersmith/blob/1cad02556f9f384086b05d7d914be5dcacc13294/src/plugins/page.coffee | 10 | 59 | ||
jnordberg/wintersmith:src/plugins/page.coffee:1:completion | completion | class Page extends ContentPlugin
### page content plugin, a page is a file that has
metadata, html and a template that renders it ###
constructor: (@filepath, @_content, @_metadata) ->
getFilename: ->
@_metadata.filename or stripExtension(@filepath.relative) + '.html'
getHtml: (base='/') ->
@_c... | # TODO: break out into render template view
if @template == 'none'
# dont render
return callback null, null
async.waterfall [
(callback) =>
template = templates[@template]
if not template?
callback new Error "page '#{ @filename }' specifies unknown template '#{ @temp... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 1cad02556f9f384086b05d7d914be5dcacc13294 | 3,484 | https://github.com/jnordberg/wintersmith/blob/1cad02556f9f384086b05d7d914be5dcacc13294/src/plugins/page.coffee | 10 | 59 |
jnordberg/wintersmith:src/plugins/page.coffee:2:raw_corpus | raw_corpus | @property 'template', ->
@_metadata.template or 'none'
@property 'html', ->
@getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', ->
new Date(@_metadata.date or 0)
@property 'rfc822date', ->
moment(@date).format('ddd, DD MMM YYYY HH:mm:ss ZZ')
@property 'in... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 1cad02556f9f384086b05d7d914be5dcacc13294 | 3,484 | https://github.com/jnordberg/wintersmith/blob/1cad02556f9f384086b05d7d914be5dcacc13294/src/plugins/page.coffee | 60 | 83 | ||
jnordberg/wintersmith:src/plugins/page.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@property 'template', ->
@_metadata.template or 'none'
@property 'html', ->
@getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', ->
new Date(@_metadata.date or 0)
@property 'rfc822date', ->
moment(@date... | this.property('template', function() {
return this._metadata.template || 'none';
});
this.property('html', function() {
return this.getHtml();
});
this.property('title', function() {
return this._metadata.title || 'Untitled';
});
this.property('date', function() {
return new Date(this._metadata.date || 0);
}... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 1cad02556f9f384086b05d7d914be5dcacc13294 | 3,484 | https://github.com/jnordberg/wintersmith/blob/1cad02556f9f384086b05d7d914be5dcacc13294/src/plugins/page.coffee | 60 | 83 |
jnordberg/wintersmith:src/plugins/page.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.property('template', function() {
return this._metadata.template || 'none';
});
this.property('html', function() {
return this.getHtml();
});
this.property('title', function() {
return this._metadata.title || 'Untitled';
});
this.property('date', func... | @property 'template', ->
@_metadata.template or 'none'
@property 'html', ->
@getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', ->
new Date(@_metadata.date or 0)
@property 'rfc822date', ->
moment(@date).format('ddd, DD MMM YYYY HH:mm:ss ZZ')
@property 'in... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 1cad02556f9f384086b05d7d914be5dcacc13294 | 3,484 | https://github.com/jnordberg/wintersmith/blob/1cad02556f9f384086b05d7d914be5dcacc13294/src/plugins/page.coffee | 60 | 83 |
jnordberg/wintersmith:src/plugins/page.coffee:2:completion | completion | @property 'template', ->
@_metadata.template or 'none'
@property 'html', ->
@getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', ->
new Date(@_metadata.date or 0) | @property 'rfc822date', ->
moment(@date).format('ddd, DD MMM YYYY HH:mm:ss ZZ')
@property 'intro', ->
@getIntro()
@property 'hasMore', ->
@_html ?= @getHtml()
@_intro ?= @getIntro()
@_hasMore ?= (@_html.length > @_intro.length)
return @_hasMore | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 1cad02556f9f384086b05d7d914be5dcacc13294 | 3,484 | https://github.com/jnordberg/wintersmith/blob/1cad02556f9f384086b05d7d914be5dcacc13294/src/plugins/page.coffee | 60 | 83 |
jnordberg/wintersmith:src/plugins/page.coffee:1:raw_corpus | raw_corpus | class Page extends ContentPlugin
### page content plugin, a page is a file that has
metadata, html and a template that renders it ###
constructor: (@_filename, @_content, @_metadata) ->
getFilename: ->
@_metadata.filename or stripExtension(@_filename) + '.html'
getHtml: (base='/') ->
@_content
... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 8c8e0faed8b76629825ab270cb79034e48f165c6 | 3,484 | https://github.com/jnordberg/wintersmith/blob/8c8e0faed8b76629825ab270cb79034e48f165c6/src/plugins/page.coffee | 10 | 59 | ||
jnordberg/wintersmith:src/plugins/page.coffee:1:completion | completion | class Page extends ContentPlugin
### page content plugin, a page is a file that has
metadata, html and a template that renders it ###
constructor: (@_filename, @_content, @_metadata) ->
getFilename: ->
@_metadata.filename or stripExtension(@_filename) + '.html'
getHtml: (base='/') ->
@_content
... | render: (locals, contents, templates, callback) ->
if @template == 'none'
# dont render
return callback null, null
async.waterfall [
(callback) =>
template = templates[@template]
if not template?
callback new Error "page '#{ @filename }' specifies unknown template '#... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 8c8e0faed8b76629825ab270cb79034e48f165c6 | 3,484 | https://github.com/jnordberg/wintersmith/blob/8c8e0faed8b76629825ab270cb79034e48f165c6/src/plugins/page.coffee | 10 | 59 |
jnordberg/wintersmith:src/plugins/page.coffee:1:raw_corpus | raw_corpus | class Page extends ContentPlugin
### page content plugin, a page is a file that has
metadata, html and a template that renders it ###
constructor: (@_filename, @_content, @_metadata) ->
getFilename: ->
@_metadata.filename or stripExtension(@_filename) + '.html'
getHtml: (base='/') ->
@_content
... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | faa044b5a58a573e156a71f07b0e9c01f0b1d424 | 3,484 | https://github.com/jnordberg/wintersmith/blob/faa044b5a58a573e156a71f07b0e9c01f0b1d424/src/plugins/page.coffee | 9 | 58 | ||
jnordberg/wintersmith:src/plugins/page.coffee:1:completion | completion | class Page extends ContentPlugin
### page content plugin, a page is a file that has
metadata, html and a template that renders it ###
constructor: (@_filename, @_content, @_metadata) ->
getFilename: ->
@_metadata.filename or stripExtension(@_filename) + '.html'
getHtml: (base='/') ->
@_content
... | if @template == 'none'
# dont render
return callback null, null
async.waterfall [
(callback) =>
template = templates[@template]
if not template?
callback new Error "page '#{ @filename }' specifies unknown template '#{ @template }'"
else
callback null, t... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | faa044b5a58a573e156a71f07b0e9c01f0b1d424 | 3,484 | https://github.com/jnordberg/wintersmith/blob/faa044b5a58a573e156a71f07b0e9c01f0b1d424/src/plugins/page.coffee | 9 | 58 |
jnordberg/wintersmith:src/plugins/page.coffee:2:raw_corpus | raw_corpus | @_metadata.template or 'none'
@property 'html', ->
@getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', ->
new Date(@_metadata.date or 0)
@property 'rfc822date', ->
moment(@date).format('ddd, DD MMM YYYY HH:mm:ss ZZ')
@property 'intro', ->
@getIntro()
@... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | faa044b5a58a573e156a71f07b0e9c01f0b1d424 | 3,484 | https://github.com/jnordberg/wintersmith/blob/faa044b5a58a573e156a71f07b0e9c01f0b1d424/src/plugins/page.coffee | 59 | 80 | ||
jnordberg/wintersmith:src/plugins/page.coffee:2:completion | completion | @_metadata.template or 'none'
@property 'html', ->
@getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', ->
new Date(@_metadata.date or 0) | @property 'rfc822date', ->
moment(@date).format('ddd, DD MMM YYYY HH:mm:ss ZZ')
@property 'intro', ->
@getIntro()
@property 'hasMore', ->
@_html ?= @getHtml()
@_intro ?= @getIntro()
@_hasMore ?= (@_html.length > @_intro.length)
return @_hasMore | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | faa044b5a58a573e156a71f07b0e9c01f0b1d424 | 3,484 | https://github.com/jnordberg/wintersmith/blob/faa044b5a58a573e156a71f07b0e9c01f0b1d424/src/plugins/page.coffee | 59 | 80 |
jnordberg/wintersmith:src/plugins/page.coffee:2:raw_corpus | raw_corpus | @_metadata.template or 'none'
@property 'html', ->
@getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', ->
new Date(@_metadata.date or 0)
@property 'rfc822date', ->
rfc822 @date
@property 'intro', ->
@getIntro()
@property 'hasMore', ->
@_html ?= @ge... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | f621ed8f54a2a5ebb22ce9fb5bac5a9ba08a4b30 | 3,484 | https://github.com/jnordberg/wintersmith/blob/f621ed8f54a2a5ebb22ce9fb5bac5a9ba08a4b30/src/plugins/page.coffee | 59 | 80 | ||
jnordberg/wintersmith:src/plugins/page.coffee:2:completion | completion | @_metadata.template or 'none'
@property 'html', ->
@getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', ->
new Date(@_metadata.date or 0) | @property 'rfc822date', ->
rfc822 @date
@property 'intro', ->
@getIntro()
@property 'hasMore', ->
@_html ?= @getHtml()
@_intro ?= @getIntro()
@_hasMore ?= (@_html.length > @_intro.length)
return @_hasMore | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | f621ed8f54a2a5ebb22ce9fb5bac5a9ba08a4b30 | 3,484 | https://github.com/jnordberg/wintersmith/blob/f621ed8f54a2a5ebb22ce9fb5bac5a9ba08a4b30/src/plugins/page.coffee | 59 | 80 |
jnordberg/wintersmith:src/plugins/page.coffee:1:raw_corpus | raw_corpus | path = require 'path'
async = require 'async'
underscore = require 'underscore'
{ContentPlugin} = require './../content'
{stripExtension, extend, rfc822} = require './../common'
class Page extends ContentPlugin
### page content plugin, a page is a file that has
metadata, html and a template that renders it ##... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 18343007a2642a76464153c32c473435fe8c4846 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18343007a2642a76464153c32c473435fe8c4846/src/plugins/page.coffee | 1 | 50 | ||
jnordberg/wintersmith:src/plugins/page.coffee:1:completion | completion | path = require 'path'
async = require 'async'
underscore = require 'underscore'
{ContentPlugin} = require './../content'
{stripExtension, extend, rfc822} = require './../common'
class Page extends ContentPlugin
### page content plugin, a page is a file that has
metadata, html and a template that renders it ##... | if idx
@_intro = @_html.substr 0, ~idx
else
@_intro = @_html
return @_intro
render: (locals, contents, templates, callback) ->
if @template == 'none'
# dont render
return callback null, null
async.waterfall [
(callback) =>
template = templates[@template]
... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 18343007a2642a76464153c32c473435fe8c4846 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18343007a2642a76464153c32c473435fe8c4846/src/plugins/page.coffee | 1 | 50 |
jnordberg/wintersmith:src/plugins/page.coffee:2:raw_corpus | raw_corpus | ], callback
@property 'metadata', ->
@_metadata
@property 'template', ->
@_metadata.template or 'none'
@property 'html', ->
@getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', ->
new Date(@_metadata.date or 0)
@property 'rfc822date', ->
rfc822 @dat... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 18343007a2642a76464153c32c473435fe8c4846 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18343007a2642a76464153c32c473435fe8c4846/src/plugins/page.coffee | 51 | 80 | ||
jnordberg/wintersmith:src/plugins/page.coffee:2:completion | completion | ], callback
@property 'metadata', ->
@_metadata
@property 'template', ->
@_metadata.template or 'none'
@property 'html', ->
@getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', -> | new Date(@_metadata.date or 0)
@property 'rfc822date', ->
rfc822 @date
@property 'intro', ->
@getIntro()
@property 'hasMore', ->
@_html ?= @getHtml()
@_intro ?= @getIntro()
@_hasMore ?= (@_html.length > @_intro.length)
return @_hasMore
module.exports = Page | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 18343007a2642a76464153c32c473435fe8c4846 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18343007a2642a76464153c32c473435fe8c4846/src/plugins/page.coffee | 51 | 80 |
jnordberg/wintersmith:src/plugins/page.coffee:1:raw_corpus | raw_corpus | path = require 'path'
async = require 'async'
underscore = require 'underscore'
{ContentPlugin} = require './../content'
{stripExtension, extend, rfc822} = require './../common'
class Page extends ContentPlugin
### page content plugin, a page is a file that has
metadata, html and a template that renders it ##... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | ea953d6a8900afe5a72e98324ddd24cc668ddde9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/ea953d6a8900afe5a72e98324ddd24cc668ddde9/src/plugins/page.coffee | 1 | 50 | ||
jnordberg/wintersmith:src/plugins/page.coffee:1:completion | completion | path = require 'path'
async = require 'async'
underscore = require 'underscore'
{ContentPlugin} = require './../content'
{stripExtension, extend, rfc822} = require './../common'
class Page extends ContentPlugin
### page content plugin, a page is a file that has
metadata, html and a template that renders it ##... | return callback null, null
async.waterfall [
(callback) =>
template = templates[@template]
if not template?
callback new Error "page '#{ @filename }' specifies unknown template '#{ @template }'"
else
callback null, template
(template, callback) =>
ctx... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | ea953d6a8900afe5a72e98324ddd24cc668ddde9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/ea953d6a8900afe5a72e98324ddd24cc668ddde9/src/plugins/page.coffee | 1 | 50 |
jnordberg/wintersmith:src/plugins/page.coffee:2:raw_corpus | raw_corpus | @getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', ->
new Date(@_metadata.date or 0)
@property 'rfc822date', ->
rfc822 @date
@property 'intro', ->
idx = ~@html.indexOf('<span class="more') or ~@html.indexOf('<h2')
if idx
return @html.substr 0, ~idx
... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | ea953d6a8900afe5a72e98324ddd24cc668ddde9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/ea953d6a8900afe5a72e98324ddd24cc668ddde9/src/plugins/page.coffee | 51 | 73 | ||
jnordberg/wintersmith:src/plugins/page.coffee:2:completion | completion | @getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', ->
new Date(@_metadata.date or 0)
@property 'rfc822date', ->
rfc822 @date | @property 'intro', ->
idx = ~@html.indexOf('<span class="more') or ~@html.indexOf('<h2')
if idx
return @html.substr 0, ~idx
else
return @html
@property 'hasMore', ->
@_hasMore ?= (@html.length > @intro.length)
return @_hasMore
module.exports = Page | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | ea953d6a8900afe5a72e98324ddd24cc668ddde9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/ea953d6a8900afe5a72e98324ddd24cc668ddde9/src/plugins/page.coffee | 51 | 73 |
jnordberg/wintersmith:src/plugins/page.coffee:1:raw_corpus | raw_corpus | path = require 'path'
async = require 'async'
underscore = require 'underscore'
{ContentPlugin} = require './../content'
{stripExtension, extend, rfc822} = require './../common'
class Page extends ContentPlugin
### page content plugin, a page is a file that has
metadata, html and a template that renders it ##... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 98712ce0ad2b01ae2c5fa855d0e41d8b82c45f64 | 3,484 | https://github.com/jnordberg/wintersmith/blob/98712ce0ad2b01ae2c5fa855d0e41d8b82c45f64/src/plugins/page.coffee | 1 | 50 | ||
jnordberg/wintersmith:src/plugins/page.coffee:1:completion | completion | path = require 'path'
async = require 'async'
underscore = require 'underscore'
{ContentPlugin} = require './../content'
{stripExtension, extend, rfc822} = require './../common'
class Page extends ContentPlugin
### page content plugin, a page is a file that has
metadata, html and a template that renders it ##... | path.join base, name
render: (locals, contents, templates, callback) ->
if @template == 'none'
# dont render
return callback null, null
async.waterfall [
(callback) =>
template = templates[@template]
if not template?
callback new Error "page '#{ @filename }' speci... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 98712ce0ad2b01ae2c5fa855d0e41d8b82c45f64 | 3,484 | https://github.com/jnordberg/wintersmith/blob/98712ce0ad2b01ae2c5fa855d0e41d8b82c45f64/src/plugins/page.coffee | 1 | 50 |
jnordberg/wintersmith:src/plugins/page.coffee:2:raw_corpus | raw_corpus | @property 'template', ->
@_metadata.template or 'none'
@property 'html', ->
@getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', ->
new Date(@_metadata.date or 0)
@property 'rfc822date', ->
rfc822 @date
@property 'intro', ->
idx = ~@html.indexOf('<span... | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 98712ce0ad2b01ae2c5fa855d0e41d8b82c45f64 | 3,484 | https://github.com/jnordberg/wintersmith/blob/98712ce0ad2b01ae2c5fa855d0e41d8b82c45f64/src/plugins/page.coffee | 51 | 77 | ||
jnordberg/wintersmith:src/plugins/page.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@property 'template', ->
@_metadata.template or 'none'
@property 'html', ->
@getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', ->
new Date(@_metadata.date or 0)
@property 'rfc822date', ->
rfc822 @date... | this.property('template', function() {
return this._metadata.template || 'none';
});
this.property('html', function() {
return this.getHtml();
});
this.property('title', function() {
return this._metadata.title || 'Untitled';
});
this.property('date', function() {
return new Date(this._metadata.date || 0);
}... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 98712ce0ad2b01ae2c5fa855d0e41d8b82c45f64 | 3,484 | https://github.com/jnordberg/wintersmith/blob/98712ce0ad2b01ae2c5fa855d0e41d8b82c45f64/src/plugins/page.coffee | 51 | 77 |
jnordberg/wintersmith:src/plugins/page.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.property('template', function() {
return this._metadata.template || 'none';
});
this.property('html', function() {
return this.getHtml();
});
this.property('title', function() {
return this._metadata.title || 'Untitled';
});
this.property('date', func... | @property 'template', ->
@_metadata.template or 'none'
@property 'html', ->
@getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', ->
new Date(@_metadata.date or 0)
@property 'rfc822date', ->
rfc822 @date
@property 'intro', ->
idx = ~@html.indexOf('<span... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 98712ce0ad2b01ae2c5fa855d0e41d8b82c45f64 | 3,484 | https://github.com/jnordberg/wintersmith/blob/98712ce0ad2b01ae2c5fa855d0e41d8b82c45f64/src/plugins/page.coffee | 51 | 77 |
jnordberg/wintersmith:src/plugins/page.coffee:2:completion | completion | @property 'template', ->
@_metadata.template or 'none'
@property 'html', ->
@getHtml()
@property 'title', ->
@_metadata.title or 'Untitled'
@property 'date', ->
new Date(@_metadata.date or 0)
@property 'rfc822date', -> | rfc822 @date
@property 'intro', ->
idx = ~@html.indexOf('<span class="more') or ~@html.indexOf('<h2')
if idx
return @html.substr 0, ~idx
else
return @html
@property 'hasMore', ->
@_hasMore ?= (@html.length > @intro.length)
return @_hasMore
module.exports = Page | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/plugins/page.coffee | MIT | 98712ce0ad2b01ae2c5fa855d0e41d8b82c45f64 | 3,484 | https://github.com/jnordberg/wintersmith/blob/98712ce0ad2b01ae2c5fa855d0e41d8b82c45f64/src/plugins/page.coffee | 51 | 77 |
kahmali/meteor-restivus:package.coffee:1:raw_corpus | raw_corpus | Package.describe
name: 'nimble:restivus'
summary: 'ReST APIs for the Best of Us! - A Meteor package for building ReSTful APIs'
version: '0.0.0'
git: 'https://github.com/krose72205/meteor-restivus.git'
Package.onUse (api) ->
# Minimum Meteor version
api.versionsFrom 'METEOR@0.9.0'
# Meteor dependencies
... | CoffeeScript | kahmali/meteor-restivus | package.coffee | MIT | 52e3d9195a6d19afb4176cf82457b572ddd27951 | 541 | https://github.com/kahmali/meteor-restivus/blob/52e3d9195a6d19afb4176cf82457b572ddd27951/package.coffee | 1 | 31 | ||
kahmali/meteor-restivus:package.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Package.describe
name: 'nimble:restivus'
summary: 'ReST APIs for the Best of Us! - A Meteor package for building ReSTful APIs'
version: '0.0.0'
git: 'https://github.com/krose72205/meteor-restivus.git'
Package.onUse (api) ->
# Minimum Meteor version
... | Package.describe({
name: 'nimble:restivus',
summary: 'ReST APIs for the Best of Us! - A Meteor package for building ReSTful APIs',
version: '0.0.0',
git: 'https://github.com/krose72205/meteor-restivus.git'
});
Package.onUse(function(api) {
// Minimum Meteor version
api.versionsFrom('METEOR@0.9.0');
// Me... | CoffeeScript | JavaScript | kahmali/meteor-restivus | package.coffee | MIT | 52e3d9195a6d19afb4176cf82457b572ddd27951 | 541 | https://github.com/kahmali/meteor-restivus/blob/52e3d9195a6d19afb4176cf82457b572ddd27951/package.coffee | 1 | 31 |
kahmali/meteor-restivus:package.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Package.describe({
name: 'nimble:restivus',
summary: 'ReST APIs for the Best of Us! - A Meteor package for building ReSTful APIs',
version: '0.0.0',
git: 'https://github.com/krose72205/meteor-restivus.git'
});
Package.onUse(function(api) {
// Minimum Met... | Package.describe
name: 'nimble:restivus'
summary: 'ReST APIs for the Best of Us! - A Meteor package for building ReSTful APIs'
version: '0.0.0'
git: 'https://github.com/krose72205/meteor-restivus.git'
Package.onUse (api) ->
# Minimum Meteor version
api.versionsFrom 'METEOR@0.9.0'
# Meteor dependencies
... | JavaScript | CoffeeScript | kahmali/meteor-restivus | package.coffee | MIT | 52e3d9195a6d19afb4176cf82457b572ddd27951 | 541 | https://github.com/kahmali/meteor-restivus/blob/52e3d9195a6d19afb4176cf82457b572ddd27951/package.coffee | 1 | 31 |
kahmali/meteor-restivus:package.coffee:1:completion | completion | Package.describe
name: 'nimble:restivus'
summary: 'ReST APIs for the Best of Us! - A Meteor package for building ReSTful APIs'
version: '0.0.0'
git: 'https://github.com/krose72205/meteor-restivus.git'
Package.onUse (api) ->
# Minimum Meteor version
api.versionsFrom 'METEOR@0.9.0'
# Meteor dependencies
... | api.use 'iron:router'
# Package files
api.addFiles 'lib/restivus.coffee', 'server'
api.addFiles 'lib/endpoint.coffee', 'server'
api.addFiles 'lib/auth.coffee', 'server'
# Export Restfully
api.export 'Restivus'
Package.onTest (api) ->
# Meteor dependencies
api.use 'tinytest'
api.use 'test-helpers'
... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | package.coffee | MIT | 52e3d9195a6d19afb4176cf82457b572ddd27951 | 541 | https://github.com/kahmali/meteor-restivus/blob/52e3d9195a6d19afb4176cf82457b572ddd27951/package.coffee | 1 | 31 |
kahmali/meteor-restivus:package.coffee:1:raw_corpus | raw_corpus | Package.describe
name: 'nimble:restivus'
summary: 'ReST APIs for the Best of Us! - A Meteor package for building ReSTful APIs'
version: '0.0.0'
git: 'https://github.com/krose72205/meteor-restivus.git'
Package.onUse (api) ->
# Minimum Meteor version
api.versionsFrom 'METEOR@0.9.0'
# Meteor dependencies
... | CoffeeScript | kahmali/meteor-restivus | package.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/package.coffee | 1 | 30 | ||
kahmali/meteor-restivus:package.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Package.describe
name: 'nimble:restivus'
summary: 'ReST APIs for the Best of Us! - A Meteor package for building ReSTful APIs'
version: '0.0.0'
git: 'https://github.com/krose72205/meteor-restivus.git'
Package.onUse (api) ->
# Minimum Meteor version
... | Package.describe({
name: 'nimble:restivus',
summary: 'ReST APIs for the Best of Us! - A Meteor package for building ReSTful APIs',
version: '0.0.0',
git: 'https://github.com/krose72205/meteor-restivus.git'
});
Package.onUse(function(api) {
// Minimum Meteor version
api.versionsFrom('METEOR@0.9.0');
// Me... | CoffeeScript | JavaScript | kahmali/meteor-restivus | package.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/package.coffee | 1 | 30 |
kahmali/meteor-restivus:package.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Package.describe({
name: 'nimble:restivus',
summary: 'ReST APIs for the Best of Us! - A Meteor package for building ReSTful APIs',
version: '0.0.0',
git: 'https://github.com/krose72205/meteor-restivus.git'
});
Package.onUse(function(api) {
// Minimum Met... | Package.describe
name: 'nimble:restivus'
summary: 'ReST APIs for the Best of Us! - A Meteor package for building ReSTful APIs'
version: '0.0.0'
git: 'https://github.com/krose72205/meteor-restivus.git'
Package.onUse (api) ->
# Minimum Meteor version
api.versionsFrom 'METEOR@0.9.0'
# Meteor dependencies
... | JavaScript | CoffeeScript | kahmali/meteor-restivus | package.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/package.coffee | 1 | 30 |
kahmali/meteor-restivus:package.coffee:1:completion | completion | Package.describe
name: 'nimble:restivus'
summary: 'ReST APIs for the Best of Us! - A Meteor package for building ReSTful APIs'
version: '0.0.0'
git: 'https://github.com/krose72205/meteor-restivus.git'
Package.onUse (api) ->
# Minimum Meteor version
api.versionsFrom 'METEOR@0.9.0'
# Meteor dependencies
... | api.use 'iron:router'
# Package files
api.addFiles 'lib/router.coffee', 'server'
api.addFiles 'lib/auth.coffee', 'server'
# Export Restfully
api.export 'Restivus'
Package.onTest (api) ->
# Meteor dependencies
api.use 'tinytest'
api.use 'test-helpers'
api.use 'nimble:restivus' | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | package.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/package.coffee | 1 | 30 |
kahmali/meteor-restivus:package.coffee:1:raw_corpus | raw_corpus | Package.describe
name: 'nimblenotes:restfully'
summary: 'A Meteor package for building ReSTful APIs - inspired by RestStop and backed by Iron Router.'
version: '0.0.0'
git: 'https://github.com/krose72205/meteor-restfully.git'
Package.onUse (api) ->
# Minimum Meteor version
api.versionsFrom 'METEOR@0.9.0'
... | CoffeeScript | kahmali/meteor-restivus | package.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/package.coffee | 1 | 30 | ||
kahmali/meteor-restivus:package.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Package.describe
name: 'nimblenotes:restfully'
summary: 'A Meteor package for building ReSTful APIs - inspired by RestStop and backed by Iron Router.'
version: '0.0.0'
git: 'https://github.com/krose72205/meteor-restfully.git'
Package.onUse (api) ->
# ... | Package.describe({
name: 'nimblenotes:restfully',
summary: 'A Meteor package for building ReSTful APIs - inspired by RestStop and backed by Iron Router.',
version: '0.0.0',
git: 'https://github.com/krose72205/meteor-restfully.git'
});
Package.onUse(function(api) {
// Minimum Meteor version
api.versionsFrom... | CoffeeScript | JavaScript | kahmali/meteor-restivus | package.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/package.coffee | 1 | 30 |
kahmali/meteor-restivus:package.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Package.describe({
name: 'nimblenotes:restfully',
summary: 'A Meteor package for building ReSTful APIs - inspired by RestStop and backed by Iron Router.',
version: '0.0.0',
git: 'https://github.com/krose72205/meteor-restfully.git'
});
Package.onUse(functio... | Package.describe
name: 'nimblenotes:restfully'
summary: 'A Meteor package for building ReSTful APIs - inspired by RestStop and backed by Iron Router.'
version: '0.0.0'
git: 'https://github.com/krose72205/meteor-restfully.git'
Package.onUse (api) ->
# Minimum Meteor version
api.versionsFrom 'METEOR@0.9.0'
... | JavaScript | CoffeeScript | kahmali/meteor-restivus | package.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/package.coffee | 1 | 30 |
kahmali/meteor-restivus:package.coffee:1:completion | completion | Package.describe
name: 'nimblenotes:restfully'
summary: 'A Meteor package for building ReSTful APIs - inspired by RestStop and backed by Iron Router.'
version: '0.0.0'
git: 'https://github.com/krose72205/meteor-restfully.git'
Package.onUse (api) ->
# Minimum Meteor version
api.versionsFrom 'METEOR@0.9.0'
... | api.use 'iron:router'
# Package files
api.addFiles 'lib/router.coffee', 'server'
api.addFiles 'lib/auth.coffee', 'server'
# Export Restfully
api.export 'Restfully'
Package.onTest (api) ->
# Meteor dependencies
api.use 'tinytest'
api.use 'test-helpers'
api.use 'nimblenotes:restfully' | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | package.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/package.coffee | 1 | 30 |
kahmali/meteor-restivus:package.coffee:1:raw_corpus | raw_corpus | Package.describe
name: 'nimblenotes:restfully'
summary: 'A Meteor package for building ReSTful APIs, backed by Iron Router.'
version: '0.0.0'
git: 'https://github.com/krose72205/meteor-restfully.git'
Package.onUse (api) ->
# Minimum Meteor version
api.versionsFrom('METEOR@1.0.2.1')
# Meteor dependencie... | CoffeeScript | kahmali/meteor-restivus | package.coffee | MIT | d4ae973335e27971b8f550c8c19ecee32f05c282 | 541 | https://github.com/kahmali/meteor-restivus/blob/d4ae973335e27971b8f550c8c19ecee32f05c282/package.coffee | 1 | 27 | ||
kahmali/meteor-restivus:package.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Package.describe
name: 'nimblenotes:restfully'
summary: 'A Meteor package for building ReSTful APIs, backed by Iron Router.'
version: '0.0.0'
git: 'https://github.com/krose72205/meteor-restfully.git'
Package.onUse (api) ->
# Minimum Meteor version
a... | Package.describe({
name: 'nimblenotes:restfully',
summary: 'A Meteor package for building ReSTful APIs, backed by Iron Router.',
version: '0.0.0',
git: 'https://github.com/krose72205/meteor-restfully.git'
});
Package.onUse(function(api) {
// Minimum Meteor version
api.versionsFrom('METEOR@1.0.2.1');
// M... | CoffeeScript | JavaScript | kahmali/meteor-restivus | package.coffee | MIT | d4ae973335e27971b8f550c8c19ecee32f05c282 | 541 | https://github.com/kahmali/meteor-restivus/blob/d4ae973335e27971b8f550c8c19ecee32f05c282/package.coffee | 1 | 27 |
kahmali/meteor-restivus:package.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Package.describe({
name: 'nimblenotes:restfully',
summary: 'A Meteor package for building ReSTful APIs, backed by Iron Router.',
version: '0.0.0',
git: 'https://github.com/krose72205/meteor-restfully.git'
});
Package.onUse(function(api) {
// Minimum Mete... | Package.describe
name: 'nimblenotes:restfully'
summary: 'A Meteor package for building ReSTful APIs, backed by Iron Router.'
version: '0.0.0'
git: 'https://github.com/krose72205/meteor-restfully.git'
Package.onUse (api) ->
# Minimum Meteor version
api.versionsFrom('METEOR@1.0.2.1')
# Meteor dependencie... | JavaScript | CoffeeScript | kahmali/meteor-restivus | package.coffee | MIT | d4ae973335e27971b8f550c8c19ecee32f05c282 | 541 | https://github.com/kahmali/meteor-restivus/blob/d4ae973335e27971b8f550c8c19ecee32f05c282/package.coffee | 1 | 27 |
kahmali/meteor-restivus:package.coffee:1:completion | completion | Package.describe
name: 'nimblenotes:restfully'
summary: 'A Meteor package for building ReSTful APIs, backed by Iron Router.'
version: '0.0.0'
git: 'https://github.com/krose72205/meteor-restfully.git'
Package.onUse (api) ->
# Minimum Meteor version
api.versionsFrom('METEOR@1.0.2.1')
# Meteor dependencie... | api.use('coffeescript')
api.use('iron:router')
# Package files
api.addFiles('restfully.coffee')
Package.onTest (api) ->
# Meteor dependencies
api.use('tinytest')
api.use('nimblenotes:restfully')
# Package test files
api.addFiles('/* Fill me in! */') | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | package.coffee | MIT | d4ae973335e27971b8f550c8c19ecee32f05c282 | 541 | https://github.com/kahmali/meteor-restivus/blob/d4ae973335e27971b8f550c8c19ecee32f05c282/package.coffee | 1 | 27 |
mojs/mojs:spec/shapes/line.coffee:1:raw_corpus | raw_corpus | Line = mojs.shapesMap.getShape('line')
Bit = mojs.shapesMap.getShape('bit')
ns = 'http://www.w3.org/2000/svg'
svg = document.createElementNS?(ns, "svg")
line = new Line ctx: svg
describe 'Line', ->
it 'should extend Bit', ->
expect(line instanceof Bit).toBe(true)
it 'should add itself to context', ->
... | CoffeeScript | mojs/mojs | spec/shapes/line.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/line.coffee | 1 | 50 | ||
mojs/mojs:spec/shapes/line.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Line = mojs.shapesMap.getShape('line')
Bit = mojs.shapesMap.getShape('bit')
ns = 'http://www.w3.org/2000/svg'
svg = document.createElementNS?(ns, "svg")
line = new Line ctx: svg
describe 'Line', ->
it 'should extend Bit', ->
expect(line instanceof... | var Bit, Line, line, ns, svg;
Line = mojs.shapesMap.getShape('line');
Bit = mojs.shapesMap.getShape('bit');
ns = 'http://www.w3.org/2000/svg';
svg = typeof document.createElementNS === "function" ? document.createElementNS(ns, "svg") : void 0;
line = new Line({
ctx: svg
});
describe('Line', function() {
it('s... | CoffeeScript | JavaScript | mojs/mojs | spec/shapes/line.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/line.coffee | 1 | 50 |
mojs/mojs:spec/shapes/line.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Bit, Line, line, ns, svg;
Line = mojs.shapesMap.getShape('line');
Bit = mojs.shapesMap.getShape('bit');
ns = 'http://www.w3.org/2000/svg';
svg = typeof document.createElementNS === "function" ? document.createElementNS(ns, "svg") : void 0;
line = new Line(... | Line = mojs.shapesMap.getShape('line')
Bit = mojs.shapesMap.getShape('bit')
ns = 'http://www.w3.org/2000/svg'
svg = document.createElementNS?(ns, "svg")
line = new Line ctx: svg
describe 'Line', ->
it 'should extend Bit', ->
expect(line instanceof Bit).toBe(true)
it 'should add itself to context', ->
... | JavaScript | CoffeeScript | mojs/mojs | spec/shapes/line.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/line.coffee | 1 | 50 |
mojs/mojs:spec/shapes/line.coffee:1:completion | completion | Line = mojs.shapesMap.getShape('line')
Bit = mojs.shapesMap.getShape('bit')
ns = 'http://www.w3.org/2000/svg'
svg = document.createElementNS?(ns, "svg")
line = new Line ctx: svg
describe 'Line', ->
it 'should extend Bit', ->
expect(line instanceof Bit).toBe(true)
it 'should add itself to context', ->
... | describe 'draw method ->', ->
it 'should add properties to el', ->
svg = document.createElementNS?(ns, "svg")
line = new Line
ctx: svg
radius: 20
line._draw()
attr1 = parseInt line.el.getAttribute('x1'), 10
attr2 = parseInt line.el.getAttribu... | CoffeeScript | CoffeeScript | mojs/mojs | spec/shapes/line.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/line.coffee | 1 | 50 |
mojs/mojs:spec/shapes/line.coffee:2:raw_corpus | raw_corpus | line = new Line ctx: svg
spyOn(Line.prototype, '_draw')
line._draw()
expect(Line.prototype._draw).toHaveBeenCalled()
describe 'getLength method', ->
it 'should calculate total length of the path', ->
bit = new Line
ctx: document.createElementNS ns, 'svg'
radiu... | CoffeeScript | mojs/mojs | spec/shapes/line.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/line.coffee | 51 | 61 | ||
mojs/mojs:spec/shapes/line.coffee:2:completion | completion | line = new Line ctx: svg
spyOn(Line.prototype, '_draw')
line._draw()
expect(Line.prototype._draw).toHaveBeenCalled() | describe 'getLength method', ->
it 'should calculate total length of the path', ->
bit = new Line
ctx: document.createElementNS ns, 'svg'
radius: 100
expect(bit._getLength()).toBe 200 | CoffeeScript | CoffeeScript | mojs/mojs | spec/shapes/line.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/line.coffee | 51 | 61 |
mojs/mojs:spec/shapes/line.coffee:2:raw_corpus | raw_corpus | line = new Line ctx: svg
spyOn(Line.__super__, '_draw')
line._draw()
expect(Line.__super__._draw).toHaveBeenCalled()
describe 'getLength method', ->
it 'should calculate total length of the path', ->
bit = new Line
ctx: document.createElementNS ns, 'svg'
radiu... | CoffeeScript | mojs/mojs | spec/shapes/line.coffee | MIT | 768850a20165488e3098a3003b153e905266dac8 | 18,698 | https://github.com/mojs/mojs/blob/768850a20165488e3098a3003b153e905266dac8/spec/shapes/line.coffee | 51 | 61 | ||
mojs/mojs:spec/shapes/line.coffee:2:completion | completion | line = new Line ctx: svg
spyOn(Line.__super__, '_draw')
line._draw()
expect(Line.__super__._draw).toHaveBeenCalled() | describe 'getLength method', ->
it 'should calculate total length of the path', ->
bit = new Line
ctx: document.createElementNS ns, 'svg'
radius: 100
expect(bit._getLength()).toBe 200 | CoffeeScript | CoffeeScript | mojs/mojs | spec/shapes/line.coffee | MIT | 768850a20165488e3098a3003b153e905266dac8 | 18,698 | https://github.com/mojs/mojs/blob/768850a20165488e3098a3003b153e905266dac8/spec/shapes/line.coffee | 51 | 61 |
xhan/qqbot:plugins/apiserver.coffee:1:raw_corpus | raw_corpus | processPost = (request, response, callback) ->
queryData = ""
return null if typeof callback isnt 'function'
request.on 'data', (data)->
queryData += data
if queryData.length > 1e6
queryData = ""
response.writeHead(413, {'Content-Type': 'text/plain'}).end();
request.conne... | CoffeeScript | xhan/qqbot | plugins/apiserver.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/plugins/apiserver.coffee | 40 | 55 | ||
xhan/qqbot:plugins/apiserver.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
processPost = (request, response, callback) ->
queryData = ""
return null if typeof callback isnt 'function'
request.on 'data', (data)->
queryData += data
if queryData.length > 1e6
queryData = ""
response.writeHead(413, {'C... | var processPost;
processPost = function(request, response, callback) {
var queryData;
queryData = "";
if (typeof callback !== 'function') {
return null;
}
request.on('data', function(data) {
queryData += data;
if (queryData.length > 1e6) {
queryData = "";
response.writeHead(413, {
... | CoffeeScript | JavaScript | xhan/qqbot | plugins/apiserver.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/plugins/apiserver.coffee | 40 | 55 |
xhan/qqbot:plugins/apiserver.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var processPost;
processPost = function(request, response, callback) {
var queryData;
queryData = "";
if (typeof callback !== 'function') {
return null;
}
request.on('data', function(data) {
queryData += data;
if (queryData.length > 1e6) {
... | processPost = (request, response, callback) ->
queryData = ""
return null if typeof callback isnt 'function'
request.on 'data', (data)->
queryData += data
if queryData.length > 1e6
queryData = ""
response.writeHead(413, {'Content-Type': 'text/plain'}).end();
request.conne... | JavaScript | CoffeeScript | xhan/qqbot | plugins/apiserver.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/plugins/apiserver.coffee | 40 | 55 |
xhan/qqbot:plugins/apiserver.coffee:1:completion | completion | processPost = (request, response, callback) ->
queryData = ""
return null if typeof callback isnt 'function'
request.on 'data', (data)->
queryData += data
if queryData.length > 1e6
queryData = ""
response.writeHead(413, {'Content-Type': 'text/plain'}).end(); | request.connection.destroy();
request.on 'end', ->
data = querystring.parse(queryData)
callback(data)
request.on 'error', (error)->
callback(null, error) | CoffeeScript | CoffeeScript | xhan/qqbot | plugins/apiserver.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/plugins/apiserver.coffee | 40 | 55 |
xhan/qqbot:plugins/apiserver.coffee:2:raw_corpus | raw_corpus | class APIServer
constructor:(@qqbot)->
config = @qqbot.config
@http_server = null
[@port, @token] = [config.api_port, config.api_token]
start: ->
@http_server = @create_server(@port)
stop: ->
@http_server.close() if @http_server
@http_server = null
log.info "aip server stoped"
crea... | CoffeeScript | xhan/qqbot | plugins/apiserver.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/plugins/apiserver.coffee | 58 | 107 | ||
xhan/qqbot:plugins/apiserver.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class APIServer
constructor:(@qqbot)->
config = @qqbot.config
@http_server = null
[@port, @token] = [config.api_port, config.api_token]
start: ->
@http_server = @create_server(@port)
stop: ->
@http_server.close() if @http_server
@ht... | var APIServer;
APIServer = class APIServer {
constructor(qqbot) {
var config;
this.qqbot = qqbot;
config = this.qqbot.config;
this.http_server = null;
[this.port, this.token] = [config.api_port, config.api_token];
}
start() {
return this.http_server = this.create_server(this.port);
}
... | CoffeeScript | JavaScript | xhan/qqbot | plugins/apiserver.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/plugins/apiserver.coffee | 58 | 107 |
xhan/qqbot:plugins/apiserver.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var APIServer;
APIServer = class APIServer {
constructor(qqbot) {
var config;
this.qqbot = qqbot;
config = this.qqbot.config;
this.http_server = null;
[this.port, this.token] = [config.api_port, config.api_token];
}
start() {
return ... | class APIServer
constructor:(@qqbot)->
config = @qqbot.config
@http_server = null
[@port, @token] = [config.api_port, config.api_token]
start: ->
@http_server = @create_server(@port)
stop: ->
@http_server.close() if @http_server
@http_server = null
log.info "aip server stoped"
crea... | JavaScript | CoffeeScript | xhan/qqbot | plugins/apiserver.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/plugins/apiserver.coffee | 58 | 107 |
xhan/qqbot:plugins/apiserver.coffee:2:completion | completion | class APIServer
constructor:(@qqbot)->
config = @qqbot.config
@http_server = null
[@port, @token] = [config.api_port, config.api_token]
start: ->
@http_server = @create_server(@port)
stop: ->
@http_server.close() if @http_server
@http_server = null
log.info "aip server stoped"
crea... | server.listen port
log.info 'api server started at port',port
return server
handle_request: (req,res,path,params)->
res.endjson = (dict={})->
ret_dict =
err: 0
msg: 'ok'
for key,value of dict
ret_dict[key] = value
res.writeHead 200
res.end jsons ret_dict
... | CoffeeScript | CoffeeScript | xhan/qqbot | plugins/apiserver.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/plugins/apiserver.coffee | 58 | 107 |
xhan/qqbot:plugins/apiserver.coffee:3:raw_corpus | raw_corpus | else res.endjson {err:404,msg:'request not fits'}
on_stdin : (req,res,params)->
value = params.value.trim()
log.info 'stdin value',value
process.emit 'data', value
res.endjson()
on_reload_plugin : (req,res,params)->
res.endjson {err:1, msg:"method unimplemented"}
on_sendmsg : (req,res,para... | CoffeeScript | xhan/qqbot | plugins/apiserver.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/plugins/apiserver.coffee | 108 | 157 | ||
xhan/qqbot:plugins/apiserver.coffee:3:completion | completion | else res.endjson {err:404,msg:'request not fits'}
on_stdin : (req,res,params)->
value = params.value.trim()
log.info 'stdin value',value
process.emit 'data', value
res.endjson()
on_reload_plugin : (req,res,params)->
res.endjson {err:1, msg:"method unimplemented"}
on_sendmsg : (req,res,para... | group = params.to
else
group = @qqbot.get_group {name:params.to}
@qqbot.send_message_to_group group, params.msg, (ret,e)->
resp_ret = {result:ret}
if e
resp_ret.err = 1
resp_ret.msg = "#{e}"
res.endjson resp_ret
else if params.type == 'discuss'
... | CoffeeScript | CoffeeScript | xhan/qqbot | plugins/apiserver.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/plugins/apiserver.coffee | 108 | 157 |
xhan/qqbot:plugins/apiserver.coffee:5:raw_corpus | raw_corpus | exports.init = (qqbot)->
api_server = new APIServer(qqbot)
api_server.start(); | CoffeeScript | xhan/qqbot | plugins/apiserver.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/plugins/apiserver.coffee | 165 | 167 | ||
xhan/qqbot:plugins/apiserver.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.init = (qqbot)->
api_server = new APIServer(qqbot)
api_server.start();
``` | exports.init = function(qqbot) {
var api_server;
api_server = new APIServer(qqbot);
return api_server.start();
}; | CoffeeScript | JavaScript | xhan/qqbot | plugins/apiserver.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/plugins/apiserver.coffee | 165 | 167 |
xhan/qqbot:plugins/apiserver.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.init = function(qqbot) {
var api_server;
api_server = new APIServer(qqbot);
return api_server.start();
};
``` | exports.init = (qqbot)->
api_server = new APIServer(qqbot)
api_server.start(); | JavaScript | CoffeeScript | xhan/qqbot | plugins/apiserver.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/plugins/apiserver.coffee | 165 | 167 |
xhan/qqbot:plugins/apiserver.coffee:3:raw_corpus | raw_corpus | else res.endjson {err:404,msg:'request not fits'}
on_stdin : (req,res,params)->
value = params.value.trim()
log.info 'stdin value',value
process.emit 'data', value
res.endjson()
on_reload_plugin : (req,res,params)->
res.endjson {err:1, msg:"method unimplemented"}
on_sendmsg : (req,res,para... | CoffeeScript | xhan/qqbot | plugins/apiserver.coffee | MIT | 8a0fa13bb482eef23278befd59a80a74bdac880b | 1,435 | https://github.com/xhan/qqbot/blob/8a0fa13bb482eef23278befd59a80a74bdac880b/plugins/apiserver.coffee | 108 | 157 | ||
xhan/qqbot:plugins/apiserver.coffee:3:completion | completion | else res.endjson {err:404,msg:'request not fits'}
on_stdin : (req,res,params)->
value = params.value.trim()
log.info 'stdin value',value
process.emit 'data', value
res.endjson()
on_reload_plugin : (req,res,params)->
res.endjson {err:1, msg:"method unimplemented"}
on_sendmsg : (req,res,para... | resp_ret.msg = "#{e}"
res.endjson resp_ret
else if params.type == 'discuss'
discuss_group = @qqbot.get_dgroup {name:params.to}
unless discuss_group
res.endjson {err:501, msg:"can't find discuss by name #{params.to}"}
return
@qqbot.send_message_to_discuss discuss_group.did,... | CoffeeScript | CoffeeScript | xhan/qqbot | plugins/apiserver.coffee | MIT | 8a0fa13bb482eef23278befd59a80a74bdac880b | 1,435 | https://github.com/xhan/qqbot/blob/8a0fa13bb482eef23278befd59a80a74bdac880b/plugins/apiserver.coffee | 108 | 157 |
xhan/qqbot:plugins/apiserver.coffee:3:raw_corpus | raw_corpus | on_stdin : (req,res,params)->
value = params.value.trim()
log.info 'stdin value',value
process.emit 'data', value
res.endjson()
on_reload_plugin : (req,res,params)->
res.endjson {err:1, msg:"method unimplemented"}
on_sendmsg : (req,res,params)->
log.info "will send #{params.type} #{params.... | CoffeeScript | xhan/qqbot | plugins/apiserver.coffee | MIT | 3cb0f5ed3628d3834aa86dc79215595f2d651156 | 1,435 | https://github.com/xhan/qqbot/blob/3cb0f5ed3628d3834aa86dc79215595f2d651156/plugins/apiserver.coffee | 108 | 156 | ||
xhan/qqbot:plugins/apiserver.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
on_stdin : (req,res,params)->
value = params.value.trim()
log.info 'stdin value',value
process.emit 'data', value
res.endjson()
on_reload_plugin : (req,res,params)->
res.endjson {err:1, msg:"method unimplemented"}
on_sendmsg : (req,res,p... | var api_server;
({
on_stdin: function(req, res, params) {
var value;
value = params.value.trim();
log.info('stdin value', value);
process.emit('data', value);
return res.endjson();
},
on_reload_plugin: function(req, res, params) {
return res.endjson({
err: 1,
msg: "method unim... | CoffeeScript | JavaScript | xhan/qqbot | plugins/apiserver.coffee | MIT | 3cb0f5ed3628d3834aa86dc79215595f2d651156 | 1,435 | https://github.com/xhan/qqbot/blob/3cb0f5ed3628d3834aa86dc79215595f2d651156/plugins/apiserver.coffee | 108 | 156 |
xhan/qqbot:plugins/apiserver.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var api_server;
({
on_stdin: function(req, res, params) {
var value;
value = params.value.trim();
log.info('stdin value', value);
process.emit('data', value);
return res.endjson();
},
on_reload_plugin: function(req, res, params) {
ret... | on_stdin : (req,res,params)->
value = params.value.trim()
log.info 'stdin value',value
process.emit 'data', value
res.endjson()
on_reload_plugin : (req,res,params)->
res.endjson {err:1, msg:"method unimplemented"}
on_sendmsg : (req,res,params)->
log.info "will send #{params.type} #{params.... | JavaScript | CoffeeScript | xhan/qqbot | plugins/apiserver.coffee | MIT | 3cb0f5ed3628d3834aa86dc79215595f2d651156 | 1,435 | https://github.com/xhan/qqbot/blob/3cb0f5ed3628d3834aa86dc79215595f2d651156/plugins/apiserver.coffee | 108 | 156 |
xhan/qqbot:plugins/apiserver.coffee:3:completion | completion | on_stdin : (req,res,params)->
value = params.value.trim()
log.info 'stdin value',value
process.emit 'data', value
res.endjson()
on_reload_plugin : (req,res,params)->
res.endjson {err:1, msg:"method unimplemented"}
on_sendmsg : (req,res,params)->
log.info "will send #{params.type} #{params.... | res.endjson resp_ret
else if params.type == 'discuss'
discuss_group = @qqbot.get_dgroup {name:params.to}
unless discuss_group
res.endjson {err:501, msg:"can't find discuss by name #{params.to}"}
return
@qqbot.send_message_to_discuss discuss_group.did, params.msg, (ret,e)->
... | CoffeeScript | CoffeeScript | xhan/qqbot | plugins/apiserver.coffee | MIT | 3cb0f5ed3628d3834aa86dc79215595f2d651156 | 1,435 | https://github.com/xhan/qqbot/blob/3cb0f5ed3628d3834aa86dc79215595f2d651156/plugins/apiserver.coffee | 108 | 156 |
xhan/qqbot:plugins/apiserver.coffee:1:raw_corpus | raw_corpus | processPost = (request, response, callback) ->
queryData = ""
return null if typeof callback isnt 'function'
request.on 'data', (data)->
queryData += data
if queryData.length > 1e6
queryData = ""
response.writeHead(413, {'Content-Type': 'text/plain'}).end();
request.conne... | CoffeeScript | xhan/qqbot | plugins/apiserver.coffee | MIT | 6e3b13406fa75d37d27f8d8f633da808c6ded5d4 | 1,435 | https://github.com/xhan/qqbot/blob/6e3b13406fa75d37d27f8d8f633da808c6ded5d4/plugins/apiserver.coffee | 40 | 55 | ||
xhan/qqbot:plugins/apiserver.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
processPost = (request, response, callback) ->
queryData = ""
return null if typeof callback isnt 'function'
request.on 'data', (data)->
queryData += data
if queryData.length > 1e6
queryData = ""
response.writeHead(413, {'C... | var processPost;
processPost = function(request, response, callback) {
var queryData;
queryData = "";
if (typeof callback !== 'function') {
return null;
}
request.on('data', function(data) {
queryData += data;
if (queryData.length > 1e6) {
queryData = "";
response.writeHead(413, {
... | CoffeeScript | JavaScript | xhan/qqbot | plugins/apiserver.coffee | MIT | 6e3b13406fa75d37d27f8d8f633da808c6ded5d4 | 1,435 | https://github.com/xhan/qqbot/blob/6e3b13406fa75d37d27f8d8f633da808c6ded5d4/plugins/apiserver.coffee | 40 | 55 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.