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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
soyjavi/QuoJS:src/quo.output.coffee:1:raw_corpus | raw_corpus | ###
QuoJS 2.2.0
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
$$.fn.text = (value) ->
if value or $$.toType(value) is "number"
@each -> @textContent = value
else
@[0].textContent
$$.fn.html = (value) ->
type = $$.toType(v... | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | e640f494375e859b542ad25aaa2b6f7682ab941b | 2,055 | https://github.com/soyjavi/QuoJS/blob/e640f494375e859b542ad25aaa2b6f7682ab941b/src/quo.output.coffee | 1 | 50 | ||
soyjavi/QuoJS:src/quo.output.coffee:1:completion | completion | ###
QuoJS 2.2.0
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
$$.fn.text = (value) ->
if value or $$.toType(value) is "number"
@each -> @textContent = value
else
@[0].textContent
$$.fn.html = (value) ->
type = $$.toType(v... | $$.fn.append = (value) ->
@each ->
if $$.toType(value) is "string"
if value
@appendChild _createElement(value)
else
@insertBefore value
$$.fn.prepend = (value) ->
@each ->
if $$.toType(value) is "string"
... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | e640f494375e859b542ad25aaa2b6f7682ab941b | 2,055 | https://github.com/soyjavi/QuoJS/blob/e640f494375e859b542ad25aaa2b6f7682ab941b/src/quo.output.coffee | 1 | 50 |
soyjavi/QuoJS:src/quo.output.coffee:2:raw_corpus | raw_corpus | $$.fn.empty = () ->
@each ->
@innerHTML = null
return
_createElement = (content) ->
div = document.createElement("div")
div.innerHTML = content
div.firstChild
return
) Quo | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | e640f494375e859b542ad25aaa2b6f7682ab941b | 2,055 | https://github.com/soyjavi/QuoJS/blob/e640f494375e859b542ad25aaa2b6f7682ab941b/src/quo.output.coffee | 51 | 63 | ||
soyjavi/QuoJS:src/quo.output.coffee:2:completion | completion | $$.fn.empty = () ->
@each ->
@innerHTML = null
return
_createElement = (content) -> | div = document.createElement("div")
div.innerHTML = content
div.firstChild
return
) Quo | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | e640f494375e859b542ad25aaa2b6f7682ab941b | 2,055 | https://github.com/soyjavi/QuoJS/blob/e640f494375e859b542ad25aaa2b6f7682ab941b/src/quo.output.coffee | 51 | 63 |
soyjavi/QuoJS:src/quo.output.coffee:1:raw_corpus | raw_corpus | ###
QuoJS 2.1
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
$$.fn.text = (value) ->
if value or $$.toType(value) is "number"
@each -> @textContent = value
else
@[0].textContent
$$.fn.html = (value) ->
type = $$.toType(val... | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 03e557d3d9e3f80fff9b2d36ba0262d0b84087f8 | 2,055 | https://github.com/soyjavi/QuoJS/blob/03e557d3d9e3f80fff9b2d36ba0262d0b84087f8/src/quo.output.coffee | 1 | 50 | ||
soyjavi/QuoJS:src/quo.output.coffee:1:completion | completion | ###
QuoJS 2.1
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
$$.fn.text = (value) ->
if value or $$.toType(value) is "number"
@each -> @textContent = value
else
@[0].textContent
$$.fn.html = (value) ->
type = $$.toType(val... | $$.fn.append = (value) ->
@each ->
if $$.toType(value) is "string"
if value
@appendChild _createElement(value)
else
@insertBefore value
$$.fn.prepend = (value) ->
@each ->
if $$.toType(value) is "string"
... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 03e557d3d9e3f80fff9b2d36ba0262d0b84087f8 | 2,055 | https://github.com/soyjavi/QuoJS/blob/03e557d3d9e3f80fff9b2d36ba0262d0b84087f8/src/quo.output.coffee | 1 | 50 |
soyjavi/QuoJS:src/quo.output.coffee:1:raw_corpus | raw_corpus | ###
QuoJS 2.1
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
$$.fn.text = (value) ->
if (not value)
@[0].textContent
else
@each ->
@textContent = value
$$.fn.html = (value) ->
type = $$.toType(value)
... | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 23a7d2a9ca5021c98345eb324d937550c8e568c0 | 2,055 | https://github.com/soyjavi/QuoJS/blob/23a7d2a9ca5021c98345eb324d937550c8e568c0/src/quo.output.coffee | 1 | 50 | ||
soyjavi/QuoJS:src/quo.output.coffee:1:completion | completion | ###
QuoJS 2.1
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
$$.fn.text = (value) ->
if (not value)
@[0].textContent
else
@each ->
@textContent = value
$$.fn.html = (value) ->
type = $$.toType(value)
... | $$.fn.append = (value) ->
@each ->
if $$.toType(value) is "string"
if value
@appendChild _createElement(value)
else
@insertBefore value
$$.fn.prepend = (value) ->
@each ->
if $$.toType(value) is "string"
... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 23a7d2a9ca5021c98345eb324d937550c8e568c0 | 2,055 | https://github.com/soyjavi/QuoJS/blob/23a7d2a9ca5021c98345eb324d937550c8e568c0/src/quo.output.coffee | 1 | 50 |
soyjavi/QuoJS:src/quo.output.coffee:1:raw_corpus | raw_corpus | ###
QuoJS 2.1
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
$$.fn.text = (value) ->
if (not value)
@[0].textContent
else
@each ->
@textContent = value
$$.fn.html = (value) ->
type = $$.toType(value)
... | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 1da999ce945292920a46d911c008b68b14fff16f | 2,055 | https://github.com/soyjavi/QuoJS/blob/1da999ce945292920a46d911c008b68b14fff16f/src/quo.output.coffee | 1 | 50 | ||
soyjavi/QuoJS:src/quo.output.coffee:1:completion | completion | ###
QuoJS 2.1
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
$$.fn.text = (value) ->
if (not value)
@[0].textContent
else
@each ->
@textContent = value
$$.fn.html = (value) ->
type = $$.toType(value)
... | @[0].innerHTML
$$.fn.append = (value) ->
@each ->
if $$.toType(value) is "string"
if value
@appendChild _createElement(value)
else
@insertBefore value
$$.fn.prepend = (value) ->
@each ->
if $$.toType(value)... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 1da999ce945292920a46d911c008b68b14fff16f | 2,055 | https://github.com/soyjavi/QuoJS/blob/1da999ce945292920a46d911c008b68b14fff16f/src/quo.output.coffee | 1 | 50 |
soyjavi/QuoJS:src/quo.output.coffee:2:raw_corpus | raw_corpus | $$(@).remove()
$$.fn.empty = () ->
@each ->
@innerHTML = null
return
_createElement = (content) ->
div = document.createElement("div")
div.innerHTML = content
div.firstChild
return
) Quo | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 1da999ce945292920a46d911c008b68b14fff16f | 2,055 | https://github.com/soyjavi/QuoJS/blob/1da999ce945292920a46d911c008b68b14fff16f/src/quo.output.coffee | 51 | 64 | ||
soyjavi/QuoJS:src/quo.output.coffee:2:completion | completion | $$(@).remove()
$$.fn.empty = () ->
@each ->
@innerHTML = null
return | _createElement = (content) ->
div = document.createElement("div")
div.innerHTML = content
div.firstChild
return
) Quo | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 1da999ce945292920a46d911c008b68b14fff16f | 2,055 | https://github.com/soyjavi/QuoJS/blob/1da999ce945292920a46d911c008b68b14fff16f/src/quo.output.coffee | 51 | 64 |
soyjavi/QuoJS:src/quo.output.coffee:1:raw_corpus | raw_corpus | ###
QuoJS 2.1
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
$$.fn.text = (value) ->
if (not value)
@[0].textContent
else
@each ->
@textContent = value
$$.fn.html = (value) ->
type = $$.toType(value)
... | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 27a6117dbd521ad5d555abf20e120556c6000301 | 2,055 | https://github.com/soyjavi/QuoJS/blob/27a6117dbd521ad5d555abf20e120556c6000301/src/quo.output.coffee | 1 | 50 | ||
soyjavi/QuoJS:src/quo.output.coffee:1:completion | completion | ###
QuoJS 2.1
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
$$.fn.text = (value) ->
if (not value)
@[0].textContent
else
@each ->
@textContent = value
$$.fn.html = (value) ->
type = $$.toType(value)
... | if value
@appendChild _createElement(value)
else
@insertBefore value
$$.fn.prepend = (value) ->
@each ->
if $$.toType(value) is "string"
@innerHTML = value + @innerHTML
else
parent = @parentNode
... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 27a6117dbd521ad5d555abf20e120556c6000301 | 2,055 | https://github.com/soyjavi/QuoJS/blob/27a6117dbd521ad5d555abf20e120556c6000301/src/quo.output.coffee | 1 | 50 |
soyjavi/QuoJS:src/quo.output.coffee:2:raw_corpus | raw_corpus | return
_createElement = (content) ->
div = document.createElement("div")
div.innerHTML = content
div.firstChild
return
) Quo | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 27a6117dbd521ad5d555abf20e120556c6000301 | 2,055 | https://github.com/soyjavi/QuoJS/blob/27a6117dbd521ad5d555abf20e120556c6000301/src/quo.output.coffee | 51 | 59 | ||
soyjavi/QuoJS:src/quo.output.coffee:2:completion | completion | return
_createElement = (content) ->
div = document.createElement("div") | div.innerHTML = content
div.firstChild
return
) Quo | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 27a6117dbd521ad5d555abf20e120556c6000301 | 2,055 | https://github.com/soyjavi/QuoJS/blob/27a6117dbd521ad5d555abf20e120556c6000301/src/quo.output.coffee | 51 | 59 |
soyjavi/QuoJS:src/quo.output.coffee:1:raw_corpus | raw_corpus | ###
QuoJS 2.0
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
$$.fn.text = (value) ->
if (not value)
@[0].textContent
else
@each ->
@textContent = value
$$.fn.html = (value) ->
type = $$.toType(value)
... | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | ee7d2563643a024168125f440f9a72f316b269b6 | 2,055 | https://github.com/soyjavi/QuoJS/blob/ee7d2563643a024168125f440f9a72f316b269b6/src/quo.output.coffee | 1 | 50 | ||
soyjavi/QuoJS:src/quo.output.coffee:1:completion | completion | ###
QuoJS 2.0
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
$$.fn.text = (value) ->
if (not value)
@[0].textContent
else
@each ->
@textContent = value
$$.fn.html = (value) ->
type = $$.toType(value)
... | if value
@appendChild _createElement(value)
else
@insertBefore value
$$.fn.prepend = (value) ->
@each ->
if $$.toType(value) is "string"
@innerHTML = value + @innerHTML
else
parent = @parentNode
... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | ee7d2563643a024168125f440f9a72f316b269b6 | 2,055 | https://github.com/soyjavi/QuoJS/blob/ee7d2563643a024168125f440f9a72f316b269b6/src/quo.output.coffee | 1 | 50 |
soyjavi/QuoJS:src/quo.output.coffee:1:raw_corpus | raw_corpus | ###
QuoJS 2.0
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
$$.fn.text = (value) ->
if (not value)
@[0].textContent
else
@each ->
@textContent = value
$$.fn.html = (value) ->
type = $$.toType(value)
... | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 1315b1680be248ed45fdcb04fca31662a7617c65 | 2,055 | https://github.com/soyjavi/QuoJS/blob/1315b1680be248ed45fdcb04fca31662a7617c65/src/quo.output.coffee | 1 | 50 | ||
soyjavi/QuoJS:src/quo.output.coffee:1:completion | completion | ###
QuoJS 2.0
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
$$.fn.text = (value) ->
if (not value)
@[0].textContent
else
@each ->
@textContent = value
$$.fn.html = (value) ->
type = $$.toType(value)
... | if value
@appendChild _createElement(value)
else
@insertBefore value
$$.fn.prepend = (value) ->
@each ->
if $$.toType(value) is "string"
@innerHTML = value + @innerHTML
else
parent = @parentNode
... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 1315b1680be248ed45fdcb04fca31662a7617c65 | 2,055 | https://github.com/soyjavi/QuoJS/blob/1315b1680be248ed45fdcb04fca31662a7617c65/src/quo.output.coffee | 1 | 50 |
soyjavi/QuoJS:src/quo.output.coffee:2:raw_corpus | raw_corpus | div = document.createElement("div")
div.innerHTML = content
div.firstChild
return
) Quo | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 1315b1680be248ed45fdcb04fca31662a7617c65 | 2,055 | https://github.com/soyjavi/QuoJS/blob/1315b1680be248ed45fdcb04fca31662a7617c65/src/quo.output.coffee | 51 | 56 | ||
soyjavi/QuoJS:src/quo.output.coffee:1:raw_corpus | raw_corpus | ###
QuoJS 2.0
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
$$.fn.text = (value) ->
if (not value)
@[0].textContent
else
@each ->
@textContent = value
$$.fn.html = (value) ->
type = $$.toType(value)
... | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 274f0810dbe2bd9131880026e51eda660fc82976 | 2,055 | https://github.com/soyjavi/QuoJS/blob/274f0810dbe2bd9131880026e51eda660fc82976/src/quo.output.coffee | 1 | 50 | ||
soyjavi/QuoJS:src/quo.output.coffee:1:completion | completion | ###
QuoJS 2.0
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
$$.fn.text = (value) ->
if (not value)
@[0].textContent
else
@each ->
@textContent = value
$$.fn.html = (value) ->
type = $$.toType(value)
... | if value
@appendChild _createElement(value)
else
@insertBefore value
$$.fn.prepend = (value) ->
@each ->
if $$.toType(value) is "string"
@innerHTML = value + @innerHTML
else
parent = @parentNode
... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 274f0810dbe2bd9131880026e51eda660fc82976 | 2,055 | https://github.com/soyjavi/QuoJS/blob/274f0810dbe2bd9131880026e51eda660fc82976/src/quo.output.coffee | 1 | 50 |
soyjavi/QuoJS:src/quo.output.coffee:2:raw_corpus | raw_corpus | div.innerHTML = content
div.firstChild
return
) Quo | CoffeeScript | soyjavi/QuoJS | src/quo.output.coffee | MIT | 274f0810dbe2bd9131880026e51eda660fc82976 | 2,055 | https://github.com/soyjavi/QuoJS/blob/274f0810dbe2bd9131880026e51eda660fc82976/src/quo.output.coffee | 51 | 55 | ||
octoblu/meshblu:lib/generateAndStoreToken.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
generateAndStoreToken = (ownerDevice, message, callback=_.noop, dependencies={}) =>
Device = dependencies.Device ? require('./models/device')
getDevice = dependencies.getDevice ? require('./getDevice')
securityImpl = dependencies.securityImpl ? require('./getSecurityImpl')
{uuid, tag} = me... | CoffeeScript | octoblu/meshblu | lib/generateAndStoreToken.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/lib/generateAndStoreToken.coffee | 1 | 24 | ||
octoblu/meshblu:lib/generateAndStoreToken.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
generateAndStoreToken = (ownerDevice, message, callback=_.noop, dependencies={}) =>
Device = dependencies.Device ? require('./models/device')
getDevice = dependencies.getDevice ? require('./getDevice')
securityImpl = dependencies.secur... | var _, generateAndStoreToken;
_ = require('lodash');
generateAndStoreToken = (ownerDevice, message, callback = _.noop, dependencies = {}) => {
var Device, getDevice, ref, ref1, ref2, securityImpl, tag, uuid;
Device = (ref = dependencies.Device) != null ? ref : require('./models/device');
getDevice = (ref1 = dep... | CoffeeScript | JavaScript | octoblu/meshblu | lib/generateAndStoreToken.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/lib/generateAndStoreToken.coffee | 1 | 24 |
octoblu/meshblu:lib/generateAndStoreToken.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _, generateAndStoreToken;
_ = require('lodash');
generateAndStoreToken = (ownerDevice, message, callback = _.noop, dependencies = {}) => {
var Device, getDevice, ref, ref1, ref2, securityImpl, tag, uuid;
Device = (ref = dependencies.Device) != null ? ref ... | _ = require 'lodash'
generateAndStoreToken = (ownerDevice, message, callback=_.noop, dependencies={}) =>
Device = dependencies.Device ? require('./models/device')
getDevice = dependencies.getDevice ? require('./getDevice')
securityImpl = dependencies.securityImpl ? require('./getSecurityImpl')
{uuid, tag} = me... | JavaScript | CoffeeScript | octoblu/meshblu | lib/generateAndStoreToken.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/lib/generateAndStoreToken.coffee | 1 | 24 |
octoblu/meshblu:lib/generateAndStoreToken.coffee:1:completion | completion | _ = require 'lodash'
generateAndStoreToken = (ownerDevice, message, callback=_.noop, dependencies={}) =>
Device = dependencies.Device ? require('./models/device')
getDevice = dependencies.getDevice ? require('./getDevice')
securityImpl = dependencies.securityImpl ? require('./getSecurityImpl')
{uuid, tag} = me... | return callback new Error('unauthorized') unless permission
device = new Device {uuid}
token = device.generateToken()
storeTokenOptions = {token}
storeTokenOptions.tag = tag if tag?
device.storeToken storeTokenOptions, (error) =>
return callback error if error?
callback n... | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/generateAndStoreToken.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/lib/generateAndStoreToken.coffee | 1 | 24 |
octoblu/meshblu:lib/generateAndStoreToken.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
generateAndStoreToken = (ownerDevice, targetUuid, callback=_.noop, dependencies={}) =>
Device = dependencies.Device ? require('./models/device')
getDevice = dependencies.getDevice ? require('./getDevice')
securityImpl = dependencies.securityImpl ? require('./getSecurityImpl')
getDevice ta... | CoffeeScript | octoblu/meshblu | lib/generateAndStoreToken.coffee | MIT | 570d4f4280f91848309ce5ab47bcd872eb24a557 | 815 | https://github.com/octoblu/meshblu/blob/570d4f4280f91848309ce5ab47bcd872eb24a557/lib/generateAndStoreToken.coffee | 1 | 21 | ||
octoblu/meshblu:lib/generateAndStoreToken.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
generateAndStoreToken = (ownerDevice, targetUuid, callback=_.noop, dependencies={}) =>
Device = dependencies.Device ? require('./models/device')
getDevice = dependencies.getDevice ? require('./getDevice')
securityImpl = dependencies.se... | var _, generateAndStoreToken;
_ = require('lodash');
generateAndStoreToken = (ownerDevice, targetUuid, callback = _.noop, dependencies = {}) => {
var Device, getDevice, ref, ref1, ref2, securityImpl;
Device = (ref = dependencies.Device) != null ? ref : require('./models/device');
getDevice = (ref1 = dependencie... | CoffeeScript | JavaScript | octoblu/meshblu | lib/generateAndStoreToken.coffee | MIT | 570d4f4280f91848309ce5ab47bcd872eb24a557 | 815 | https://github.com/octoblu/meshblu/blob/570d4f4280f91848309ce5ab47bcd872eb24a557/lib/generateAndStoreToken.coffee | 1 | 21 |
octoblu/meshblu:lib/generateAndStoreToken.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _, generateAndStoreToken;
_ = require('lodash');
generateAndStoreToken = (ownerDevice, targetUuid, callback = _.noop, dependencies = {}) => {
var Device, getDevice, ref, ref1, ref2, securityImpl;
Device = (ref = dependencies.Device) != null ? ref : requir... | _ = require 'lodash'
generateAndStoreToken = (ownerDevice, targetUuid, callback=_.noop, dependencies={}) =>
Device = dependencies.Device ? require('./models/device')
getDevice = dependencies.getDevice ? require('./getDevice')
securityImpl = dependencies.securityImpl ? require('./getSecurityImpl')
getDevice ta... | JavaScript | CoffeeScript | octoblu/meshblu | lib/generateAndStoreToken.coffee | MIT | 570d4f4280f91848309ce5ab47bcd872eb24a557 | 815 | https://github.com/octoblu/meshblu/blob/570d4f4280f91848309ce5ab47bcd872eb24a557/lib/generateAndStoreToken.coffee | 1 | 21 |
octoblu/meshblu:lib/generateAndStoreToken.coffee:1:completion | completion | _ = require 'lodash'
generateAndStoreToken = (ownerDevice, targetUuid, callback=_.noop, dependencies={}) =>
Device = dependencies.Device ? require('./models/device')
getDevice = dependencies.getDevice ? require('./getDevice')
securityImpl = dependencies.securityImpl ? require('./getSecurityImpl')
getDevice ta... | securityImpl.canConfigure ownerDevice, targetDevice, (error, permission) =>
return callback new Error('unauthorized') unless permission
device = new Device uuid: targetUuid
token = device.generateToken()
device.storeToken token, (error) =>
return callback error if error?
callba... | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/generateAndStoreToken.coffee | MIT | 570d4f4280f91848309ce5ab47bcd872eb24a557 | 815 | https://github.com/octoblu/meshblu/blob/570d4f4280f91848309ce5ab47bcd872eb24a557/lib/generateAndStoreToken.coffee | 1 | 21 |
Glavin001/atom-beautify:src/beautifiers/sqlformat.coffee:1:raw_corpus | raw_corpus | ###
Requires https://github.com/andialbrecht/sqlparse
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Sqlformat extends Beautifier
name: "sqlformat"
link: "https://github.com/andialbrecht/sqlparse"
isPreInstalled: false
options: {
SQL: true
}
beautify: (text, language, o... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/sqlformat.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/sqlformat.coffee | 1 | 26 | ||
Glavin001/atom-beautify:src/beautifiers/sqlformat.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
Requires https://github.com/andialbrecht/sqlparse
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Sqlformat extends Beautifier
name: "sqlformat"
link: "https://github.com/andialbrecht/sqlparse"
isPreInstalled: false
opt... | /*
Requires https://github.com/andialbrecht/sqlparse
*/
"use strict";
var Beautifier, Sqlformat;
Beautifier = require('./beautifier');
module.exports = Sqlformat = (function() {
class Sqlformat extends Beautifier {
beautify(text, language, options) {
return this.run("sqlformat", [this.tempFile("input", te... | CoffeeScript | JavaScript | Glavin001/atom-beautify | src/beautifiers/sqlformat.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/sqlformat.coffee | 1 | 26 |
Glavin001/atom-beautify:src/beautifiers/sqlformat.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
Requires https://github.com/andialbrecht/sqlparse
*/
"use strict";
var Beautifier, Sqlformat;
Beautifier = require('./beautifier');
module.exports = Sqlformat = (function() {
class Sqlformat extends Beautifier {
beautify(text, language, options) {
... | ###
Requires https://github.com/andialbrecht/sqlparse
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Sqlformat extends Beautifier
name: "sqlformat"
link: "https://github.com/andialbrecht/sqlparse"
isPreInstalled: false
options: {
SQL: true
}
beautify: (text, language, o... | JavaScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/sqlformat.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/sqlformat.coffee | 1 | 26 |
Glavin001/atom-beautify:src/beautifiers/sqlformat.coffee:1:completion | completion | ###
Requires https://github.com/andialbrecht/sqlparse
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Sqlformat extends Beautifier
name: "sqlformat"
link: "https://github.com/andialbrecht/sqlparse"
isPreInstalled: false
options: { | SQL: true
}
beautify: (text, language, options) ->
@run("sqlformat", [
@tempFile("input", text)
"--reindent" if options.reindent is true
"--indent_width=#{options.indent_size}" if options.indent_size?
"--keywords=#{options.keywords}" if (options.keywords? && options.keywords != 'unchang... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/sqlformat.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/sqlformat.coffee | 1 | 26 |
Glavin001/atom-beautify:src/beautifiers/sqlformat.coffee:1:raw_corpus | raw_corpus | ###
Requires https://github.com/andialbrecht/sqlparse
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Sqlformat extends Beautifier
name: "sqlformat"
link: "https://github.com/andialbrecht/sqlparse"
isPreInstalled: false
options: {
SQL: true
}
beautify: (text, language, o... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/sqlformat.coffee | MIT | f37cb40ad8a369cd1e4ffeac0bffa7ee91f7e55a | 1,503 | https://github.com/Glavin001/atom-beautify/blob/f37cb40ad8a369cd1e4ffeac0bffa7ee91f7e55a/src/beautifiers/sqlformat.coffee | 1 | 26 | ||
Glavin001/atom-beautify:src/beautifiers/sqlformat.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
Requires https://github.com/andialbrecht/sqlparse
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Sqlformat extends Beautifier
name: "sqlformat"
link: "https://github.com/andialbrecht/sqlparse"
isPreInstalled: false
opt... | /*
Requires https://github.com/andialbrecht/sqlparse
*/
"use strict";
var Beautifier, Sqlformat;
Beautifier = require('./beautifier');
module.exports = Sqlformat = (function() {
class Sqlformat extends Beautifier {
beautify(text, language, options) {
return this.run("sqlformat", [this.tempFile("input", te... | CoffeeScript | JavaScript | Glavin001/atom-beautify | src/beautifiers/sqlformat.coffee | MIT | f37cb40ad8a369cd1e4ffeac0bffa7ee91f7e55a | 1,503 | https://github.com/Glavin001/atom-beautify/blob/f37cb40ad8a369cd1e4ffeac0bffa7ee91f7e55a/src/beautifiers/sqlformat.coffee | 1 | 26 |
Glavin001/atom-beautify:src/beautifiers/sqlformat.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
Requires https://github.com/andialbrecht/sqlparse
*/
"use strict";
var Beautifier, Sqlformat;
Beautifier = require('./beautifier');
module.exports = Sqlformat = (function() {
class Sqlformat extends Beautifier {
beautify(text, language, options) {
... | ###
Requires https://github.com/andialbrecht/sqlparse
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Sqlformat extends Beautifier
name: "sqlformat"
link: "https://github.com/andialbrecht/sqlparse"
isPreInstalled: false
options: {
SQL: true
}
beautify: (text, language, o... | JavaScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/sqlformat.coffee | MIT | f37cb40ad8a369cd1e4ffeac0bffa7ee91f7e55a | 1,503 | https://github.com/Glavin001/atom-beautify/blob/f37cb40ad8a369cd1e4ffeac0bffa7ee91f7e55a/src/beautifiers/sqlformat.coffee | 1 | 26 |
Glavin001/atom-beautify:src/beautifiers/sqlformat.coffee:1:completion | completion | ###
Requires https://github.com/andialbrecht/sqlparse
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Sqlformat extends Beautifier
name: "sqlformat"
link: "https://github.com/andialbrecht/sqlparse"
isPreInstalled: false
options: { | SQL: true
}
beautify: (text, language, options) ->
@run("sqlformat", [
@tempFile("input", text)
"--reindent" if (options.reindent? && options.reindent == true)
"--indent_width=#{options.indent_size}" if options.indent_size?
"--keywords=#{options.keywords}" if (options.keywords? && optio... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/sqlformat.coffee | MIT | f37cb40ad8a369cd1e4ffeac0bffa7ee91f7e55a | 1,503 | https://github.com/Glavin001/atom-beautify/blob/f37cb40ad8a369cd1e4ffeac0bffa7ee91f7e55a/src/beautifiers/sqlformat.coffee | 1 | 26 |
Glavin001/atom-beautify:src/beautifiers/sqlformat.coffee:1:raw_corpus | raw_corpus | ###
Requires https://github.com/andialbrecht/sqlparse
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Sqlformat extends Beautifier
name: "sqlformat"
link: "https://github.com/andialbrecht/sqlparse"
isPreInstalled: false
options: {
SQL: true
}
beautify: (text, language, o... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/sqlformat.coffee | MIT | 93aae32f8c0bbb4bb693f04438dae50d61aba588 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/93aae32f8c0bbb4bb693f04438dae50d61aba588/src/beautifiers/sqlformat.coffee | 1 | 26 | ||
Glavin001/atom-beautify:src/beautifiers/sqlformat.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
Requires https://github.com/andialbrecht/sqlparse
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Sqlformat extends Beautifier
name: "sqlformat"
link: "https://github.com/andialbrecht/sqlparse"
isPreInstalled: false
opt... | /*
Requires https://github.com/andialbrecht/sqlparse
*/
"use strict";
var Beautifier, Sqlformat;
Beautifier = require('./beautifier');
module.exports = Sqlformat = (function() {
class Sqlformat extends Beautifier {
beautify(text, language, options) {
return this.run("sqlformat", [this.tempFile("input", te... | CoffeeScript | JavaScript | Glavin001/atom-beautify | src/beautifiers/sqlformat.coffee | MIT | 93aae32f8c0bbb4bb693f04438dae50d61aba588 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/93aae32f8c0bbb4bb693f04438dae50d61aba588/src/beautifiers/sqlformat.coffee | 1 | 26 |
Glavin001/atom-beautify:src/beautifiers/sqlformat.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
Requires https://github.com/andialbrecht/sqlparse
*/
"use strict";
var Beautifier, Sqlformat;
Beautifier = require('./beautifier');
module.exports = Sqlformat = (function() {
class Sqlformat extends Beautifier {
beautify(text, language, options) {
... | ###
Requires https://github.com/andialbrecht/sqlparse
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Sqlformat extends Beautifier
name: "sqlformat"
link: "https://github.com/andialbrecht/sqlparse"
isPreInstalled: false
options: {
SQL: true
}
beautify: (text, language, o... | JavaScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/sqlformat.coffee | MIT | 93aae32f8c0bbb4bb693f04438dae50d61aba588 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/93aae32f8c0bbb4bb693f04438dae50d61aba588/src/beautifiers/sqlformat.coffee | 1 | 26 |
Glavin001/atom-beautify:src/beautifiers/sqlformat.coffee:1:completion | completion | ###
Requires https://github.com/andialbrecht/sqlparse
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Sqlformat extends Beautifier
name: "sqlformat"
link: "https://github.com/andialbrecht/sqlparse"
isPreInstalled: false
options: { | SQL: true
}
beautify: (text, language, options) ->
@run("sqlformat", [
@tempFile("input", text)
"--reindent=#{options.reindent}" if options.reindent?
"--indent_width=#{options.indent_size}" if options.indent_size?
"--keywords=#{options.keywords}" if (options.keywords? && options.keyword... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/sqlformat.coffee | MIT | 93aae32f8c0bbb4bb693f04438dae50d61aba588 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/93aae32f8c0bbb4bb693f04438dae50d61aba588/src/beautifiers/sqlformat.coffee | 1 | 26 |
Glavin001/atom-beautify:src/beautifiers/sqlformat.coffee:1:raw_corpus | raw_corpus | ###
Requires https://github.com/andialbrecht/sqlparse
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Sqlformat extends Beautifier
name: "sqlformat"
link: "https://github.com/andialbrecht/sqlparse"
isPreInstalled: false
options: {
SQL: true
}
beautify: (text, language, o... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/sqlformat.coffee | MIT | ba2198675cbcc1ecd05f18e28e97133cdd2d5319 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/sqlformat.coffee | 1 | 26 | ||
Glavin001/atom-beautify:src/beautifiers/sqlformat.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
Requires https://github.com/andialbrecht/sqlparse
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Sqlformat extends Beautifier
name: "sqlformat"
link: "https://github.com/andialbrecht/sqlparse"
isPreInstalled: false
opt... | /*
Requires https://github.com/andialbrecht/sqlparse
*/
"use strict";
var Beautifier, Sqlformat;
Beautifier = require('./beautifier');
module.exports = Sqlformat = (function() {
class Sqlformat extends Beautifier {
beautify(text, language, options) {
return this.run("sqlformat", [this.tempFile("input", te... | CoffeeScript | JavaScript | Glavin001/atom-beautify | src/beautifiers/sqlformat.coffee | MIT | ba2198675cbcc1ecd05f18e28e97133cdd2d5319 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/sqlformat.coffee | 1 | 26 |
Glavin001/atom-beautify:src/beautifiers/sqlformat.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
Requires https://github.com/andialbrecht/sqlparse
*/
"use strict";
var Beautifier, Sqlformat;
Beautifier = require('./beautifier');
module.exports = Sqlformat = (function() {
class Sqlformat extends Beautifier {
beautify(text, language, options) {
... | ###
Requires https://github.com/andialbrecht/sqlparse
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Sqlformat extends Beautifier
name: "sqlformat"
link: "https://github.com/andialbrecht/sqlparse"
isPreInstalled: false
options: {
SQL: true
}
beautify: (text, language, o... | JavaScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/sqlformat.coffee | MIT | ba2198675cbcc1ecd05f18e28e97133cdd2d5319 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/sqlformat.coffee | 1 | 26 |
Glavin001/atom-beautify:src/beautifiers/sqlformat.coffee:1:completion | completion | ###
Requires https://github.com/andialbrecht/sqlparse
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Sqlformat extends Beautifier
name: "sqlformat"
link: "https://github.com/andialbrecht/sqlparse"
isPreInstalled: false
options: { | SQL: true
}
beautify: (text, language, options) ->
@run("sqlformat", [
@tempFile("input", text)
"--reindent"
"--indent_width=#{options.indent_size}" if options.indent_size?
"--keywords=#{options.keywords}" if (options.keywords? && options.keywords != 'unchanged')
"--identifiers=#{... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/sqlformat.coffee | MIT | ba2198675cbcc1ecd05f18e28e97133cdd2d5319 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/sqlformat.coffee | 1 | 26 |
linemanjs/lineman:test/spec-e2e/helpers/wait.coffee:1:raw_corpus | raw_corpus | global.Wait = (upToSeconds, untilThisReturnsTrue, increment = 1500, customError) ->
waitedSoFar = 0
Given (done) ->
tryAgain = ->
if waitedSoFar > upToSeconds * 1000
console.error """
Timed out while waiting #{waitedSoFar / 1000.0} seconds for:
#{custo... | CoffeeScript | linemanjs/lineman | test/spec-e2e/helpers/wait.coffee | MIT | 61d681532d9621e578d319c279006bbb728ece4b | 1,168 | https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-e2e/helpers/wait.coffee | 1 | 29 | ||
linemanjs/lineman:test/spec-e2e/helpers/wait.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
global.Wait = (upToSeconds, untilThisReturnsTrue, increment = 1500, customError) ->
waitedSoFar = 0
Given (done) ->
tryAgain = ->
if waitedSoFar > upToSeconds * 1000
console.error """
Timed out while waiting #{waitedSo... | global.Wait = function(upToSeconds, untilThisReturnsTrue, increment = 1500, customError) {
var waitedSoFar;
waitedSoFar = 0;
return Given(function(done) {
var testPredicate, tryAgain;
tryAgain = function() {
if (waitedSoFar > upToSeconds * 1000) {
console.error(`Timed out while waiting ${wai... | CoffeeScript | JavaScript | linemanjs/lineman | test/spec-e2e/helpers/wait.coffee | MIT | 61d681532d9621e578d319c279006bbb728ece4b | 1,168 | https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-e2e/helpers/wait.coffee | 1 | 29 |
linemanjs/lineman:test/spec-e2e/helpers/wait.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
global.Wait = function(upToSeconds, untilThisReturnsTrue, increment = 1500, customError) {
var waitedSoFar;
waitedSoFar = 0;
return Given(function(done) {
var testPredicate, tryAgain;
tryAgain = function() {
if (waitedSoFar > upToSeconds * 1000)... | global.Wait = (upToSeconds, untilThisReturnsTrue, increment = 1500, customError) ->
waitedSoFar = 0
Given (done) ->
tryAgain = ->
if waitedSoFar > upToSeconds * 1000
console.error """
Timed out while waiting #{waitedSoFar / 1000.0} seconds for:
#{custo... | JavaScript | CoffeeScript | linemanjs/lineman | test/spec-e2e/helpers/wait.coffee | MIT | 61d681532d9621e578d319c279006bbb728ece4b | 1,168 | https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-e2e/helpers/wait.coffee | 1 | 29 |
linemanjs/lineman:test/spec-e2e/helpers/wait.coffee:1:completion | completion | global.Wait = (upToSeconds, untilThisReturnsTrue, increment = 1500, customError) ->
waitedSoFar = 0
Given (done) ->
tryAgain = ->
if waitedSoFar > upToSeconds * 1000
console.error """
Timed out while waiting #{waitedSoFar / 1000.0} seconds for:
#{custo... | else
waitedSoFar += increment
setTimeout(testPredicate, increment)
testPredicate = ->
if untilThisReturnsTrue() == true then done() else tryAgain()
testPredicate()
global.WaitForJs = (upToSeconds, untilThisReturnsTrue, increment) ->
browserPredicate = ->
browser.navigate().refres... | CoffeeScript | CoffeeScript | linemanjs/lineman | test/spec-e2e/helpers/wait.coffee | MIT | 61d681532d9621e578d319c279006bbb728ece4b | 1,168 | https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-e2e/helpers/wait.coffee | 1 | 29 |
linemanjs/lineman:test/spec-e2e/helpers/wait.coffee:1:raw_corpus | raw_corpus | global.Wait = (upToSeconds, untilThisReturnsTrue, increment = 1000, customError) ->
waitedSoFar = 0
Given (done) ->
tryAgain = ->
if waitedSoFar > upToSeconds * 1000
console.error """
Timed out while waiting #{waitedSoFar / 1000.0} seconds for:
#{custo... | CoffeeScript | linemanjs/lineman | test/spec-e2e/helpers/wait.coffee | MIT | 80ff661f7d9e4622034a1f006f3c470a442d01b4 | 1,168 | https://github.com/linemanjs/lineman/blob/80ff661f7d9e4622034a1f006f3c470a442d01b4/test/spec-e2e/helpers/wait.coffee | 1 | 29 | ||
linemanjs/lineman:test/spec-e2e/helpers/wait.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
global.Wait = (upToSeconds, untilThisReturnsTrue, increment = 1000, customError) ->
waitedSoFar = 0
Given (done) ->
tryAgain = ->
if waitedSoFar > upToSeconds * 1000
console.error """
Timed out while waiting #{waitedSo... | global.Wait = function(upToSeconds, untilThisReturnsTrue, increment = 1000, customError) {
var waitedSoFar;
waitedSoFar = 0;
return Given(function(done) {
var testPredicate, tryAgain;
tryAgain = function() {
if (waitedSoFar > upToSeconds * 1000) {
console.error(`Timed out while waiting ${wai... | CoffeeScript | JavaScript | linemanjs/lineman | test/spec-e2e/helpers/wait.coffee | MIT | 80ff661f7d9e4622034a1f006f3c470a442d01b4 | 1,168 | https://github.com/linemanjs/lineman/blob/80ff661f7d9e4622034a1f006f3c470a442d01b4/test/spec-e2e/helpers/wait.coffee | 1 | 29 |
linemanjs/lineman:test/spec-e2e/helpers/wait.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
global.Wait = function(upToSeconds, untilThisReturnsTrue, increment = 1000, customError) {
var waitedSoFar;
waitedSoFar = 0;
return Given(function(done) {
var testPredicate, tryAgain;
tryAgain = function() {
if (waitedSoFar > upToSeconds * 1000)... | global.Wait = (upToSeconds, untilThisReturnsTrue, increment = 1000, customError) ->
waitedSoFar = 0
Given (done) ->
tryAgain = ->
if waitedSoFar > upToSeconds * 1000
console.error """
Timed out while waiting #{waitedSoFar / 1000.0} seconds for:
#{custo... | JavaScript | CoffeeScript | linemanjs/lineman | test/spec-e2e/helpers/wait.coffee | MIT | 80ff661f7d9e4622034a1f006f3c470a442d01b4 | 1,168 | https://github.com/linemanjs/lineman/blob/80ff661f7d9e4622034a1f006f3c470a442d01b4/test/spec-e2e/helpers/wait.coffee | 1 | 29 |
linemanjs/lineman:test/spec-e2e/helpers/wait.coffee:1:completion | completion | global.Wait = (upToSeconds, untilThisReturnsTrue, increment = 1000, customError) ->
waitedSoFar = 0
Given (done) ->
tryAgain = ->
if waitedSoFar > upToSeconds * 1000
console.error """
Timed out while waiting #{waitedSoFar / 1000.0} seconds for:
#{custo... | else
waitedSoFar += increment
setTimeout(testPredicate, increment)
testPredicate = ->
if untilThisReturnsTrue() == true then done() else tryAgain()
testPredicate()
global.WaitForJs = (upToSeconds, untilThisReturnsTrue, increment) ->
browserPredicate = ->
browser.navigate().refres... | CoffeeScript | CoffeeScript | linemanjs/lineman | test/spec-e2e/helpers/wait.coffee | MIT | 80ff661f7d9e4622034a1f006f3c470a442d01b4 | 1,168 | https://github.com/linemanjs/lineman/blob/80ff661f7d9e4622034a1f006f3c470a442d01b4/test/spec-e2e/helpers/wait.coffee | 1 | 29 |
linemanjs/lineman:test/spec-e2e/helpers/wait.coffee:1:raw_corpus | raw_corpus | global.Wait = (upToSeconds, untilThisReturnsTrue, increment = 2000) ->
totalWait = upToSeconds * 1000
waitedSoFar = 0
everTurnedTrue = false
Given (done) ->
tryAgain = ->
if waitedSoFar > totalWait
throw new Error """
Timed out while waiting #{waitedSoFar / 1000.0} sec... | CoffeeScript | linemanjs/lineman | test/spec-e2e/helpers/wait.coffee | MIT | ccf8a96f9d1d80460794d6dbef05d91b440ab067 | 1,168 | https://github.com/linemanjs/lineman/blob/ccf8a96f9d1d80460794d6dbef05d91b440ab067/test/spec-e2e/helpers/wait.coffee | 1 | 34 | ||
linemanjs/lineman:test/spec-e2e/helpers/wait.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
global.Wait = (upToSeconds, untilThisReturnsTrue, increment = 2000) ->
totalWait = upToSeconds * 1000
waitedSoFar = 0
everTurnedTrue = false
Given (done) ->
tryAgain = ->
if waitedSoFar > totalWait
throw new Error """
... | global.Wait = function(upToSeconds, untilThisReturnsTrue, increment = 2000) {
var everTurnedTrue, totalWait, waitedSoFar;
totalWait = upToSeconds * 1000;
waitedSoFar = 0;
everTurnedTrue = false;
return Given(function(done) {
var tryAgain;
tryAgain = function() {
if (waitedSoFar > totalWait) {
... | CoffeeScript | JavaScript | linemanjs/lineman | test/spec-e2e/helpers/wait.coffee | MIT | ccf8a96f9d1d80460794d6dbef05d91b440ab067 | 1,168 | https://github.com/linemanjs/lineman/blob/ccf8a96f9d1d80460794d6dbef05d91b440ab067/test/spec-e2e/helpers/wait.coffee | 1 | 34 |
linemanjs/lineman:test/spec-e2e/helpers/wait.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
global.Wait = function(upToSeconds, untilThisReturnsTrue, increment = 2000) {
var everTurnedTrue, totalWait, waitedSoFar;
totalWait = upToSeconds * 1000;
waitedSoFar = 0;
everTurnedTrue = false;
return Given(function(done) {
var tryAgain;
tryAgain... | global.Wait = (upToSeconds, untilThisReturnsTrue, increment = 2000) ->
totalWait = upToSeconds * 1000
waitedSoFar = 0
everTurnedTrue = false
Given (done) ->
tryAgain = ->
if waitedSoFar > totalWait
throw new Error """
Timed out while waiting #{waitedSoFar / 1000.0} sec... | JavaScript | CoffeeScript | linemanjs/lineman | test/spec-e2e/helpers/wait.coffee | MIT | ccf8a96f9d1d80460794d6dbef05d91b440ab067 | 1,168 | https://github.com/linemanjs/lineman/blob/ccf8a96f9d1d80460794d6dbef05d91b440ab067/test/spec-e2e/helpers/wait.coffee | 1 | 34 |
linemanjs/lineman:test/spec-e2e/helpers/wait.coffee:1:completion | completion | global.Wait = (upToSeconds, untilThisReturnsTrue, increment = 2000) ->
totalWait = upToSeconds * 1000
waitedSoFar = 0
everTurnedTrue = false
Given (done) ->
tryAgain = ->
if waitedSoFar > totalWait
throw new Error """
Timed out while waiting #{waitedSoFar / 1000.0} sec... | setTimeout ->
console.log("Running after #{waitedSoFar}ms for #{untilThisReturnsTrue.toString()}")
if untilThisReturnsTrue() == true
done()
else
tryAgain()
, increment
if untilThisReturnsTrue()
done()
else
tryAgain()
global.WaitForJs = (... | CoffeeScript | CoffeeScript | linemanjs/lineman | test/spec-e2e/helpers/wait.coffee | MIT | ccf8a96f9d1d80460794d6dbef05d91b440ab067 | 1,168 | https://github.com/linemanjs/lineman/blob/ccf8a96f9d1d80460794d6dbef05d91b440ab067/test/spec-e2e/helpers/wait.coffee | 1 | 34 |
kahmali/meteor-restivus:lib/restivus.coffee:1:raw_corpus | raw_corpus | class @Restivus
constructor: ->
@routes = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1
prettyJson: false
auth:
token: 'services.resume.loginTokens.token'
user: ->
userId: @request.headers['x-user-id']
token: @request.... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 82fc01ea605cc4e2d0b57031359a0343c86875be | 541 | https://github.com/kahmali/meteor-restivus/blob/82fc01ea605cc4e2d0b57031359a0343c86875be/lib/restivus.coffee | 1 | 50 | ||
kahmali/meteor-restivus:lib/restivus.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class @Restivus
constructor: ->
@routes = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1
prettyJson: false
auth:
token: 'services.resume.loginTokens.token'
user: ->
userId:... | this.Restivus = class Restivus {
constructor() {
this.routes = [];
this.config = {
paths: [],
useAuth: false,
apiPath: 'api/',
version: 1,
prettyJson: false,
auth: {
token: 'services.resume.loginTokens.token',
user: function() {
return {
... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 82fc01ea605cc4e2d0b57031359a0343c86875be | 541 | https://github.com/kahmali/meteor-restivus/blob/82fc01ea605cc4e2d0b57031359a0343c86875be/lib/restivus.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/restivus.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restivus = class Restivus {
constructor() {
this.routes = [];
this.config = {
paths: [],
useAuth: false,
apiPath: 'api/',
version: 1,
prettyJson: false,
auth: {
token: 'services.resume.loginTokens.token',
... | class @Restivus
constructor: ->
@routes = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1
prettyJson: false
auth:
token: 'services.resume.loginTokens.token'
user: ->
userId: @request.headers['x-user-id']
token: @request.... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 82fc01ea605cc4e2d0b57031359a0343c86875be | 541 | https://github.com/kahmali/meteor-restivus/blob/82fc01ea605cc4e2d0b57031359a0343c86875be/lib/restivus.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/restivus.coffee:1:completion | completion | class @Restivus
constructor: ->
@routes = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1
prettyJson: false
auth:
token: 'services.resume.loginTokens.token'
user: ->
userId: @request.headers['x-user-id']
token: @request.... | @routes.push(route)
# Don't add the route to the API until the API has been configured
route.addToApi() if @configured
###
Configure the ReST API
Must be called exactly once, from anywhere on the server.
###
configure: (config) ->
if @configured
throw new Error 'Restivus.configure() ... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 82fc01ea605cc4e2d0b57031359a0343c86875be | 541 | https://github.com/kahmali/meteor-restivus/blob/82fc01ea605cc4e2d0b57031359a0343c86875be/lib/restivus.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/restivus.coffee:2:raw_corpus | raw_corpus | # Add any existing routes to the API now that it's configured
_.each @routes, (route) -> route.addToApi()
# Add default login and logout endpoints if auth is configured
if @config.useAuth
@_initAuth()
console.log "Restivus configured at #{@config.apiPath} with authentication"
else
con... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 82fc01ea605cc4e2d0b57031359a0343c86875be | 541 | https://github.com/kahmali/meteor-restivus/blob/82fc01ea605cc4e2d0b57031359a0343c86875be/lib/restivus.coffee | 51 | 100 | ||
kahmali/meteor-restivus:lib/restivus.coffee:2:completion | completion | # Add any existing routes to the API now that it's configured
_.each @routes, (route) -> route.addToApi()
# Add default login and logout endpoints if auth is configured
if @config.useAuth
@_initAuth()
console.log "Restivus configured at #{@config.apiPath} with authentication"
else
con... | # Grab the username or email that the user is logging in with
user = {}
if @bodyParams.user.indexOf('@') is -1
user.username = @bodyParams.user
else
user.email = @bodyParams.user
# Try to log the user into the user's account (if successful we'll get an auth token bac... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 82fc01ea605cc4e2d0b57031359a0343c86875be | 541 | https://github.com/kahmali/meteor-restivus/blob/82fc01ea605cc4e2d0b57031359a0343c86875be/lib/restivus.coffee | 51 | 100 |
kahmali/meteor-restivus:lib/restivus.coffee:3:raw_corpus | raw_corpus | auth.success = true
auth
###
Add a logout endpoint to the API
After the user is logged out, the onLoggedOut hook is called (see Restfully.configure() for adding hook).
###
@add 'logout', {authRequired: true},
get: ->
# Remove the given auth token from the user's account
... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 82fc01ea605cc4e2d0b57031359a0343c86875be | 541 | https://github.com/kahmali/meteor-restivus/blob/82fc01ea605cc4e2d0b57031359a0343c86875be/lib/restivus.coffee | 101 | 121 | ||
kahmali/meteor-restivus:lib/restivus.coffee:3:completion | completion | auth.success = true
auth
###
Add a logout endpoint to the API
After the user is logged out, the onLoggedOut hook is called (see Restfully.configure() for adding hook).
###
@add 'logout', {authRequired: true},
get: -> | # Remove the given auth token from the user's account
authToken = @request.headers['x-auth-token']
Meteor.users.update @user._id, {$pull: {'services.resume.loginTokens': {token: authToken}}}
# TODO: Add any return data to response as data.extra
# Call the logout hook with the logged out... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 82fc01ea605cc4e2d0b57031359a0343c86875be | 541 | https://github.com/kahmali/meteor-restivus/blob/82fc01ea605cc4e2d0b57031359a0343c86875be/lib/restivus.coffee | 101 | 121 |
kahmali/meteor-restivus:lib/restivus.coffee:1:raw_corpus | raw_corpus | class @Restivus
constructor: ->
@routes = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1
prettyJson: false
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given path
###
add... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | ef2131abd7c4d779d967b53e2ae4e79fcdefaea9 | 541 | https://github.com/kahmali/meteor-restivus/blob/ef2131abd7c4d779d967b53e2ae4e79fcdefaea9/lib/restivus.coffee | 1 | 50 | ||
kahmali/meteor-restivus:lib/restivus.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class @Restivus
constructor: ->
@routes = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1
prettyJson: false
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints... | this.Restivus = class Restivus {
constructor() {
this.routes = [];
this.config = {
paths: [],
useAuth: false,
apiPath: 'api/',
version: 1,
prettyJson: false,
onLoggedIn: function() {
return {};
},
onLoggedOut: function() {
return {};
}
... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | ef2131abd7c4d779d967b53e2ae4e79fcdefaea9 | 541 | https://github.com/kahmali/meteor-restivus/blob/ef2131abd7c4d779d967b53e2ae4e79fcdefaea9/lib/restivus.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/restivus.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restivus = class Restivus {
constructor() {
this.routes = [];
this.config = {
paths: [],
useAuth: false,
apiPath: 'api/',
version: 1,
prettyJson: false,
onLoggedIn: function() {
return {};
},
on... | class @Restivus
constructor: ->
@routes = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1
prettyJson: false
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given path
###
add... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | ef2131abd7c4d779d967b53e2ae4e79fcdefaea9 | 541 | https://github.com/kahmali/meteor-restivus/blob/ef2131abd7c4d779d967b53e2ae4e79fcdefaea9/lib/restivus.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/restivus.coffee:1:completion | completion | class @Restivus
constructor: ->
@routes = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1
prettyJson: false
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given path
###
add... | ###
Configure the ReST API
Must be called exactly once, from anywhere on the server.
###
configure: (config) ->
if @configured
throw new Error 'Restivus.configure() can only be called once'
@configured = true
# Configure API with the given options
_.extend @config, config
# Nor... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | ef2131abd7c4d779d967b53e2ae4e79fcdefaea9 | 541 | https://github.com/kahmali/meteor-restivus/blob/ef2131abd7c4d779d967b53e2ae4e79fcdefaea9/lib/restivus.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/restivus.coffee:2:raw_corpus | raw_corpus | if @config.useAuth
@_initAuth()
console.log "Restivus configured at #{@config.apiPath} with authentication"
else
console.log "Restivus configured at #{@config.apiPath} without authentication"
###
Add /login and /logout endpoints to the API
###
_initAuth: ->
self = this
###
... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | ef2131abd7c4d779d967b53e2ae4e79fcdefaea9 | 541 | https://github.com/kahmali/meteor-restivus/blob/ef2131abd7c4d779d967b53e2ae4e79fcdefaea9/lib/restivus.coffee | 51 | 100 | ||
kahmali/meteor-restivus:lib/restivus.coffee:2:completion | completion | if @config.useAuth
@_initAuth()
console.log "Restivus configured at #{@config.apiPath} with authentication"
else
console.log "Restivus configured at #{@config.apiPath} without authentication"
###
Add /login and /logout endpoints to the API
###
_initAuth: ->
self = this
###
... | user.email = @bodyParams.user
# Try to log the user into the user's account (if successful we'll get an auth token back)
try
auth = Auth.loginWithPassword user, @bodyParams.password
catch e
return [e.error, {success: false, message: e.reason}]
# Get the authenticate... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | ef2131abd7c4d779d967b53e2ae4e79fcdefaea9 | 541 | https://github.com/kahmali/meteor-restivus/blob/ef2131abd7c4d779d967b53e2ae4e79fcdefaea9/lib/restivus.coffee | 51 | 100 |
kahmali/meteor-restivus:lib/restivus.coffee:3:raw_corpus | raw_corpus | After the user is logged out, the onLoggedOut hook is called (see Restfully.configure() for adding hook).
###
@add 'logout', {authRequired: true},
get: ->
# Remove the given auth token from the user's account
authToken = @request.headers['x-auth-token']
Meteor.users.update @user._i... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | ef2131abd7c4d779d967b53e2ae4e79fcdefaea9 | 541 | https://github.com/kahmali/meteor-restivus/blob/ef2131abd7c4d779d967b53e2ae4e79fcdefaea9/lib/restivus.coffee | 101 | 116 | ||
kahmali/meteor-restivus:lib/restivus.coffee:3:completion | completion | After the user is logged out, the onLoggedOut hook is called (see Restfully.configure() for adding hook).
###
@add 'logout', {authRequired: true},
get: ->
# Remove the given auth token from the user's account
authToken = @request.headers['x-auth-token']
Meteor.users.update @user._i... | # TODO: Add any return data to response as data.extra
# Call the logout hook with the logged out user attached
self.config.onLoggedOut.call this
{success: true, message: 'You\'ve been logged out!'}
Restivus = new @Restivus | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | ef2131abd7c4d779d967b53e2ae4e79fcdefaea9 | 541 | https://github.com/kahmali/meteor-restivus/blob/ef2131abd7c4d779d967b53e2ae4e79fcdefaea9/lib/restivus.coffee | 101 | 116 |
kahmali/meteor-restivus:lib/restivus.coffee:2:raw_corpus | raw_corpus | if @config.useAuth
_initAuth()
console.log "Restivus configured at #{@config.apiPath} with authentication"
else
console.log "Restivus configured at #{@config.apiPath} without authentication"
###
Add /login and /logout endpoints to the API
###
_initAuth = ->
###
Add a login end... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 0c2a8ee043ad99f545c46248924812998fba7ce8 | 541 | https://github.com/kahmali/meteor-restivus/blob/0c2a8ee043ad99f545c46248924812998fba7ce8/lib/restivus.coffee | 51 | 100 | ||
kahmali/meteor-restivus:lib/restivus.coffee:2:completion | completion | if @config.useAuth
_initAuth()
console.log "Restivus configured at #{@config.apiPath} with authentication"
else
console.log "Restivus configured at #{@config.apiPath} without authentication"
###
Add /login and /logout endpoints to the API
###
_initAuth = ->
###
Add a login end... | user.email = @bodyParams.user
# Try to log the user into the user's account (if successful we'll get an auth token back)
try
auth = Auth.loginWithPassword user, @bodyParams.password
catch e
return [e.error, {success: false, message: e.reason}]
# Get the authenticate... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 0c2a8ee043ad99f545c46248924812998fba7ce8 | 541 | https://github.com/kahmali/meteor-restivus/blob/0c2a8ee043ad99f545c46248924812998fba7ce8/lib/restivus.coffee | 51 | 100 |
kahmali/meteor-restivus:lib/restivus.coffee:3:raw_corpus | raw_corpus | After the user is logged out, the onLoggedOut hook is called (see Restfully.configure() for adding hook).
###
@Restivus.add 'logout', {authRequired: true},
get: ->
# Remove the given auth token from the user's account
authToken = @request.headers['x-auth-token']
Meteor.users.update... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 0c2a8ee043ad99f545c46248924812998fba7ce8 | 541 | https://github.com/kahmali/meteor-restivus/blob/0c2a8ee043ad99f545c46248924812998fba7ce8/lib/restivus.coffee | 101 | 115 | ||
kahmali/meteor-restivus:lib/restivus.coffee:3:completion | completion | After the user is logged out, the onLoggedOut hook is called (see Restfully.configure() for adding hook).
###
@Restivus.add 'logout', {authRequired: true},
get: ->
# Remove the given auth token from the user's account
authToken = @request.headers['x-auth-token']
Meteor.users.update... | # TODO: Add any return data to response as data.extra
# Call the logout hook with the logged out user attached
@Restivus.config.onLoggedOut.call this
{success: true, message: 'You\'ve been logged out!'}
Restivus = new @Restivus | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 0c2a8ee043ad99f545c46248924812998fba7ce8 | 541 | https://github.com/kahmali/meteor-restivus/blob/0c2a8ee043ad99f545c46248924812998fba7ce8/lib/restivus.coffee | 101 | 115 |
kahmali/meteor-restivus:lib/restivus.coffee:1:raw_corpus | raw_corpus | @Restivus = ->
@routes = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1
prettyJson: false
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given path
### | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980 | 541 | https://github.com/kahmali/meteor-restivus/blob/47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980/lib/restivus.coffee | 1 | 15 | ||
kahmali/meteor-restivus:lib/restivus.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restivus = ->
@routes = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1
prettyJson: false
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given pat... | this.Restivus = function() {
this.routes = [];
this.config = {
paths: [],
useAuth: false,
apiPath: 'api/',
version: 1,
prettyJson: false,
onLoggedIn: function() {
return {};
},
onLoggedOut: function() {
return {};
}
};
return this.configured = false;
};
/*
Add ... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980 | 541 | https://github.com/kahmali/meteor-restivus/blob/47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980/lib/restivus.coffee | 1 | 15 |
kahmali/meteor-restivus:lib/restivus.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restivus = function() {
this.routes = [];
this.config = {
paths: [],
useAuth: false,
apiPath: 'api/',
version: 1,
prettyJson: false,
onLoggedIn: function() {
return {};
},
onLoggedOut: function() {
return {};
... | @Restivus = ->
@routes = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1
prettyJson: false
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given path
### | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980 | 541 | https://github.com/kahmali/meteor-restivus/blob/47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980/lib/restivus.coffee | 1 | 15 |
kahmali/meteor-restivus:lib/restivus.coffee:1:completion | completion | @Restivus = ->
@routes = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1 | prettyJson: false
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given path
### | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980 | 541 | https://github.com/kahmali/meteor-restivus/blob/47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980/lib/restivus.coffee | 1 | 15 |
kahmali/meteor-restivus:lib/restivus.coffee:2:raw_corpus | raw_corpus | @Restivus.prototype.add = (path, options, methods) ->
# Create a new route and add it to our list of existing routes
route = new Route(this, path, options, methods)
@routes.push(route)
# Don't add the route to the API until the API has been configured
route.addToApi() if @configured
###
Configure the ReS... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980 | 541 | https://github.com/kahmali/meteor-restivus/blob/47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980/lib/restivus.coffee | 16 | 29 | ||
kahmali/meteor-restivus:lib/restivus.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restivus.prototype.add = (path, options, methods) ->
# Create a new route and add it to our list of existing routes
route = new Route(this, path, options, methods)
@routes.push(route)
# Don't add the route to the API until the API has been configured
... | this.Restivus.prototype.add = function(path, options, methods) {
var route;
// Create a new route and add it to our list of existing routes
route = new Route(this, path, options, methods);
this.routes.push(route);
if (this.configured) {
// Don't add the route to the API until the API has been configured
... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980 | 541 | https://github.com/kahmali/meteor-restivus/blob/47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980/lib/restivus.coffee | 16 | 29 |
kahmali/meteor-restivus:lib/restivus.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restivus.prototype.add = function(path, options, methods) {
var route;
// Create a new route and add it to our list of existing routes
route = new Route(this, path, options, methods);
this.routes.push(route);
if (this.configured) {
// Don't add t... | @Restivus.prototype.add = (path, options, methods) ->
# Create a new route and add it to our list of existing routes
route = new Route(this, path, options, methods)
@routes.push(route)
# Don't add the route to the API until the API has been configured
route.addToApi() if @configured
###
Configure the ReS... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980 | 541 | https://github.com/kahmali/meteor-restivus/blob/47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980/lib/restivus.coffee | 16 | 29 |
kahmali/meteor-restivus:lib/restivus.coffee:2:completion | completion | @Restivus.prototype.add = (path, options, methods) ->
# Create a new route and add it to our list of existing routes
route = new Route(this, path, options, methods)
@routes.push(route)
# Don't add the route to the API until the API has been configured
route.addToApi() if @configured | ###
Configure the ReST API
Must be called exactly once, from anywhere on the server.
### | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980 | 541 | https://github.com/kahmali/meteor-restivus/blob/47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980/lib/restivus.coffee | 16 | 29 |
kahmali/meteor-restivus:lib/restivus.coffee:3:raw_corpus | raw_corpus | @Restivus.prototype.configure = (config) ->
if @configured
throw new Error 'Restivus.configure() can only be called once'
@configured = true
# Configure API with the given options
_.extend @config, config
# Normalize the API path
if @config.apiPath[0] is '/'
@config.apiPath = @config.apiPath.slic... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980 | 541 | https://github.com/kahmali/meteor-restivus/blob/47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980/lib/restivus.coffee | 30 | 59 | ||
kahmali/meteor-restivus:lib/restivus.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restivus.prototype.configure = (config) ->
if @configured
throw new Error 'Restivus.configure() can only be called once'
@configured = true
# Configure API with the given options
_.extend @config, config
# Normalize the API path
if @config.api... | this.Restivus.prototype.configure = function(config) {
if (this.configured) {
throw new Error('Restivus.configure() can only be called once');
}
this.configured = true;
// Configure API with the given options
_.extend(this.config, config);
// Normalize the API path
if (this.config.apiPath[0] === '/') ... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980 | 541 | https://github.com/kahmali/meteor-restivus/blob/47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980/lib/restivus.coffee | 30 | 59 |
kahmali/meteor-restivus:lib/restivus.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restivus.prototype.configure = function(config) {
if (this.configured) {
throw new Error('Restivus.configure() can only be called once');
}
this.configured = true;
// Configure API with the given options
_.extend(this.config, config);
// Normal... | @Restivus.prototype.configure = (config) ->
if @configured
throw new Error 'Restivus.configure() can only be called once'
@configured = true
# Configure API with the given options
_.extend @config, config
# Normalize the API path
if @config.apiPath[0] is '/'
@config.apiPath = @config.apiPath.slic... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980 | 541 | https://github.com/kahmali/meteor-restivus/blob/47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980/lib/restivus.coffee | 30 | 59 |
kahmali/meteor-restivus:lib/restivus.coffee:3:completion | completion | @Restivus.prototype.configure = (config) ->
if @configured
throw new Error 'Restivus.configure() can only be called once'
@configured = true
# Configure API with the given options
_.extend @config, config
# Normalize the API path
if @config.apiPath[0] is '/'
@config.apiPath = @config.apiPath.slic... | # Add any existing routes to the API now that it's configured
_.each @routes, (route) -> route.addToApi()
# Add default login and logout endpoints if auth is configured
if @config.useAuth
initAuth()
console.log "Restivus configured at #{@config.apiPath} with authentication"
else
console.log "Restiv... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980 | 541 | https://github.com/kahmali/meteor-restivus/blob/47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980/lib/restivus.coffee | 30 | 59 |
kahmali/meteor-restivus:lib/restivus.coffee:4:raw_corpus | raw_corpus | initAuth = ->
###
Add a login endpoint to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
user = {}
if ... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980 | 541 | https://github.com/kahmali/meteor-restivus/blob/47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980/lib/restivus.coffee | 60 | 109 | ||
kahmali/meteor-restivus:lib/restivus.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
initAuth = ->
###
Add a login endpoint to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email t... | var initAuth;
initAuth = function() {
/*
Add a login endpoint to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
*/
Restivus.add('login', {
authRequired: false
}, {
post: function() {
var auth, e, user;
// Grab the usernam... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980 | 541 | https://github.com/kahmali/meteor-restivus/blob/47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980/lib/restivus.coffee | 60 | 109 |
kahmali/meteor-restivus:lib/restivus.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var initAuth;
initAuth = function() {
/*
Add a login endpoint to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
*/
Restivus.add('login', {
authRequired: false
}, {
post: function... | initAuth = ->
###
Add a login endpoint to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
user = {}
if ... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980 | 541 | https://github.com/kahmali/meteor-restivus/blob/47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980/lib/restivus.coffee | 60 | 109 |
kahmali/meteor-restivus:lib/restivus.coffee:4:completion | completion | initAuth = ->
###
Add a login endpoint to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
user = {}
if ... | '_id': auth.userId
'services.resume.loginTokens.token': auth.authToken
@userId = @user._id
# TODO: Add any return data to response as data.extra
# Call the login hook with the authenticated user attached
Restivus.config.onLoggedIn.call this
auth.success = true
auth
#... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980 | 541 | https://github.com/kahmali/meteor-restivus/blob/47eebdf0b6a4a0d08451fc5a11b5edb01d4b5980/lib/restivus.coffee | 60 | 109 |
kahmali/meteor-restivus:lib/restivus.coffee:3:raw_corpus | raw_corpus | @Restivus.prototype.configure = (config) ->
if @configured
throw new Error 'Restivus.configure() can only be called once'
@configured = true
# Normalize the API path
if config.apiPath[0] is '/'
config.apiPath = config.apiPath.slice 1
if config.apiPath[-1] isnt '/'
config.apiPath = config.apiPath... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 11c621271fcd1515dfe0381fff081bafaeb7ebd8 | 541 | https://github.com/kahmali/meteor-restivus/blob/11c621271fcd1515dfe0381fff081bafaeb7ebd8/lib/restivus.coffee | 30 | 59 | ||
kahmali/meteor-restivus:lib/restivus.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restivus.prototype.configure = (config) ->
if @configured
throw new Error 'Restivus.configure() can only be called once'
@configured = true
# Normalize the API path
if config.apiPath[0] is '/'
config.apiPath = config.apiPath.slice 1
if config... | this.Restivus.prototype.configure = function(config) {
if (this.configured) {
throw new Error('Restivus.configure() can only be called once');
}
this.configured = true;
// Normalize the API path
if (config.apiPath[0] === '/') {
config.apiPath = config.apiPath.slice(1);
}
if (config.apiPath[-1] !==... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 11c621271fcd1515dfe0381fff081bafaeb7ebd8 | 541 | https://github.com/kahmali/meteor-restivus/blob/11c621271fcd1515dfe0381fff081bafaeb7ebd8/lib/restivus.coffee | 30 | 59 |
kahmali/meteor-restivus:lib/restivus.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restivus.prototype.configure = function(config) {
if (this.configured) {
throw new Error('Restivus.configure() can only be called once');
}
this.configured = true;
// Normalize the API path
if (config.apiPath[0] === '/') {
config.apiPath = co... | @Restivus.prototype.configure = (config) ->
if @configured
throw new Error 'Restivus.configure() can only be called once'
@configured = true
# Normalize the API path
if config.apiPath[0] is '/'
config.apiPath = config.apiPath.slice 1
if config.apiPath[-1] isnt '/'
config.apiPath = config.apiPath... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 11c621271fcd1515dfe0381fff081bafaeb7ebd8 | 541 | https://github.com/kahmali/meteor-restivus/blob/11c621271fcd1515dfe0381fff081bafaeb7ebd8/lib/restivus.coffee | 30 | 59 |
kahmali/meteor-restivus:lib/restivus.coffee:3:completion | completion | @Restivus.prototype.configure = (config) ->
if @configured
throw new Error 'Restivus.configure() can only be called once'
@configured = true
# Normalize the API path
if config.apiPath[0] is '/'
config.apiPath = config.apiPath.slice 1
if config.apiPath[-1] isnt '/'
config.apiPath = config.apiPath... | # Add any existing routes to the API now that it's configured
_.each @routes, (route) -> route.addToApi()
# Add default login and logout endpoints if auth is configured
if @config.useAuth
initAuth()
console.log "Restivus configured at #{@config.apiPath} with authentication"
else
console.log "Restiv... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 11c621271fcd1515dfe0381fff081bafaeb7ebd8 | 541 | https://github.com/kahmali/meteor-restivus/blob/11c621271fcd1515dfe0381fff081bafaeb7ebd8/lib/restivus.coffee | 30 | 59 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.