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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
yakyak/yakyak:src/ui/views/applayout.coffee:4:raw_corpus | raw_corpus | onScroll = throttle 20, (ev) ->
el = ev.target
child = el.children[0]
# use the saved scroll value if we have one
if el.hasAttribute('scrolltop')
el.scrollTop = el.getAttribute('scrolltop')
el.removeAttribute('scrolltop')
# calculation to see whether we are at the bottom with a tol... | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | d50922b4a05a568bb0d2c8056ef15f6ea72f09dd | 3,762 | https://github.com/yakyak/yakyak/blob/d50922b4a05a568bb0d2c8056ef15f6ea72f09dd/src/ui/views/applayout.coffee | 25 | 43 | ||
yakyak/yakyak:src/ui/views/applayout.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
onScroll = throttle 20, (ev) ->
el = ev.target
child = el.children[0]
# use the saved scroll value if we have one
if el.hasAttribute('scrolltop')
el.scrollTop = el.getAttribute('scrolltop')
el.removeAttribute('scrolltop')
# c... | var onScroll;
onScroll = throttle(20, function(ev) {
var atbottom, attop, child, el;
el = ev.target;
child = el.children[0];
// use the saved scroll value if we have one
if (el.hasAttribute('scrolltop')) {
el.scrollTop = el.getAttribute('scrolltop');
el.removeAttribute('scrolltop');
}
// calculat... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | d50922b4a05a568bb0d2c8056ef15f6ea72f09dd | 3,762 | https://github.com/yakyak/yakyak/blob/d50922b4a05a568bb0d2c8056ef15f6ea72f09dd/src/ui/views/applayout.coffee | 25 | 43 |
yakyak/yakyak:src/ui/views/applayout.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var onScroll;
onScroll = throttle(20, function(ev) {
var atbottom, attop, child, el;
el = ev.target;
child = el.children[0];
// use the saved scroll value if we have one
if (el.hasAttribute('scrolltop')) {
el.scrollTop = el.getAttribute('scrolltop');... | onScroll = throttle 20, (ev) ->
el = ev.target
child = el.children[0]
# use the saved scroll value if we have one
if el.hasAttribute('scrolltop')
el.scrollTop = el.getAttribute('scrolltop')
el.removeAttribute('scrolltop')
# calculation to see whether we are at the bottom with a tol... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | d50922b4a05a568bb0d2c8056ef15f6ea72f09dd | 3,762 | https://github.com/yakyak/yakyak/blob/d50922b4a05a568bb0d2c8056ef15f6ea72f09dd/src/ui/views/applayout.coffee | 25 | 43 |
yakyak/yakyak:src/ui/views/applayout.coffee:4:completion | completion | onScroll = throttle 20, (ev) ->
el = ev.target
child = el.children[0]
# use the saved scroll value if we have one
if el.hasAttribute('scrolltop')
el.scrollTop = el.getAttribute('scrolltop')
el.removeAttribute('scrolltop') | # calculation to see whether we are at the bottom with a tolerance value
atbottom = (el.scrollTop + el.offsetHeight) >= (child.offsetHeight - 10)
action 'atbottom', atbottom
# check whether we are at the top with a tolerance value
if el.scrollTop < 0
attop = child.offsetHeight - el.offsetHeight... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | d50922b4a05a568bb0d2c8056ef15f6ea72f09dd | 3,762 | https://github.com/yakyak/yakyak/blob/d50922b4a05a568bb0d2c8056ef15f6ea72f09dd/src/ui/views/applayout.coffee | 25 | 43 |
yakyak/yakyak:src/ui/views/applayout.coffee:4:raw_corpus | raw_corpus | onScroll = throttle 20, (ev) ->
el = ev.target
child = el.children[0]
# calculation to see whether we are at the bottom with a tolerance value
atbottom = (el.scrollTop + el.offsetHeight) >= (child.offsetHeight - 10)
action 'atbottom', atbottom
# check whether we are at the top with a tolerance... | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 7a118cf26e6fa1f6d51e2f66058ce419d93cb31e | 3,762 | https://github.com/yakyak/yakyak/blob/7a118cf26e6fa1f6d51e2f66058ce419d93cb31e/src/ui/views/applayout.coffee | 25 | 35 | ||
yakyak/yakyak:src/ui/views/applayout.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
onScroll = throttle 20, (ev) ->
el = ev.target
child = el.children[0]
# calculation to see whether we are at the bottom with a tolerance value
atbottom = (el.scrollTop + el.offsetHeight) >= (child.offsetHeight - 10)
action 'atbottom', atbotto... | var onScroll;
onScroll = throttle(20, function(ev) {
var atbottom, attop, child, el;
el = ev.target;
child = el.children[0];
// calculation to see whether we are at the bottom with a tolerance value
atbottom = (el.scrollTop + el.offsetHeight) >= (child.offsetHeight - 10);
action('atbottom', atbottom);
//... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 7a118cf26e6fa1f6d51e2f66058ce419d93cb31e | 3,762 | https://github.com/yakyak/yakyak/blob/7a118cf26e6fa1f6d51e2f66058ce419d93cb31e/src/ui/views/applayout.coffee | 25 | 35 |
yakyak/yakyak:src/ui/views/applayout.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var onScroll;
onScroll = throttle(20, function(ev) {
var atbottom, attop, child, el;
el = ev.target;
child = el.children[0];
// calculation to see whether we are at the bottom with a tolerance value
atbottom = (el.scrollTop + el.offsetHeight) >= (child.o... | onScroll = throttle 20, (ev) ->
el = ev.target
child = el.children[0]
# calculation to see whether we are at the bottom with a tolerance value
atbottom = (el.scrollTop + el.offsetHeight) >= (child.offsetHeight - 10)
action 'atbottom', atbottom
# check whether we are at the top with a tolerance... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 7a118cf26e6fa1f6d51e2f66058ce419d93cb31e | 3,762 | https://github.com/yakyak/yakyak/blob/7a118cf26e6fa1f6d51e2f66058ce419d93cb31e/src/ui/views/applayout.coffee | 25 | 35 |
yakyak/yakyak:src/ui/views/applayout.coffee:4:completion | completion | onScroll = throttle 20, (ev) ->
el = ev.target
child = el.children[0]
# calculation to see whether we are at the bottom with a tolerance value | atbottom = (el.scrollTop + el.offsetHeight) >= (child.offsetHeight - 10)
action 'atbottom', atbottom
# check whether we are at the top with a tolerance value
attop = el.scrollTop <= (el.offsetHeight / 2)
action 'attop', attop | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 7a118cf26e6fa1f6d51e2f66058ce419d93cb31e | 3,762 | https://github.com/yakyak/yakyak/blob/7a118cf26e6fa1f6d51e2f66058ce419d93cb31e/src/ui/views/applayout.coffee | 25 | 35 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:raw_corpus | raw_corpus | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, region('last'), ->
div class:'left', ->
div class:'listhead', region('listhead')
div class:'list', region('left')
div class:'lfoot... | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 7a118cf26e6fa1f6d51e2f66058ce419d93cb31e | 3,762 | https://github.com/yakyak/yakyak/blob/7a118cf26e6fa1f6d51e2f66058ce419d93cb31e/src/ui/views/applayout.coffee | 100 | 147 | ||
yakyak/yakyak:src/ui/views/applayout.coffee:11:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, region('last'), ->
div class:'left', ->
div class:'listhead', region('listhead')
div ... | var exp;
module.exports = exp = layout(function() {
var platform;
platform = process.platform === 'darwin' ? 'osx' : '';
div({
class: 'applayout ' + platform
}, resize, region('last'), function() {
div({
class: 'left'
}, function() {
div({
class: 'listhead'
}, region('list... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 7a118cf26e6fa1f6d51e2f66058ce419d93cb31e | 3,762 | https://github.com/yakyak/yakyak/blob/7a118cf26e6fa1f6d51e2f66058ce419d93cb31e/src/ui/views/applayout.coffee | 100 | 147 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var exp;
module.exports = exp = layout(function() {
var platform;
platform = process.platform === 'darwin' ? 'osx' : '';
div({
class: 'applayout ' + platform
}, resize, region('last'), function() {
div({
class: 'left'
}, function() {
... | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, region('last'), ->
div class:'left', ->
div class:'listhead', region('listhead')
div class:'list', region('left')
div class:'lfoot... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 7a118cf26e6fa1f6d51e2f66058ce419d93cb31e | 3,762 | https://github.com/yakyak/yakyak/blob/7a118cf26e6fa1f6d51e2f66058ce419d93cb31e/src/ui/views/applayout.coffee | 100 | 147 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:completion | completion | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, region('last'), ->
div class:'left', ->
div class:'listhead', region('listhead')
div class:'list', region('left')
div class:'lfoot... | screl = document.querySelector('.main')
# the pixel offset for the bottom of the viewport
bottom = screl.scrollTop + screl.offsetHeight
# all messages
last = null
last = m for m in document.querySelectorAll('.message') when topof(m) < bottom
return last
exp.recordMai... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 7a118cf26e6fa1f6d51e2f66058ce419d93cb31e | 3,762 | https://github.com/yakyak/yakyak/blob/7a118cf26e6fa1f6d51e2f66058ce419d93cb31e/src/ui/views/applayout.coffee | 100 | 147 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:raw_corpus | raw_corpus | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: path.join __dirname, '..', '..', 'icons', 'icon@32.png'
... | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 39e8c438d6f6401e39be9bb77e20643e0401c3e7 | 3,762 | https://github.com/yakyak/yakyak/blob/39e8c438d6f6401e39be9bb77e20643e0401c3e7/src/ui/views/applayout.coffee | 100 | 149 | ||
yakyak/yakyak:src/ui/views/applayout.coffee:11:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: pat... | var exp;
module.exports = exp = layout(function() {
var platform;
platform = process.platform === 'darwin' ? 'osx' : '';
div({
class: 'applayout ' + platform
}, resize, function() {
div({
class: 'connecting'
}, function() {
return div(function() {
div(function() {
retu... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 39e8c438d6f6401e39be9bb77e20643e0401c3e7 | 3,762 | https://github.com/yakyak/yakyak/blob/39e8c438d6f6401e39be9bb77e20643e0401c3e7/src/ui/views/applayout.coffee | 100 | 149 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var exp;
module.exports = exp = layout(function() {
var platform;
platform = process.platform === 'darwin' ? 'osx' : '';
div({
class: 'applayout ' + platform
}, resize, function() {
div({
class: 'connecting'
}, function() {
return d... | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: path.join __dirname, '..', '..', 'icons', 'icon@32.png'
... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 39e8c438d6f6401e39be9bb77e20643e0401c3e7 | 3,762 | https://github.com/yakyak/yakyak/blob/39e8c438d6f6401e39be9bb77e20643e0401c3e7/src/ui/views/applayout.coffee | 100 | 149 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:completion | completion | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: path.join __dirname, '..', '..', 'icons', 'icon@32.png'
... | div class:'maininfo', region('maininfo')
div class:'foot', region('foot')
attachListeners()
do ->
id = ofs = null
lastVisibleMessage = ->
# the viewport
screl = document.querySelector('.main')
# the pixel offset for the bottom of the viewport
bottom = screl.scr... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 39e8c438d6f6401e39be9bb77e20643e0401c3e7 | 3,762 | https://github.com/yakyak/yakyak/blob/39e8c438d6f6401e39be9bb77e20643e0401c3e7/src/ui/views/applayout.coffee | 100 | 149 |
yakyak/yakyak:src/ui/views/applayout.coffee:12:raw_corpus | raw_corpus | return unless id and ofs
el = document.getElementById id
nofs = topof el
# the size of the inserted elements
inserted = nofs - ofs
screl = document.querySelector('.main')
screl.scrollTop = screl.scrollTop + inserted
# reset
id = ofs = null | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 39e8c438d6f6401e39be9bb77e20643e0401c3e7 | 3,762 | https://github.com/yakyak/yakyak/blob/39e8c438d6f6401e39be9bb77e20643e0401c3e7/src/ui/views/applayout.coffee | 150 | 158 | ||
yakyak/yakyak:src/ui/views/applayout.coffee:12:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return unless id and ofs
el = document.getElementById id
nofs = topof el
# the size of the inserted elements
inserted = nofs - ofs
screl = document.querySelector('.main')
screl.scrollTop = screl.scrollTop + inserted... | var el, id, inserted, nofs, ofs, screl;
if (!(id && ofs)) {
el = document.getElementById(id);
nofs = topof(el);
// the size of the inserted elements
inserted = nofs - ofs;
screl = document.querySelector('.main');
screl.scrollTop = screl.scrollTop + inserted;
// reset
return id = ofs = null;
} | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 39e8c438d6f6401e39be9bb77e20643e0401c3e7 | 3,762 | https://github.com/yakyak/yakyak/blob/39e8c438d6f6401e39be9bb77e20643e0401c3e7/src/ui/views/applayout.coffee | 150 | 158 |
yakyak/yakyak:src/ui/views/applayout.coffee:12:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var el, id, inserted, nofs, ofs, screl;
if (!(id && ofs)) {
el = document.getElementById(id);
nofs = topof(el);
// the size of the inserted elements
inserted = nofs - ofs;
screl = document.querySelector('.main');
screl.scrollTop = screl.scrollTop + ins... | return unless id and ofs
el = document.getElementById id
nofs = topof el
# the size of the inserted elements
inserted = nofs - ofs
screl = document.querySelector('.main')
screl.scrollTop = screl.scrollTop + inserted
# reset
id = ofs = null | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 39e8c438d6f6401e39be9bb77e20643e0401c3e7 | 3,762 | https://github.com/yakyak/yakyak/blob/39e8c438d6f6401e39be9bb77e20643e0401c3e7/src/ui/views/applayout.coffee | 150 | 158 |
yakyak/yakyak:src/ui/views/applayout.coffee:12:completion | completion | return unless id and ofs
el = document.getElementById id
nofs = topof el
# the size of the inserted elements | inserted = nofs - ofs
screl = document.querySelector('.main')
screl.scrollTop = screl.scrollTop + inserted
# reset
id = ofs = null | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 39e8c438d6f6401e39be9bb77e20643e0401c3e7 | 3,762 | https://github.com/yakyak/yakyak/blob/39e8c438d6f6401e39be9bb77e20643e0401c3e7/src/ui/views/applayout.coffee | 150 | 158 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:raw_corpus | raw_corpus | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: path.join __dirname, '..', '..', 'icons', 'icon@32.png'
... | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 9d5ec987bb380d1b6e2f588f509f15fd287300c3 | 3,762 | https://github.com/yakyak/yakyak/blob/9d5ec987bb380d1b6e2f588f509f15fd287300c3/src/ui/views/applayout.coffee | 100 | 149 | ||
yakyak/yakyak:src/ui/views/applayout.coffee:11:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: pat... | var exp;
module.exports = exp = layout(function() {
var platform;
platform = process.platform === 'darwin' ? 'osx' : '';
div({
class: 'applayout ' + platform
}, resize, function() {
div({
class: 'connecting'
}, function() {
return div(function() {
div(function() {
retu... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 9d5ec987bb380d1b6e2f588f509f15fd287300c3 | 3,762 | https://github.com/yakyak/yakyak/blob/9d5ec987bb380d1b6e2f588f509f15fd287300c3/src/ui/views/applayout.coffee | 100 | 149 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var exp;
module.exports = exp = layout(function() {
var platform;
platform = process.platform === 'darwin' ? 'osx' : '';
div({
class: 'applayout ' + platform
}, resize, function() {
div({
class: 'connecting'
}, function() {
return d... | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: path.join __dirname, '..', '..', 'icons', 'icon@32.png'
... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 9d5ec987bb380d1b6e2f588f509f15fd287300c3 | 3,762 | https://github.com/yakyak/yakyak/blob/9d5ec987bb380d1b6e2f588f509f15fd287300c3/src/ui/views/applayout.coffee | 100 | 149 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:completion | completion | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: path.join __dirname, '..', '..', 'icons', 'icon@32.png'
... | div class:'maininfo', region('maininfo')
div class:'foot', region('foot')
attachListeners()
do ->
id = ofs = null
lastVisibleMessage = ->
# the viewport
screl = document.querySelector('.main')
# the pixel offset for the bottom of the viewport
bottom = screl.scr... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 9d5ec987bb380d1b6e2f588f509f15fd287300c3 | 3,762 | https://github.com/yakyak/yakyak/blob/9d5ec987bb380d1b6e2f588f509f15fd287300c3/src/ui/views/applayout.coffee | 100 | 149 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:raw_corpus | raw_corpus | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: path.join __dirname, '..', '..', 'icons', 'icon@32.png'
... | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | c8e8ea8ef81490a9ad2895665740fc93114aed08 | 3,762 | https://github.com/yakyak/yakyak/blob/c8e8ea8ef81490a9ad2895665740fc93114aed08/src/ui/views/applayout.coffee | 100 | 149 | ||
yakyak/yakyak:src/ui/views/applayout.coffee:11:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: pat... | var exp;
module.exports = exp = layout(function() {
var platform;
platform = process.platform === 'darwin' ? 'osx' : '';
div({
class: 'applayout ' + platform
}, resize, function() {
div({
class: 'connecting'
}, function() {
return div(function() {
div(function() {
retu... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | c8e8ea8ef81490a9ad2895665740fc93114aed08 | 3,762 | https://github.com/yakyak/yakyak/blob/c8e8ea8ef81490a9ad2895665740fc93114aed08/src/ui/views/applayout.coffee | 100 | 149 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var exp;
module.exports = exp = layout(function() {
var platform;
platform = process.platform === 'darwin' ? 'osx' : '';
div({
class: 'applayout ' + platform
}, resize, function() {
div({
class: 'connecting'
}, function() {
return d... | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: path.join __dirname, '..', '..', 'icons', 'icon@32.png'
... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | c8e8ea8ef81490a9ad2895665740fc93114aed08 | 3,762 | https://github.com/yakyak/yakyak/blob/c8e8ea8ef81490a9ad2895665740fc93114aed08/src/ui/views/applayout.coffee | 100 | 149 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:completion | completion | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: path.join __dirname, '..', '..', 'icons', 'icon@32.png'
... | div class:'maininfo', region('maininfo')
div class:'foot', region('foot')
attachListeners()
do ->
id = ofs = null
lastVisibleMessage = ->
# the viewport
screl = document.querySelector('.main')
# the pixel offset for the bottom of the viewport
bottom = screl.scr... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | c8e8ea8ef81490a9ad2895665740fc93114aed08 | 3,762 | https://github.com/yakyak/yakyak/blob/c8e8ea8ef81490a9ad2895665740fc93114aed08/src/ui/views/applayout.coffee | 100 | 149 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:raw_corpus | raw_corpus | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: path.join __dirname, '..', '..', 'icons', 'icon@32.png'
... | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 2a06cd3dadc6c9c2463d92f2f5b255d2648d7848 | 3,762 | https://github.com/yakyak/yakyak/blob/2a06cd3dadc6c9c2463d92f2f5b255d2648d7848/src/ui/views/applayout.coffee | 100 | 149 | ||
yakyak/yakyak:src/ui/views/applayout.coffee:11:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: pat... | var exp;
module.exports = exp = layout(function() {
var platform;
platform = process.platform === 'darwin' ? 'osx' : '';
div({
class: 'applayout ' + platform
}, resize, function() {
div({
class: 'connecting'
}, function() {
return div(function() {
div(function() {
retu... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 2a06cd3dadc6c9c2463d92f2f5b255d2648d7848 | 3,762 | https://github.com/yakyak/yakyak/blob/2a06cd3dadc6c9c2463d92f2f5b255d2648d7848/src/ui/views/applayout.coffee | 100 | 149 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var exp;
module.exports = exp = layout(function() {
var platform;
platform = process.platform === 'darwin' ? 'osx' : '';
div({
class: 'applayout ' + platform
}, resize, function() {
div({
class: 'connecting'
}, function() {
return d... | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: path.join __dirname, '..', '..', 'icons', 'icon@32.png'
... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 2a06cd3dadc6c9c2463d92f2f5b255d2648d7848 | 3,762 | https://github.com/yakyak/yakyak/blob/2a06cd3dadc6c9c2463d92f2f5b255d2648d7848/src/ui/views/applayout.coffee | 100 | 149 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:completion | completion | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: path.join __dirname, '..', '..', 'icons', 'icon@32.png'
... | div class:'maininfo', region('maininfo')
div class:'foot', region('foot')
attachListeners()
do ->
id = ofs = null
lastVisibleMessage = ->
# the viewport
screl = document.querySelector('.main')
# the pixel offset for the bottom of the viewport
bottom = screl.scr... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 2a06cd3dadc6c9c2463d92f2f5b255d2648d7848 | 3,762 | https://github.com/yakyak/yakyak/blob/2a06cd3dadc6c9c2463d92f2f5b255d2648d7848/src/ui/views/applayout.coffee | 100 | 149 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:raw_corpus | raw_corpus | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: path.join __dirname, '..', '..', 'icons', 'icon@32.png'
... | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/views/applayout.coffee | 100 | 149 | ||
yakyak/yakyak:src/ui/views/applayout.coffee:11:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: pat... | var exp;
module.exports = exp = layout(function() {
var platform;
platform = process.platform === 'darwin' ? 'osx' : '';
div({
class: 'applayout ' + platform
}, resize, function() {
div({
class: 'connecting'
}, function() {
return div(function() {
div(function() {
retu... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/views/applayout.coffee | 100 | 149 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var exp;
module.exports = exp = layout(function() {
var platform;
platform = process.platform === 'darwin' ? 'osx' : '';
div({
class: 'applayout ' + platform
}, resize, function() {
div({
class: 'connecting'
}, function() {
return d... | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: path.join __dirname, '..', '..', 'icons', 'icon@32.png'
... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/views/applayout.coffee | 100 | 149 |
yakyak/yakyak:src/ui/views/applayout.coffee:11:completion | completion | module.exports = exp = layout ->
platform = if process.platform is 'darwin' then 'osx' else ''
div class:'applayout ' + platform, resize, ->
div class: 'connecting', ->
div ->
div () ->
img src: path.join __dirname, '..', '..', 'icons', 'icon@32.png'
... | div class:'maininfo', region('maininfo')
div class:'foot', region('foot')
attachListeners()
do ->
id = ofs = null
lastVisibleMessage = ->
# the viewport
screl = document.querySelector('.main')
# the pixel offset for the bottom of the viewport
bottom = screl.scr... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/views/applayout.coffee | 100 | 149 |
yakyak/yakyak:src/ui/views/applayout.coffee:12:raw_corpus | raw_corpus | console.log 'ofs', ofs
exp.adjustMainPos = ->
return unless id and ofs
el = document.getElementById id
nofs = topof el
# the size of the inserted elements
inserted = nofs - ofs
screl = document.querySelector('.main')
screl.scrollTop = screl.scrollTop + insert... | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/views/applayout.coffee | 150 | 161 | ||
yakyak/yakyak:src/ui/views/applayout.coffee:12:completion | completion | console.log 'ofs', ofs
exp.adjustMainPos = ->
return unless id and ofs
el = document.getElementById id
nofs = topof el | # the size of the inserted elements
inserted = nofs - ofs
screl = document.querySelector('.main')
screl.scrollTop = screl.scrollTop + inserted
# reset
id = ofs = null | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/applayout.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/views/applayout.coffee | 150 | 161 |
buttercoin/buttercoin:lib/api.coffee:1:raw_corpus | raw_corpus | module.exports = class API
constructor: (@engine) ->
# websocket client to the trading engine
@engineClient = null
# stores incoming front-end sockets
@frontEndSockets = {}
# front-end server socket id
@fid = 0
send_message: ( message ) ->
#
# TODO: Send an API request to the tr... | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | c6eb8f6b9ca6cbea633614875c39b9ba5fc75614 | 663 | https://github.com/buttercoin/buttercoin/blob/c6eb8f6b9ca6cbea633614875c39b9ba5fc75614/lib/api.coffee | 7 | 56 | ||
buttercoin/buttercoin:lib/api.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class API
constructor: (@engine) ->
# websocket client to the trading engine
@engineClient = null
# stores incoming front-end sockets
@frontEndSockets = {}
# front-end server socket id
@fid = 0
send_message: ( mess... | var API;
module.exports = API = class API {
constructor(engine) {
this.engine = engine;
// websocket client to the trading engine
this.engineClient = null;
// stores incoming front-end sockets
this.frontEndSockets = {};
// front-end server socket id
this.fid = 0;
}
send_message(messa... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/api.coffee | MIT | c6eb8f6b9ca6cbea633614875c39b9ba5fc75614 | 663 | https://github.com/buttercoin/buttercoin/blob/c6eb8f6b9ca6cbea633614875c39b9ba5fc75614/lib/api.coffee | 7 | 56 |
buttercoin/buttercoin:lib/api.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var API;
module.exports = API = class API {
constructor(engine) {
this.engine = engine;
// websocket client to the trading engine
this.engineClient = null;
// stores incoming front-end sockets
this.frontEndSockets = {};
// front-end serve... | module.exports = class API
constructor: (@engine) ->
# websocket client to the trading engine
@engineClient = null
# stores incoming front-end sockets
@frontEndSockets = {}
# front-end server socket id
@fid = 0
send_message: ( message ) ->
#
# TODO: Send an API request to the tr... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | c6eb8f6b9ca6cbea633614875c39b9ba5fc75614 | 663 | https://github.com/buttercoin/buttercoin/blob/c6eb8f6b9ca6cbea633614875c39b9ba5fc75614/lib/api.coffee | 7 | 56 |
buttercoin/buttercoin:lib/api.coffee:1:completion | completion | module.exports = class API
constructor: (@engine) ->
# websocket client to the trading engine
@engineClient = null
# stores incoming front-end sockets
@frontEndSockets = {}
# front-end server socket id
@fid = 0
send_message: ( message ) ->
#
# TODO: Send an API request to the tr... | # Echo back websocket message ( for now )
# this.frontEndSockets[message.front.fid].send(JSON.stringify(message))
# add_deposit: ( args ) ->
# api = this
# deferred = Q.defer()
# args.callback = deferred.resolve
# message = [operations.ADD_DEPOSIT, args ]
# api.send_message(message)
# ... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | c6eb8f6b9ca6cbea633614875c39b9ba5fc75614 | 663 | https://github.com/buttercoin/buttercoin/blob/c6eb8f6b9ca6cbea633614875c39b9ba5fc75614/lib/api.coffee | 7 | 56 |
buttercoin/buttercoin:lib/api.coffee:2:raw_corpus | raw_corpus | # Default api.start options
options.port = options.port || 3001
options.host = options.host || "localhost"
options.engineEndpoint = options.engineEndpoint || "ws://localhost:3003/"
WebSocketServer = require('ws').Server
WebSocketClient = require('ws')
wss = new WebSocketServer({port: options.po... | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | c6eb8f6b9ca6cbea633614875c39b9ba5fc75614 | 663 | https://github.com/buttercoin/buttercoin/blob/c6eb8f6b9ca6cbea633614875c39b9ba5fc75614/lib/api.coffee | 57 | 106 | ||
buttercoin/buttercoin:lib/api.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Default api.start options
options.port = options.port || 3001
options.host = options.host || "localhost"
options.engineEndpoint = options.engineEndpoint || "ws://localhost:3003/"
WebSocketServer = require('ws').Server
WebSocketClient = requi... | // Default api.start options
var WebSocketClient, WebSocketServer, wss;
options.port = options.port || 3001;
options.host = options.host || "localhost";
options.engineEndpoint = options.engineEndpoint || "ws://localhost:3003/";
WebSocketServer = require('ws').Server;
WebSocketClient = require('ws');
wss = new Web... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/api.coffee | MIT | c6eb8f6b9ca6cbea633614875c39b9ba5fc75614 | 663 | https://github.com/buttercoin/buttercoin/blob/c6eb8f6b9ca6cbea633614875c39b9ba5fc75614/lib/api.coffee | 57 | 106 |
buttercoin/buttercoin:lib/api.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Default api.start options
var WebSocketClient, WebSocketServer, wss;
options.port = options.port || 3001;
options.host = options.host || "localhost";
options.engineEndpoint = options.engineEndpoint || "ws://localhost:3003/";
WebSocketServer = require('ws').S... | # Default api.start options
options.port = options.port || 3001
options.host = options.host || "localhost"
options.engineEndpoint = options.engineEndpoint || "ws://localhost:3003/"
WebSocketServer = require('ws').Server
WebSocketClient = require('ws')
wss = new WebSocketServer({port: options.po... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | c6eb8f6b9ca6cbea633614875c39b9ba5fc75614 | 663 | https://github.com/buttercoin/buttercoin/blob/c6eb8f6b9ca6cbea633614875c39b9ba5fc75614/lib/api.coffee | 57 | 106 |
buttercoin/buttercoin:lib/api.coffee:2:completion | completion | # Default api.start options
options.port = options.port || 3001
options.host = options.host || "localhost"
options.engineEndpoint = options.engineEndpoint || "ws://localhost:3003/"
WebSocketServer = require('ws').Server
WebSocketClient = require('ws')
wss = new WebSocketServer({port: options.po... | throw err
socket.on 'message', (message) ->
logger.data 'api server ' + process.pid + ' received message from front: ' + message
valid = false
try
message = JSON.parse message
valid = true
catch err
valid = false
# TODO: Additional validatio... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | c6eb8f6b9ca6cbea633614875c39b9ba5fc75614 | 663 | https://github.com/buttercoin/buttercoin/blob/c6eb8f6b9ca6cbea633614875c39b9ba5fc75614/lib/api.coffee | 57 | 106 |
buttercoin/buttercoin:lib/api.coffee:3:raw_corpus | raw_corpus | #
# Establish outgoing connection to VLAN websocket engine server
#
logger.info 'api attempting to log in to engine ' + options.engineEndpoint
api.engineClient = new WebSocketClient(options.engineEndpoint)
api.engineClient.on 'error', (err) ->
logger.error 'unable to connect to engine server... | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | c6eb8f6b9ca6cbea633614875c39b9ba5fc75614 | 663 | https://github.com/buttercoin/buttercoin/blob/c6eb8f6b9ca6cbea633614875c39b9ba5fc75614/lib/api.coffee | 107 | 142 | ||
buttercoin/buttercoin:lib/api.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
#
# Establish outgoing connection to VLAN websocket engine server
#
logger.info 'api attempting to log in to engine ' + options.engineEndpoint
api.engineClient = new WebSocketClient(options.engineEndpoint)
api.engineClient.on 'error', (err) ... | // Establish outgoing connection to VLAN websocket engine server
logger.info('api attempting to log in to engine ' + options.engineEndpoint);
api.engineClient = new WebSocketClient(options.engineEndpoint);
api.engineClient.on('error', function(err) {
logger.error('unable to connect to engine server ' + options.eng... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/api.coffee | MIT | c6eb8f6b9ca6cbea633614875c39b9ba5fc75614 | 663 | https://github.com/buttercoin/buttercoin/blob/c6eb8f6b9ca6cbea633614875c39b9ba5fc75614/lib/api.coffee | 107 | 142 |
buttercoin/buttercoin:lib/api.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Establish outgoing connection to VLAN websocket engine server
logger.info('api attempting to log in to engine ' + options.engineEndpoint);
api.engineClient = new WebSocketClient(options.engineEndpoint);
api.engineClient.on('error', function(err) {
logger.er... | #
# Establish outgoing connection to VLAN websocket engine server
#
logger.info 'api attempting to log in to engine ' + options.engineEndpoint
api.engineClient = new WebSocketClient(options.engineEndpoint)
api.engineClient.on 'error', (err) ->
logger.error 'unable to connect to engine server... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | c6eb8f6b9ca6cbea633614875c39b9ba5fc75614 | 663 | https://github.com/buttercoin/buttercoin/blob/c6eb8f6b9ca6cbea633614875c39b9ba5fc75614/lib/api.coffee | 107 | 142 |
buttercoin/buttercoin:lib/api.coffee:3:completion | completion | #
# Establish outgoing connection to VLAN websocket engine server
#
logger.info 'api attempting to log in to engine ' + options.engineEndpoint
api.engineClient = new WebSocketClient(options.engineEndpoint)
api.engineClient.on 'error', (err) ->
logger.error 'unable to connect to engine server... | logger.data('api ' + process.pid + ' received message from engine: ' + message);
valid = false
try
message = JSON.parse message
valid = true
catch err
valid = false
api.frontEndSockets[message[1].front.fid].send(JSON.stringify(message))
# If ther... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | c6eb8f6b9ca6cbea633614875c39b9ba5fc75614 | 663 | https://github.com/buttercoin/buttercoin/blob/c6eb8f6b9ca6cbea633614875c39b9ba5fc75614/lib/api.coffee | 107 | 142 |
buttercoin/buttercoin:lib/api.coffee:1:raw_corpus | raw_corpus | logger = require('./logger')
Dequeue = require('deque').Dequeue
Q = require('q')
# MessageHandler = require('./messagehandler')
module.exports = class Engine
constructor: ->
# @handler = new MessageHandler
@socket = null
start: ( options, callback ) ->
engine = this
# Basic currying for engine... | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | 1f186911398a725c15be4770d1a60bffb6454c4e | 663 | https://github.com/buttercoin/buttercoin/blob/1f186911398a725c15be4770d1a60bffb6454c4e/lib/api.coffee | 1 | 50 | ||
buttercoin/buttercoin:lib/api.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
logger = require('./logger')
Dequeue = require('deque').Dequeue
Q = require('q')
# MessageHandler = require('./messagehandler')
module.exports = class Engine
constructor: ->
# @handler = new MessageHandler
@socket = null
start: ( options, callback... | var Dequeue, Engine, Q, logger;
logger = require('./logger');
Dequeue = require('deque').Dequeue;
Q = require('q');
// MessageHandler = require('./messagehandler')
module.exports = Engine = class Engine {
constructor() {
// @handler = new MessageHandler
this.socket = null;
}
start(options, callback) ... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/api.coffee | MIT | 1f186911398a725c15be4770d1a60bffb6454c4e | 663 | https://github.com/buttercoin/buttercoin/blob/1f186911398a725c15be4770d1a60bffb6454c4e/lib/api.coffee | 1 | 50 |
buttercoin/buttercoin:lib/api.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Dequeue, Engine, Q, logger;
logger = require('./logger');
Dequeue = require('deque').Dequeue;
Q = require('q');
// MessageHandler = require('./messagehandler')
module.exports = Engine = class Engine {
constructor() {
// @handler = new MessageHandler
... | logger = require('./logger')
Dequeue = require('deque').Dequeue
Q = require('q')
# MessageHandler = require('./messagehandler')
module.exports = class Engine
constructor: ->
# @handler = new MessageHandler
@socket = null
start: ( options, callback ) ->
engine = this
# Basic currying for engine... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | 1f186911398a725c15be4770d1a60bffb6454c4e | 663 | https://github.com/buttercoin/buttercoin/blob/1f186911398a725c15be4770d1a60bffb6454c4e/lib/api.coffee | 1 | 50 |
buttercoin/buttercoin:lib/api.coffee:1:completion | completion | logger = require('./logger')
Dequeue = require('deque').Dequeue
Q = require('q')
# MessageHandler = require('./messagehandler')
module.exports = class Engine
constructor: ->
# @handler = new MessageHandler
@socket = null
start: ( options, callback ) ->
engine = this
# Basic currying for engine... | options.port = options.port || 3003
options.host = options.host || "0.0.0.0"
WebSocketServer = require('ws').Server
wss = new WebSocketServer({port: options.port, host: options.host});
logger.info "Buttercoin engine server started on ws://" + wss.options.host + ":" + wss.options.port
wss.on 'error... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | 1f186911398a725c15be4770d1a60bffb6454c4e | 663 | https://github.com/buttercoin/buttercoin/blob/1f186911398a725c15be4770d1a60bffb6454c4e/lib/api.coffee | 1 | 50 |
buttercoin/buttercoin:lib/api.coffee:2:raw_corpus | raw_corpus | engine.receive_message(message)
return @handler.start().then =>
callback(null, wss)
receive_message: (message) =>
console.log 'RECEIVED MESSAGE'
engine = this
# TODO: better error handling and reporting; propagate correct information
# on the success or failure of processing the request
... | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | 1f186911398a725c15be4770d1a60bffb6454c4e | 663 | https://github.com/buttercoin/buttercoin/blob/1f186911398a725c15be4770d1a60bffb6454c4e/lib/api.coffee | 51 | 70 | ||
buttercoin/buttercoin:lib/api.coffee:2:completion | completion | engine.receive_message(message)
return @handler.start().then =>
callback(null, wss)
receive_message: (message) =>
console.log 'RECEIVED MESSAGE'
engine = this
# TODO: better error handling and reporting; propagate correct information | # on the success or failure of processing the request
message[1].callback = () ->
# if there is a socket connected to the trade engine
if engine.socket
message[1].booked = true
message[1].etime = new Date().getTime() # <- stub execution time estimate ( inaccurate )
# send the mes... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | 1f186911398a725c15be4770d1a60bffb6454c4e | 663 | https://github.com/buttercoin/buttercoin/blob/1f186911398a725c15be4770d1a60bffb6454c4e/lib/api.coffee | 51 | 70 |
buttercoin/buttercoin:lib/api.coffee:2:raw_corpus | raw_corpus | # Default api.start options
options.port = options.port || 3001
options.host = options.host || "0.0.0.0"
options.engineEndpoint = options.engineEndpoint || "ws://0.0.0.0:3003/"
WebSocketServer = require('ws').Server
WebSocketClient = require('ws')
wss = new WebSocketServer({port: options.port, ... | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | 707cf2c07b9cc684e27f65864bfc04d18b3bc9e5 | 663 | https://github.com/buttercoin/buttercoin/blob/707cf2c07b9cc684e27f65864bfc04d18b3bc9e5/lib/api.coffee | 57 | 106 | ||
buttercoin/buttercoin:lib/api.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Default api.start options
options.port = options.port || 3001
options.host = options.host || "0.0.0.0"
options.engineEndpoint = options.engineEndpoint || "ws://0.0.0.0:3003/"
WebSocketServer = require('ws').Server
WebSocketClient = require('... | // Default api.start options
var WebSocketClient, WebSocketServer, wss;
options.port = options.port || 3001;
options.host = options.host || "0.0.0.0";
options.engineEndpoint = options.engineEndpoint || "ws://0.0.0.0:3003/";
WebSocketServer = require('ws').Server;
WebSocketClient = require('ws');
wss = new WebSock... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/api.coffee | MIT | 707cf2c07b9cc684e27f65864bfc04d18b3bc9e5 | 663 | https://github.com/buttercoin/buttercoin/blob/707cf2c07b9cc684e27f65864bfc04d18b3bc9e5/lib/api.coffee | 57 | 106 |
buttercoin/buttercoin:lib/api.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Default api.start options
var WebSocketClient, WebSocketServer, wss;
options.port = options.port || 3001;
options.host = options.host || "0.0.0.0";
options.engineEndpoint = options.engineEndpoint || "ws://0.0.0.0:3003/";
WebSocketServer = require('ws').Serve... | # Default api.start options
options.port = options.port || 3001
options.host = options.host || "0.0.0.0"
options.engineEndpoint = options.engineEndpoint || "ws://0.0.0.0:3003/"
WebSocketServer = require('ws').Server
WebSocketClient = require('ws')
wss = new WebSocketServer({port: options.port, ... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | 707cf2c07b9cc684e27f65864bfc04d18b3bc9e5 | 663 | https://github.com/buttercoin/buttercoin/blob/707cf2c07b9cc684e27f65864bfc04d18b3bc9e5/lib/api.coffee | 57 | 106 |
buttercoin/buttercoin:lib/api.coffee:2:completion | completion | # Default api.start options
options.port = options.port || 3001
options.host = options.host || "0.0.0.0"
options.engineEndpoint = options.engineEndpoint || "ws://0.0.0.0:3003/"
WebSocketServer = require('ws').Server
WebSocketClient = require('ws')
wss = new WebSocketServer({port: options.port, ... | throw err
socket.on 'message', (message) ->
logger.data 'api server ' + process.pid + ' received message from front: ' + message
valid = false
try
message = JSON.parse message
valid = true
catch err
valid = false
# TODO: Additional validatio... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | 707cf2c07b9cc684e27f65864bfc04d18b3bc9e5 | 663 | https://github.com/buttercoin/buttercoin/blob/707cf2c07b9cc684e27f65864bfc04d18b3bc9e5/lib/api.coffee | 57 | 106 |
buttercoin/buttercoin:lib/api.coffee:1:raw_corpus | raw_corpus | module.exports = class API
constructor: (@engine) ->
# websocket client to the trading engine
@engineClient = null
# stores incoming front-end sockets
@frontEndSockets = {}
# front-end server socket id
@fid = 0
send_message: ( message ) ->
#
# TODO: Send an API request to the tr... | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | a482811735cdfe5e5cdcecc870826baef9db021c | 663 | https://github.com/buttercoin/buttercoin/blob/a482811735cdfe5e5cdcecc870826baef9db021c/lib/api.coffee | 7 | 56 | ||
buttercoin/buttercoin:lib/api.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class API
constructor: (@engine) ->
# websocket client to the trading engine
@engineClient = null
# stores incoming front-end sockets
@frontEndSockets = {}
# front-end server socket id
@fid = 0
send_message: ( mess... | var API;
module.exports = API = class API {
constructor(engine) {
this.engine = engine;
// websocket client to the trading engine
this.engineClient = null;
// stores incoming front-end sockets
this.frontEndSockets = {};
// front-end server socket id
this.fid = 0;
}
send_message(messa... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/api.coffee | MIT | a482811735cdfe5e5cdcecc870826baef9db021c | 663 | https://github.com/buttercoin/buttercoin/blob/a482811735cdfe5e5cdcecc870826baef9db021c/lib/api.coffee | 7 | 56 |
buttercoin/buttercoin:lib/api.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var API;
module.exports = API = class API {
constructor(engine) {
this.engine = engine;
// websocket client to the trading engine
this.engineClient = null;
// stores incoming front-end sockets
this.frontEndSockets = {};
// front-end serve... | module.exports = class API
constructor: (@engine) ->
# websocket client to the trading engine
@engineClient = null
# stores incoming front-end sockets
@frontEndSockets = {}
# front-end server socket id
@fid = 0
send_message: ( message ) ->
#
# TODO: Send an API request to the tr... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | a482811735cdfe5e5cdcecc870826baef9db021c | 663 | https://github.com/buttercoin/buttercoin/blob/a482811735cdfe5e5cdcecc870826baef9db021c/lib/api.coffee | 7 | 56 |
buttercoin/buttercoin:lib/api.coffee:1:completion | completion | module.exports = class API
constructor: (@engine) ->
# websocket client to the trading engine
@engineClient = null
# stores incoming front-end sockets
@frontEndSockets = {}
# front-end server socket id
@fid = 0
send_message: ( message ) ->
#
# TODO: Send an API request to the tr... | # Echo back websocket message ( for now )
# this.frontEndSockets[message.front.fid].send(JSON.stringify(message))
add_deposit: ( args ) ->
api = this
deferred = Q.defer()
args.callback = deferred.resolve
message = [operations.ADD_DEPOSIT, args ]
api.send_message(message)
return deferre... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | a482811735cdfe5e5cdcecc870826baef9db021c | 663 | https://github.com/buttercoin/buttercoin/blob/a482811735cdfe5e5cdcecc870826baef9db021c/lib/api.coffee | 7 | 56 |
buttercoin/buttercoin:lib/api.coffee:3:raw_corpus | raw_corpus | #
# Establish outgoing connection to VLAN websocket engine server
#
logger.info 'api attempting to log in to engine ' + options.engineEndpoint
api.engineClient = new WebSocketClient(options.engineEndpoint)
api.engineClient.on 'error', (err) ->
logger.error 'unable to connect to engine server... | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | e9d873ec5723bdaf80ebe0b41b23a6be15acf981 | 663 | https://github.com/buttercoin/buttercoin/blob/e9d873ec5723bdaf80ebe0b41b23a6be15acf981/lib/api.coffee | 107 | 142 | ||
buttercoin/buttercoin:lib/api.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
#
# Establish outgoing connection to VLAN websocket engine server
#
logger.info 'api attempting to log in to engine ' + options.engineEndpoint
api.engineClient = new WebSocketClient(options.engineEndpoint)
api.engineClient.on 'error', (err) ... | // Establish outgoing connection to VLAN websocket engine server
logger.info('api attempting to log in to engine ' + options.engineEndpoint);
api.engineClient = new WebSocketClient(options.engineEndpoint);
api.engineClient.on('error', function(err) {
logger.error('unable to connect to engine server ' + options.eng... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/api.coffee | MIT | e9d873ec5723bdaf80ebe0b41b23a6be15acf981 | 663 | https://github.com/buttercoin/buttercoin/blob/e9d873ec5723bdaf80ebe0b41b23a6be15acf981/lib/api.coffee | 107 | 142 |
buttercoin/buttercoin:lib/api.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Establish outgoing connection to VLAN websocket engine server
logger.info('api attempting to log in to engine ' + options.engineEndpoint);
api.engineClient = new WebSocketClient(options.engineEndpoint);
api.engineClient.on('error', function(err) {
logger.er... | #
# Establish outgoing connection to VLAN websocket engine server
#
logger.info 'api attempting to log in to engine ' + options.engineEndpoint
api.engineClient = new WebSocketClient(options.engineEndpoint)
api.engineClient.on 'error', (err) ->
logger.error 'unable to connect to engine server... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | e9d873ec5723bdaf80ebe0b41b23a6be15acf981 | 663 | https://github.com/buttercoin/buttercoin/blob/e9d873ec5723bdaf80ebe0b41b23a6be15acf981/lib/api.coffee | 107 | 142 |
buttercoin/buttercoin:lib/api.coffee:3:completion | completion | #
# Establish outgoing connection to VLAN websocket engine server
#
logger.info 'api attempting to log in to engine ' + options.engineEndpoint
api.engineClient = new WebSocketClient(options.engineEndpoint)
api.engineClient.on 'error', (err) ->
logger.error 'unable to connect to engine server... | logger.data('api ' + process.pid + ' received message from engine: ' + message);
valid = false
try
message = JSON.parse message
valid = true
catch err
valid = false
api.frontEndSockets[message[1].front.fid].send(JSON.stringify(message))
# If ther... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/api.coffee | MIT | e9d873ec5723bdaf80ebe0b41b23a6be15acf981 | 663 | https://github.com/buttercoin/buttercoin/blob/e9d873ec5723bdaf80ebe0b41b23a6be15acf981/lib/api.coffee | 107 | 142 |
meltingice/psd.js:lib/psd/image_formats/raw.coffee:1:raw_corpus | raw_corpus | module.exports =
parseRaw: ->
@channelData.set @file.read(@length) | CoffeeScript | meltingice/psd.js | lib/psd/image_formats/raw.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/image_formats/raw.coffee | 1 | 3 | ||
meltingice/psd.js:lib/psd/image_formats/raw.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
parseRaw: ->
@channelData.set @file.read(@length)
``` | module.exports = {
parseRaw: function() {
return this.channelData.set(this.file.read(this.length));
}
}; | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/image_formats/raw.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/image_formats/raw.coffee | 1 | 3 |
meltingice/psd.js:lib/psd/image_formats/raw.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
parseRaw: function() {
return this.channelData.set(this.file.read(this.length));
}
};
``` | module.exports =
parseRaw: ->
@channelData.set @file.read(@length) | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/image_formats/raw.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/image_formats/raw.coffee | 1 | 3 |
meltingice/psd.js:lib/psd/image_formats/raw.coffee:1:raw_corpus | raw_corpus | module.exports =
parseRaw: ->
@channelData = @file.read(@length) | CoffeeScript | meltingice/psd.js | lib/psd/image_formats/raw.coffee | MIT | 4c8ab8d623693821bd73a31de24010c21bae7577 | 2,846 | https://github.com/meltingice/psd.js/blob/4c8ab8d623693821bd73a31de24010c21bae7577/lib/psd/image_formats/raw.coffee | 1 | 3 | ||
meltingice/psd.js:lib/psd/image_formats/raw.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
parseRaw: ->
@channelData = @file.read(@length)
``` | module.exports = {
parseRaw: function() {
return this.channelData = this.file.read(this.length);
}
}; | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/image_formats/raw.coffee | MIT | 4c8ab8d623693821bd73a31de24010c21bae7577 | 2,846 | https://github.com/meltingice/psd.js/blob/4c8ab8d623693821bd73a31de24010c21bae7577/lib/psd/image_formats/raw.coffee | 1 | 3 |
meltingice/psd.js:lib/psd/image_formats/raw.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
parseRaw: function() {
return this.channelData = this.file.read(this.length);
}
};
``` | module.exports =
parseRaw: ->
@channelData = @file.read(@length) | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/image_formats/raw.coffee | MIT | 4c8ab8d623693821bd73a31de24010c21bae7577 | 2,846 | https://github.com/meltingice/psd.js/blob/4c8ab8d623693821bd73a31de24010c21bae7577/lib/psd/image_formats/raw.coffee | 1 | 3 |
linemanjs/lineman:tasks/dist.coffee:1:raw_corpus | raw_corpus | ###
Task: dist
Description: runs linemans dist lifecycle tasks
Dependencies: grunt
Contributor: @davemo
###
gatherTasks = require("./../lib/gather-tasks")
module.exports = (grunt) ->
grunt.registerTask "dist", "runs linemans dist lifecycle tasks", ->
grunt.task.run(gatherTasks("dist")) | CoffeeScript | linemanjs/lineman | tasks/dist.coffee | MIT | 61d681532d9621e578d319c279006bbb728ece4b | 1,168 | https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/tasks/dist.coffee | 1 | 12 | ||
linemanjs/lineman:tasks/dist.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
Task: dist
Description: runs linemans dist lifecycle tasks
Dependencies: grunt
Contributor: @davemo
###
gatherTasks = require("./../lib/gather-tasks")
module.exports = (grunt) ->
grunt.registerTask "dist", "runs linemans dist lifecycle tasks", ->
grun... | /*
Task: dist
Description: runs linemans dist lifecycle tasks
Dependencies: grunt
Contributor: @davemo
*/
var gatherTasks;
gatherTasks = require("./../lib/gather-tasks");
module.exports = function(grunt) {
return grunt.registerTask("dist", "runs linemans dist lifecycle tasks", function() {
return grunt.task.run... | CoffeeScript | JavaScript | linemanjs/lineman | tasks/dist.coffee | MIT | 61d681532d9621e578d319c279006bbb728ece4b | 1,168 | https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/tasks/dist.coffee | 1 | 12 |
linemanjs/lineman:tasks/dist.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
Task: dist
Description: runs linemans dist lifecycle tasks
Dependencies: grunt
Contributor: @davemo
*/
var gatherTasks;
gatherTasks = require("./../lib/gather-tasks");
module.exports = function(grunt) {
return grunt.registerTask("dist", "runs linemans dist l... | ###
Task: dist
Description: runs linemans dist lifecycle tasks
Dependencies: grunt
Contributor: @davemo
###
gatherTasks = require("./../lib/gather-tasks")
module.exports = (grunt) ->
grunt.registerTask "dist", "runs linemans dist lifecycle tasks", ->
grunt.task.run(gatherTasks("dist")) | JavaScript | CoffeeScript | linemanjs/lineman | tasks/dist.coffee | MIT | 61d681532d9621e578d319c279006bbb728ece4b | 1,168 | https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/tasks/dist.coffee | 1 | 12 |
linemanjs/lineman:tasks/dist.coffee:1:completion | completion | ###
Task: dist
Description: runs linemans dist lifecycle tasks
Dependencies: grunt
Contributor: @davemo
### | gatherTasks = require("./../lib/gather-tasks")
module.exports = (grunt) ->
grunt.registerTask "dist", "runs linemans dist lifecycle tasks", ->
grunt.task.run(gatherTasks("dist")) | CoffeeScript | CoffeeScript | linemanjs/lineman | tasks/dist.coffee | MIT | 61d681532d9621e578d319c279006bbb728ece4b | 1,168 | https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/tasks/dist.coffee | 1 | 12 |
octoblu/meshblu:integration/mqtt-spec.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
path = require 'path'
meshblu = require 'meshblu'
MeshbluConfig = require 'meshblu-config'
MeshbluMQTT = require 'meshblu-mqtt'
MeshbluHTTP = require 'meshblu-http'
describe 'MQTT Events', ->
before (done) ->
filename = path.join __dirname, 'meshblu.json'
@config = new MeshbluConfig(file... | CoffeeScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/integration/mqtt-spec.coffee | 1 | 41 | ||
octoblu/meshblu:integration/mqtt-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
path = require 'path'
meshblu = require 'meshblu'
MeshbluConfig = require 'meshblu-config'
MeshbluMQTT = require 'meshblu-mqtt'
MeshbluHTTP = require 'meshblu-http'
describe 'MQTT Events', ->
before (done) ->
filename = path.join __dir... | var MeshbluConfig, MeshbluHTTP, MeshbluMQTT, _, meshblu, path;
_ = require('lodash');
path = require('path');
meshblu = require('meshblu');
MeshbluConfig = require('meshblu-config');
MeshbluMQTT = require('meshblu-mqtt');
MeshbluHTTP = require('meshblu-http');
describe('MQTT Events', function() {
before(functi... | CoffeeScript | JavaScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/integration/mqtt-spec.coffee | 1 | 41 |
octoblu/meshblu:integration/mqtt-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var MeshbluConfig, MeshbluHTTP, MeshbluMQTT, _, meshblu, path;
_ = require('lodash');
path = require('path');
meshblu = require('meshblu');
MeshbluConfig = require('meshblu-config');
MeshbluMQTT = require('meshblu-mqtt');
MeshbluHTTP = require('meshblu-http')... | _ = require 'lodash'
path = require 'path'
meshblu = require 'meshblu'
MeshbluConfig = require 'meshblu-config'
MeshbluMQTT = require 'meshblu-mqtt'
MeshbluHTTP = require 'meshblu-http'
describe 'MQTT Events', ->
before (done) ->
filename = path.join __dirname, 'meshblu.json'
@config = new MeshbluConfig(file... | JavaScript | CoffeeScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/integration/mqtt-spec.coffee | 1 | 41 |
octoblu/meshblu:integration/mqtt-spec.coffee:1:completion | completion | _ = require 'lodash'
path = require 'path'
meshblu = require 'meshblu'
MeshbluConfig = require 'meshblu-config'
MeshbluMQTT = require 'meshblu-mqtt'
MeshbluHTTP = require 'meshblu-http'
describe 'MQTT Events', ->
before (done) ->
filename = path.join __dirname, 'meshblu.json'
@config = new MeshbluConfig(file... | before (done) ->
meshbluHTTP = new MeshbluHTTP _.pick @config, 'server', 'port'
meshbluHTTP.register {}, (error, device) =>
return done error if error?
@device = device
@meshblu = new MeshbluMQTT uuid: @device.uuid, token: @device.token, hostname: @config.server
@meshblu.connect => done... | CoffeeScript | CoffeeScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/integration/mqtt-spec.coffee | 1 | 41 |
octoblu/meshblu:integration/mqtt-spec.coffee:2:raw_corpus | raw_corpus | describe 'EVENT update', ->
describe 'when called with a valid request', ->
beforeEach (done) ->
@meshblu.update uuid: @device.uuid, foo: 'bar', (error) =>
return done new Error(error.message) if error?
@meshblu.whoami (error, @updatedDevice) => done(error)
it "shoud have an... | CoffeeScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/integration/mqtt-spec.coffee | 43 | 85 | ||
octoblu/meshblu:integration/mqtt-spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'EVENT update', ->
describe 'when called with a valid request', ->
beforeEach (done) ->
@meshblu.update uuid: @device.uuid, foo: 'bar', (error) =>
return done new Error(error.message) if error?
@meshblu.whoami (error... | describe('EVENT update', function() {
return describe('when called with a valid request', function() {
beforeEach(function(done) {
return this.meshblu.update({
uuid: this.device.uuid,
foo: 'bar'
}, (error) => {
if (error != null) {
return done(new Error(error.message)... | CoffeeScript | JavaScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/integration/mqtt-spec.coffee | 43 | 85 |
octoblu/meshblu:integration/mqtt-spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('EVENT update', function() {
return describe('when called with a valid request', function() {
beforeEach(function(done) {
return this.meshblu.update({
uuid: this.device.uuid,
foo: 'bar'
}, (error) => {
if (error !=... | describe 'EVENT update', ->
describe 'when called with a valid request', ->
beforeEach (done) ->
@meshblu.update uuid: @device.uuid, foo: 'bar', (error) =>
return done new Error(error.message) if error?
@meshblu.whoami (error, @updatedDevice) => done(error)
it "shoud have an... | JavaScript | CoffeeScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/integration/mqtt-spec.coffee | 43 | 85 |
octoblu/meshblu:integration/mqtt-spec.coffee:2:completion | completion | describe 'EVENT update', ->
describe 'when called with a valid request', ->
beforeEach (done) ->
@meshblu.update uuid: @device.uuid, foo: 'bar', (error) =>
return done new Error(error.message) if error?
@meshblu.whoami (error, @updatedDevice) => done(error)
it "shoud have an... | describe 'EVENT resetToken', ->
describe 'when called with a valid request', ->
beforeEach (done) ->
meshbluHTTP = new MeshbluHTTP _.pick @config, 'server', 'port'
meshbluHTTP.register configureWhitelist: ['*'], (error, @newDevice) =>
return done error if error?
@meshblu.re... | CoffeeScript | CoffeeScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/integration/mqtt-spec.coffee | 43 | 85 |
octoblu/meshblu:integration/mqtt-spec.coffee:3:raw_corpus | raw_corpus | it 'should have a new token', ->
expect(@result.token).to.exist
describe 'when called with a valid tag request', ->
beforeEach (done) ->
meshbluHTTP = new MeshbluHTTP _.pick @config, 'server', 'port'
meshbluHTTP.register configureWhitelist: ['*'], (error, @newDevice) =>
retu... | CoffeeScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/integration/mqtt-spec.coffee | 87 | 112 | ||
octoblu/meshblu:integration/mqtt-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should have a new token', ->
expect(@result.token).to.exist
describe 'when called with a valid tag request', ->
beforeEach (done) ->
meshbluHTTP = new MeshbluHTTP _.pick @config, 'server', 'port'
meshbluHTTP.register configu... | it('should have a new token', function() {
return expect(this.result.token).to.exist;
});
describe('when called with a valid tag request', function() {
beforeEach(function(done) {
var meshbluHTTP;
meshbluHTTP = new MeshbluHTTP(_.pick(this.config, 'server', 'port'));
return meshbluHTTP.register({
... | CoffeeScript | JavaScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/integration/mqtt-spec.coffee | 87 | 112 |
octoblu/meshblu:integration/mqtt-spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should have a new token', function() {
return expect(this.result.token).to.exist;
});
describe('when called with a valid tag request', function() {
beforeEach(function(done) {
var meshbluHTTP;
meshbluHTTP = new MeshbluHTTP(_.pick(this.config, 'serv... | it 'should have a new token', ->
expect(@result.token).to.exist
describe 'when called with a valid tag request', ->
beforeEach (done) ->
meshbluHTTP = new MeshbluHTTP _.pick @config, 'server', 'port'
meshbluHTTP.register configureWhitelist: ['*'], (error, @newDevice) =>
retu... | JavaScript | CoffeeScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/integration/mqtt-spec.coffee | 87 | 112 |
octoblu/meshblu:integration/mqtt-spec.coffee:3:completion | completion | it 'should have a new token', ->
expect(@result.token).to.exist
describe 'when called with a valid tag request', ->
beforeEach (done) ->
meshbluHTTP = new MeshbluHTTP _.pick @config, 'server', 'port'
meshbluHTTP.register configureWhitelist: ['*'], (error, @newDevice) =>
retu... | expect(@result.token).to.exist
it 'should have a new token', ->
expect(@result.tag).to.equal 'some-tag'
describe 'EVENT message', ->
describe 'when called with a valid request', ->
beforeEach (done) ->
@meshblu.message devices: [@device.uuid], topic: 'sweet'
@meshblu.on 'mess... | CoffeeScript | CoffeeScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/integration/mqtt-spec.coffee | 87 | 112 |
octoblu/meshblu:integration/mqtt-spec.coffee:2:raw_corpus | raw_corpus | describe 'EVENT update', ->
describe 'when called with a valid request', ->
beforeEach (done) ->
@meshblu.update uuid: @device.uuid, foo: 'bar', (error) =>
return done new Error(error.message) if error?
@meshblu.whoami (error, @updatedDevice) => done(error)
it "shoud have an... | CoffeeScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 2dbca05c1c3664f82f2e0911a4a9c657ec4b6e20 | 815 | https://github.com/octoblu/meshblu/blob/2dbca05c1c3664f82f2e0911a4a9c657ec4b6e20/integration/mqtt-spec.coffee | 43 | 85 | ||
octoblu/meshblu:integration/mqtt-spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'EVENT update', ->
describe 'when called with a valid request', ->
beforeEach (done) ->
@meshblu.update uuid: @device.uuid, foo: 'bar', (error) =>
return done new Error(error.message) if error?
@meshblu.whoami (error... | describe('EVENT update', function() {
return describe('when called with a valid request', function() {
beforeEach(function(done) {
return this.meshblu.update({
uuid: this.device.uuid,
foo: 'bar'
}, (error) => {
if (error != null) {
return done(new Error(error.message)... | CoffeeScript | JavaScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 2dbca05c1c3664f82f2e0911a4a9c657ec4b6e20 | 815 | https://github.com/octoblu/meshblu/blob/2dbca05c1c3664f82f2e0911a4a9c657ec4b6e20/integration/mqtt-spec.coffee | 43 | 85 |
octoblu/meshblu:integration/mqtt-spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('EVENT update', function() {
return describe('when called with a valid request', function() {
beforeEach(function(done) {
return this.meshblu.update({
uuid: this.device.uuid,
foo: 'bar'
}, (error) => {
if (error !=... | describe 'EVENT update', ->
describe 'when called with a valid request', ->
beforeEach (done) ->
@meshblu.update uuid: @device.uuid, foo: 'bar', (error) =>
return done new Error(error.message) if error?
@meshblu.whoami (error, @updatedDevice) => done(error)
it "shoud have an... | JavaScript | CoffeeScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 2dbca05c1c3664f82f2e0911a4a9c657ec4b6e20 | 815 | https://github.com/octoblu/meshblu/blob/2dbca05c1c3664f82f2e0911a4a9c657ec4b6e20/integration/mqtt-spec.coffee | 43 | 85 |
octoblu/meshblu:integration/mqtt-spec.coffee:2:completion | completion | describe 'EVENT update', ->
describe 'when called with a valid request', ->
beforeEach (done) ->
@meshblu.update uuid: @device.uuid, foo: 'bar', (error) =>
return done new Error(error.message) if error?
@meshblu.whoami (error, @updatedDevice) => done(error)
it "shoud have an... | describe 'EVENT resetToken', ->
describe 'when called with a valid request', ->
beforeEach (done) ->
meshbluHTTP = new MeshbluHTTP _.pick @config, 'server', 'port'
meshbluHTTP.register configWhitelist: ['*'], (error, @newDevice) =>
return done error if error?
@meshblu.reset... | CoffeeScript | CoffeeScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 2dbca05c1c3664f82f2e0911a4a9c657ec4b6e20 | 815 | https://github.com/octoblu/meshblu/blob/2dbca05c1c3664f82f2e0911a4a9c657ec4b6e20/integration/mqtt-spec.coffee | 43 | 85 |
octoblu/meshblu:integration/mqtt-spec.coffee:3:raw_corpus | raw_corpus | it 'should have a new token', ->
expect(@data.token).to.exist
describe 'EVENT message', ->
describe 'when called with a valid request', ->
beforeEach (done) ->
@meshblu.message devices: [@device.uuid], topic: 'sweet'
@meshblu.on 'message', (@message) => done() if @message.topic == '... | CoffeeScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 2dbca05c1c3664f82f2e0911a4a9c657ec4b6e20 | 815 | https://github.com/octoblu/meshblu/blob/2dbca05c1c3664f82f2e0911a4a9c657ec4b6e20/integration/mqtt-spec.coffee | 87 | 97 | ||
octoblu/meshblu:integration/mqtt-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should have a new token', ->
expect(@data.token).to.exist
describe 'EVENT message', ->
describe 'when called with a valid request', ->
beforeEach (done) ->
@meshblu.message devices: [@device.uuid], topic: 'sweet'
@meshblu.... | it('should have a new token', function() {
return expect(this.data.token).to.exist;
});
describe('EVENT message', function() {
return describe('when called with a valid request', function() {
beforeEach(function(done) {
this.meshblu.message({
devices: [this.device.uuid],
topic: 'sweet'
... | CoffeeScript | JavaScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 2dbca05c1c3664f82f2e0911a4a9c657ec4b6e20 | 815 | https://github.com/octoblu/meshblu/blob/2dbca05c1c3664f82f2e0911a4a9c657ec4b6e20/integration/mqtt-spec.coffee | 87 | 97 |
octoblu/meshblu:integration/mqtt-spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should have a new token', function() {
return expect(this.data.token).to.exist;
});
describe('EVENT message', function() {
return describe('when called with a valid request', function() {
beforeEach(function(done) {
this.meshblu.message({
... | it 'should have a new token', ->
expect(@data.token).to.exist
describe 'EVENT message', ->
describe 'when called with a valid request', ->
beforeEach (done) ->
@meshblu.message devices: [@device.uuid], topic: 'sweet'
@meshblu.on 'message', (@message) => done() if @message.topic == '... | JavaScript | CoffeeScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 2dbca05c1c3664f82f2e0911a4a9c657ec4b6e20 | 815 | https://github.com/octoblu/meshblu/blob/2dbca05c1c3664f82f2e0911a4a9c657ec4b6e20/integration/mqtt-spec.coffee | 87 | 97 |
octoblu/meshblu:integration/mqtt-spec.coffee:3:completion | completion | it 'should have a new token', ->
expect(@data.token).to.exist
describe 'EVENT message', ->
describe 'when called with a valid request', -> | beforeEach (done) ->
@meshblu.message devices: [@device.uuid], topic: 'sweet'
@meshblu.on 'message', (@message) => done() if @message.topic == 'sweet'
it 'should have the correct message', ->
expect(@message.devices).to.deep.equal [@device.uuid] | CoffeeScript | CoffeeScript | octoblu/meshblu | integration/mqtt-spec.coffee | MIT | 2dbca05c1c3664f82f2e0911a4a9c657ec4b6e20 | 815 | https://github.com/octoblu/meshblu/blob/2dbca05c1c3664f82f2e0911a4a9c657ec4b6e20/integration/mqtt-spec.coffee | 87 | 97 |
jashkenas/coffeescript:test/numeric_literal_separators.coffee:1:raw_corpus | raw_corpus | # Numeric Literal Separators
# --------------------------
test 'integer literals with separators', ->
eq 123_456, 123456
eq 12_34_56, 123456
test 'decimal literals with separators', ->
eq 1_2.34_5, 12.345
eq 1_0e1_0, 10e10
eq 1_2.34_5e6_7, 12.345e67
test 'hexadecimal literals with separators', ->
eq 0x1_... | CoffeeScript | jashkenas/coffeescript | test/numeric_literal_separators.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/numeric_literal_separators.coffee | 1 | 50 | ||
jashkenas/coffeescript:test/numeric_literal_separators.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Numeric Literal Separators
# --------------------------
test 'integer literals with separators', ->
eq 123_456, 123456
eq 12_34_56, 123456
test 'decimal literals with separators', ->
eq 1_2.34_5, 12.345
eq 1_0e1_0, 10e10
eq 1_2.34_5e6_7, 12.345e67
... | // Numeric Literal Separators
// --------------------------
test('integer literals with separators', function() {
eq(123_456, 123456);
return eq(12_34_56, 123456);
});
test('decimal literals with separators', function() {
eq(1_2.34_5, 12.345);
eq(1_0e1_0, 10e10);
return eq(1_2.34_5e6_7, 12.345e67);
});
test... | CoffeeScript | JavaScript | jashkenas/coffeescript | test/numeric_literal_separators.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/numeric_literal_separators.coffee | 1 | 50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.