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/app.coffee:4:completion | completion | contextmenu.popup remote.getCurrentWindow()
return
), false
# tell the startup state | action 'wonline', window.navigator.onLine
if process.platform == 'win32'
script = document.createElement('script')
script.src = 'http://twemoji.maxcdn.com/2/twemoji.min.js'
document.head.appendChild(script) | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | 553c76e3aaaf5c7abbc8efbad602aa446bd1a5dd | 3,762 | https://github.com/yakyak/yakyak/blob/553c76e3aaaf5c7abbc8efbad602aa446bd1a5dd/src/ui/app.coffee | 166 | 176 |
yakyak/yakyak:src/ui/app.coffee:2:raw_corpus | raw_corpus | mainWindow.show()
# wire up stuff from server
ipc.on 'init', (ev, data) -> dispatcher.init data
# events from hangupsjs
require('./events').forEach (n) -> ipc.on n, (ev, data) -> action n, data
# response from getentity
ipc.on 'getentity:result', (ev, r, data) ->
action 'addentities', r.entities, data?.add_to_conv... | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | c48f66bc5abd56282f13acb0089209620e2fdf45 | 3,762 | https://github.com/yakyak/yakyak/blob/c48f66bc5abd56282f13acb0089209620e2fdf45/src/ui/app.coffee | 66 | 115 | ||
yakyak/yakyak:src/ui/app.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
mainWindow.show()
# wire up stuff from server
ipc.on 'init', (ev, data) -> dispatcher.init data
# events from hangupsjs
require('./events').forEach (n) -> ipc.on n, (ev, data) -> action n, data
# response from getentity
ipc.on 'getentity:result', (ev, r, data) -... | mainWindow.show();
// wire up stuff from server
ipc.on('init', function(ev, data) {
return dispatcher.init(data);
});
// events from hangupsjs
require('./events').forEach(function(n) {
return ipc.on(n, function(ev, data) {
return action(n, data);
});
});
// response from getentity
ipc.on('getentity:result'... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/app.coffee | MIT | c48f66bc5abd56282f13acb0089209620e2fdf45 | 3,762 | https://github.com/yakyak/yakyak/blob/c48f66bc5abd56282f13acb0089209620e2fdf45/src/ui/app.coffee | 66 | 115 |
yakyak/yakyak:src/ui/app.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
mainWindow.show();
// wire up stuff from server
ipc.on('init', function(ev, data) {
return dispatcher.init(data);
});
// events from hangupsjs
require('./events').forEach(function(n) {
return ipc.on(n, function(ev, data) {
return action(n, data);
});
})... | mainWindow.show()
# wire up stuff from server
ipc.on 'init', (ev, data) -> dispatcher.init data
# events from hangupsjs
require('./events').forEach (n) -> ipc.on n, (ev, data) -> action n, data
# response from getentity
ipc.on 'getentity:result', (ev, r, data) ->
action 'addentities', r.entities, data?.add_to_conv... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | c48f66bc5abd56282f13acb0089209620e2fdf45 | 3,762 | https://github.com/yakyak/yakyak/blob/c48f66bc5abd56282f13acb0089209620e2fdf45/src/ui/app.coffee | 66 | 115 |
yakyak/yakyak:src/ui/app.coffee:2:completion | completion | mainWindow.show()
# wire up stuff from server
ipc.on 'init', (ev, data) -> dispatcher.init data
# events from hangupsjs
require('./events').forEach (n) -> ipc.on n, (ev, data) -> action n, data
# response from getentity
ipc.on 'getentity:result', (ev, r, data) ->
action 'addentities', r.entities, data?.add_to_conv... | # init dispatcher/controller
require './dispatcher'
require './views/controller'
# request init this is not happening when
# the server is just connecting, but for
# dev mode when we reload the page
action 'reqinit'
# register event listeners for on/offline
window.addEventListener 'online', -> action 'wonline', true... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | c48f66bc5abd56282f13acb0089209620e2fdf45 | 3,762 | https://github.com/yakyak/yakyak/blob/c48f66bc5abd56282f13acb0089209620e2fdf45/src/ui/app.coffee | 66 | 115 |
yakyak/yakyak:src/ui/app.coffee:3:raw_corpus | raw_corpus | action 'quit'
# Listen to close and quit events
window.addEventListener 'beforeunload', (e) ->
if remote.getGlobal('forceClose')
return
hide = (
# Mac os and the dock have a special relationship
(process.platform == 'darwin' && !viewstate.hidedockicon) ||
# Handle the close to ... | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | c48f66bc5abd56282f13acb0089209620e2fdf45 | 3,762 | https://github.com/yakyak/yakyak/blob/c48f66bc5abd56282f13acb0089209620e2fdf45/src/ui/app.coffee | 116 | 147 | ||
yakyak/yakyak:src/ui/app.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
action 'quit'
# Listen to close and quit events
window.addEventListener 'beforeunload', (e) ->
if remote.getGlobal('forceClose')
return
hide = (
# Mac os and the dock have a special relationship
(process.platform == 'darwin' && !... | var script;
action('quit');
// Listen to close and quit events
window.addEventListener('beforeunload', function(e) {
var hide;
if (remote.getGlobal('forceClose')) {
return;
}
// Mac os and the dock have a special relationship
// Handle the close to tray action
hide = (process.platform === 'darwin' && ... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/app.coffee | MIT | c48f66bc5abd56282f13acb0089209620e2fdf45 | 3,762 | https://github.com/yakyak/yakyak/blob/c48f66bc5abd56282f13acb0089209620e2fdf45/src/ui/app.coffee | 116 | 147 |
yakyak/yakyak:src/ui/app.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var script;
action('quit');
// Listen to close and quit events
window.addEventListener('beforeunload', function(e) {
var hide;
if (remote.getGlobal('forceClose')) {
return;
}
// Mac os and the dock have a special relationship
// Handle the close to ... | action 'quit'
# Listen to close and quit events
window.addEventListener 'beforeunload', (e) ->
if remote.getGlobal('forceClose')
return
hide = (
# Mac os and the dock have a special relationship
(process.platform == 'darwin' && !viewstate.hidedockicon) ||
# Handle the close to ... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | c48f66bc5abd56282f13acb0089209620e2fdf45 | 3,762 | https://github.com/yakyak/yakyak/blob/c48f66bc5abd56282f13acb0089209620e2fdf45/src/ui/app.coffee | 116 | 147 |
yakyak/yakyak:src/ui/app.coffee:3:completion | completion | action 'quit'
# Listen to close and quit events
window.addEventListener 'beforeunload', (e) ->
if remote.getGlobal('forceClose')
return
hide = (
# Mac os and the dock have a special relationship
(process.platform == 'darwin' && !viewstate.hidedockicon) ||
# Handle the close to ... | remote.getCurrentWindow().hide()
return
window.addEventListener 'contextmenu', ((e) ->
e.preventDefault()
contextmenu.popup remote.getCurrentWindow()
return
), false
# tell the startup state
action 'wonline', window.navigator.onLine
if process.platform == 'win32'
script = document.createEle... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | c48f66bc5abd56282f13acb0089209620e2fdf45 | 3,762 | https://github.com/yakyak/yakyak/blob/c48f66bc5abd56282f13acb0089209620e2fdf45/src/ui/app.coffee | 116 | 147 |
yakyak/yakyak:src/ui/app.coffee:1:raw_corpus | raw_corpus | window.onerror = (msg, url, lineNo, columnNo, error) ->
hash = {msg, url, lineNo, columnNo, error}
ipc.send 'errorInWindow', hash
# expose some selected tagg functions
trifl.tagg.expose window, ('ul li div span a i b u s button p label
input table thead tbody tr td th textarea br pass img h1 h2 h3 h4
hr'.split... | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | 760ad750b880ff5f2b41e497ddb3b03b7743b7af | 3,762 | https://github.com/yakyak/yakyak/blob/760ad750b880ff5f2b41e497ddb3b03b7743b7af/src/ui/app.coffee | 16 | 65 | ||
yakyak/yakyak:src/ui/app.coffee:1:completion | completion | window.onerror = (msg, url, lineNo, columnNo, error) ->
hash = {msg, url, lineNo, columnNo, error}
ipc.send 'errorInWindow', hash
# expose some selected tagg functions
trifl.tagg.expose window, ('ul li div span a i b u s button p label
input table thead tbody tr td th textarea br pass img h1 h2 h3 h4
hr'.split... | # intercept every event we listen to
# to make an 'alive' action to know
# the server is alive
do ->
ipcon = ipc.on.bind(ipc)
ipc.on = (n, fn) ->
ipcon n, (as...) ->
action 'alive', Date.now()
fn as...
# called when window is ready to show
# note: could not use event here, as i... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | 760ad750b880ff5f2b41e497ddb3b03b7743b7af | 3,762 | https://github.com/yakyak/yakyak/blob/760ad750b880ff5f2b41e497ddb3b03b7743b7af/src/ui/app.coffee | 16 | 65 |
yakyak/yakyak:src/ui/app.coffee:1:raw_corpus | raw_corpus | window.onerror = (msg, url, lineNo, columnNo, error) ->
hash = {msg, url, lineNo, columnNo, error}
ipc.send 'errorInWindow', hash
# expose some selected tagg functions
trifl.tagg.expose window, ('ul li div span a i b u s button p label
input table thead tbody tr td th textarea br pass img h1 h2 h3 h4
hr'.split... | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/app.coffee | 16 | 65 | ||
yakyak/yakyak:src/ui/app.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
window.onerror = (msg, url, lineNo, columnNo, error) ->
hash = {msg, url, lineNo, columnNo, error}
ipc.send 'errorInWindow', hash
# expose some selected tagg functions
trifl.tagg.expose window, ('ul li div span a i b u s button p label
input table thead ... | var applayout, contextmenu, conv, trayicon, viewstate;
window.onerror = function(msg, url, lineNo, columnNo, error) {
var hash;
hash = {msg, url, lineNo, columnNo, error};
return ipc.send('errorInWindow', hash);
};
// expose some selected tagg functions
trifl.tagg.expose(window, ...('ul li div span a i b u s bu... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/app.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/app.coffee | 16 | 65 |
yakyak/yakyak:src/ui/app.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var applayout, contextmenu, conv, trayicon, viewstate;
window.onerror = function(msg, url, lineNo, columnNo, error) {
var hash;
hash = {msg, url, lineNo, columnNo, error};
return ipc.send('errorInWindow', hash);
};
// expose some selected tagg functions
tri... | window.onerror = (msg, url, lineNo, columnNo, error) ->
hash = {msg, url, lineNo, columnNo, error}
ipc.send 'errorInWindow', hash
# expose some selected tagg functions
trifl.tagg.expose window, ('ul li div span a i b u s button p label
input table thead tbody tr td th textarea br pass img h1 h2 h3 h4
hr'.split... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/app.coffee | 16 | 65 |
yakyak/yakyak:src/ui/app.coffee:1:completion | completion | window.onerror = (msg, url, lineNo, columnNo, error) ->
hash = {msg, url, lineNo, columnNo, error}
ipc.send 'errorInWindow', hash
# expose some selected tagg functions
trifl.tagg.expose window, ('ul li div span a i b u s button p label
input table thead tbody tr td th textarea br pass img h1 h2 h3 h4
hr'.split... | # intercept every event we listen to
# to make an 'alive' action to know
# the server is alive
do ->
ipcon = ipc.on.bind(ipc)
ipc.on = (n, fn) ->
ipcon n, (as...) ->
action 'alive', Date.now()
fn as...
# called when window is ready to show
# note: could not use event here, as i... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/app.coffee | 16 | 65 |
yakyak/yakyak:src/ui/app.coffee:2:raw_corpus | raw_corpus | ipc.on 'getentity:result', (ev, r, data) ->
action 'addentities', r.entities, data?.add_to_conv
ipc.on 'resize', (ev, dim) -> action 'resize', dim
ipc.on 'move', (ev, pos) -> action 'move', pos
ipc.on 'searchentities:result', (ev, r) ->
action 'setsearchedentities', r.entity
ipc.on 'createconversation:result... | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/app.coffee | 66 | 115 | ||
yakyak/yakyak:src/ui/app.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
ipc.on 'getentity:result', (ev, r, data) ->
action 'addentities', r.entities, data?.add_to_conv
ipc.on 'resize', (ev, dim) -> action 'resize', dim
ipc.on 'move', (ev, pos) -> action 'move', pos
ipc.on 'searchentities:result', (ev, r) ->
action 'setsear... | ipc.on('getentity:result', function(ev, r, data) {
return action('addentities', r.entities, data != null ? data.add_to_conv : void 0);
});
ipc.on('resize', function(ev, dim) {
return action('resize', dim);
});
ipc.on('move', function(ev, pos) {
return action('move', pos);
});
ipc.on('searchentities:result', fu... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/app.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/app.coffee | 66 | 115 |
yakyak/yakyak:src/ui/app.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
ipc.on('getentity:result', function(ev, r, data) {
return action('addentities', r.entities, data != null ? data.add_to_conv : void 0);
});
ipc.on('resize', function(ev, dim) {
return action('resize', dim);
});
ipc.on('move', function(ev, pos) {
return actio... | ipc.on 'getentity:result', (ev, r, data) ->
action 'addentities', r.entities, data?.add_to_conv
ipc.on 'resize', (ev, dim) -> action 'resize', dim
ipc.on 'move', (ev, pos) -> action 'move', pos
ipc.on 'searchentities:result', (ev, r) ->
action 'setsearchedentities', r.entity
ipc.on 'createconversation:result... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/app.coffee | 66 | 115 |
yakyak/yakyak:src/ui/app.coffee:2:completion | completion | ipc.on 'getentity:result', (ev, r, data) ->
action 'addentities', r.entities, data?.add_to_conv
ipc.on 'resize', (ev, dim) -> action 'resize', dim
ipc.on 'move', (ev, pos) -> action 'move', pos
ipc.on 'searchentities:result', (ev, r) ->
action 'setsearchedentities', r.entity
ipc.on 'createconversation:result... | require './views/controller'
# request init this is not happening when
# the server is just connecting, but for
# dev mode when we reload the page
action 'reqinit'
# register event listeners for on/offline
window.addEventListener 'online', -> action 'wonline', true
window.addEventListener 'offline', -> action 'wonli... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/app.coffee | 66 | 115 |
yakyak/yakyak:src/ui/app.coffee:3:raw_corpus | raw_corpus | window.addEventListener 'beforeunload', (e) ->
if remote.getGlobal('forceClose')
return
hide = (
# Mac os and the dock have a special relationship
(process.platform == 'darwin' && !viewstate.hidedockicon) ||
# Handle the close to tray action
viewstate.closetotray
)
... | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/app.coffee | 116 | 144 | ||
yakyak/yakyak:src/ui/app.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
window.addEventListener 'beforeunload', (e) ->
if remote.getGlobal('forceClose')
return
hide = (
# Mac os and the dock have a special relationship
(process.platform == 'darwin' && !viewstate.hidedockicon) ||
# Handle the c... | var script;
window.addEventListener('beforeunload', function(e) {
var hide;
if (remote.getGlobal('forceClose')) {
return;
}
// Mac os and the dock have a special relationship
// Handle the close to tray action
hide = (process.platform === 'darwin' && !viewstate.hidedockicon) || viewstate.closetotray;
... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/app.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/app.coffee | 116 | 144 |
yakyak/yakyak:src/ui/app.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var script;
window.addEventListener('beforeunload', function(e) {
var hide;
if (remote.getGlobal('forceClose')) {
return;
}
// Mac os and the dock have a special relationship
// Handle the close to tray action
hide = (process.platform === 'darwin' ... | window.addEventListener 'beforeunload', (e) ->
if remote.getGlobal('forceClose')
return
hide = (
# Mac os and the dock have a special relationship
(process.platform == 'darwin' && !viewstate.hidedockicon) ||
# Handle the close to tray action
viewstate.closetotray
)
... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/app.coffee | 116 | 144 |
yakyak/yakyak:src/ui/app.coffee:3:completion | completion | window.addEventListener 'beforeunload', (e) ->
if remote.getGlobal('forceClose')
return
hide = (
# Mac os and the dock have a special relationship
(process.platform == 'darwin' && !viewstate.hidedockicon) ||
# Handle the close to tray action
viewstate.closetotray
)
... | return
window.addEventListener 'contextmenu', ((e) ->
e.preventDefault()
contextmenu.popup remote.getCurrentWindow()
return
), false
# tell the startup state
action 'wonline', window.navigator.onLine
if process.platform == 'win32'
script = document.createElement('script')
script.src = 'http... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/app.coffee | MIT | 4da5592e0fd7d42712ea03de5b50b2a4f71a5c55 | 3,762 | https://github.com/yakyak/yakyak/blob/4da5592e0fd7d42712ea03de5b50b2a4f71a5c55/src/ui/app.coffee | 116 | 144 |
octoblu/meshblu:test/lib/messageIOClient-spec.coffee:1:raw_corpus | raw_corpus | config = require '../../config'
MessageIOClient = require '../../lib/messageIOClient'
describe 'MessageIOClient', ->
beforeEach ->
@socketIOClient =
on: sinon.spy()
connect: sinon.spy()
close: sinon.spy()
emit: sinon.spy()
@FakeSocketIOClient = sinon.spy => @socketIOClient
@sut = ... | CoffeeScript | octoblu/meshblu | test/lib/messageIOClient-spec.coffee | MIT | 74b9692b0d7753855e99587fb5ea06058ab0074a | 815 | https://github.com/octoblu/meshblu/blob/74b9692b0d7753855e99587fb5ea06058ab0074a/test/lib/messageIOClient-spec.coffee | 1 | 40 | ||
octoblu/meshblu:test/lib/messageIOClient-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
config = require '../../config'
MessageIOClient = require '../../lib/messageIOClient'
describe 'MessageIOClient', ->
beforeEach ->
@socketIOClient =
on: sinon.spy()
connect: sinon.spy()
close: sinon.spy()
emit: sinon.spy()
@Fake... | var MessageIOClient, config;
config = require('../../config');
MessageIOClient = require('../../lib/messageIOClient');
describe('MessageIOClient', function() {
beforeEach(function() {
this.socketIOClient = {
on: sinon.spy(),
connect: sinon.spy(),
close: sinon.spy(),
emit: sinon.spy()
... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/messageIOClient-spec.coffee | MIT | 74b9692b0d7753855e99587fb5ea06058ab0074a | 815 | https://github.com/octoblu/meshblu/blob/74b9692b0d7753855e99587fb5ea06058ab0074a/test/lib/messageIOClient-spec.coffee | 1 | 40 |
octoblu/meshblu:test/lib/messageIOClient-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var MessageIOClient, config;
config = require('../../config');
MessageIOClient = require('../../lib/messageIOClient');
describe('MessageIOClient', function() {
beforeEach(function() {
this.socketIOClient = {
on: sinon.spy(),
connect: sinon.spy(... | config = require '../../config'
MessageIOClient = require '../../lib/messageIOClient'
describe 'MessageIOClient', ->
beforeEach ->
@socketIOClient =
on: sinon.spy()
connect: sinon.spy()
close: sinon.spy()
emit: sinon.spy()
@FakeSocketIOClient = sinon.spy => @socketIOClient
@sut = ... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/messageIOClient-spec.coffee | MIT | 74b9692b0d7753855e99587fb5ea06058ab0074a | 815 | https://github.com/octoblu/meshblu/blob/74b9692b0d7753855e99587fb5ea06058ab0074a/test/lib/messageIOClient-spec.coffee | 1 | 40 |
octoblu/meshblu:test/lib/messageIOClient-spec.coffee:1:completion | completion | config = require '../../config'
MessageIOClient = require '../../lib/messageIOClient'
describe 'MessageIOClient', ->
beforeEach ->
@socketIOClient =
on: sinon.spy()
connect: sinon.spy()
close: sinon.spy()
emit: sinon.spy()
@FakeSocketIOClient = sinon.spy => @socketIOClient
@sut = ... | @sut.close()
it 'should call close on socketIOClient', ->
expect(@socketIOClient.close).to.have.been.called
describe '.start', ->
beforeEach ->
@sut.start()
it 'should create a socketIOClient', ->
expect(@FakeSocketIOClient).to.have.been.calledWith "ws://localhost:#{config.messageBus.... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/messageIOClient-spec.coffee | MIT | 74b9692b0d7753855e99587fb5ea06058ab0074a | 815 | https://github.com/octoblu/meshblu/blob/74b9692b0d7753855e99587fb5ea06058ab0074a/test/lib/messageIOClient-spec.coffee | 1 | 40 |
octoblu/meshblu:test/lib/messageIOClient-spec.coffee:2:raw_corpus | raw_corpus | it 'should map config', ->
expect(@socketIOClient.on).to.have.been.calledWith 'config'
describe 'subscribe', ->
describe 'received only', ->
beforeEach ->
@sut.start()
@sut.subscribe 'apple', ['received']
it 'should call emit on socketIOClient', ->
expect(@socketIOClien... | CoffeeScript | octoblu/meshblu | test/lib/messageIOClient-spec.coffee | MIT | 74b9692b0d7753855e99587fb5ea06058ab0074a | 815 | https://github.com/octoblu/meshblu/blob/74b9692b0d7753855e99587fb5ea06058ab0074a/test/lib/messageIOClient-spec.coffee | 42 | 82 | ||
octoblu/meshblu:test/lib/messageIOClient-spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should map config', ->
expect(@socketIOClient.on).to.have.been.calledWith 'config'
describe 'subscribe', ->
describe 'received only', ->
beforeEach ->
@sut.start()
@sut.subscribe 'apple', ['received']
it 'should call ... | it('should map config', function() {
return expect(this.socketIOClient.on).to.have.been.calledWith('config');
});
describe('subscribe', function() {
describe('received only', function() {
beforeEach(function() {
this.sut.start();
return this.sut.subscribe('apple', ['received']);
});
return ... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/messageIOClient-spec.coffee | MIT | 74b9692b0d7753855e99587fb5ea06058ab0074a | 815 | https://github.com/octoblu/meshblu/blob/74b9692b0d7753855e99587fb5ea06058ab0074a/test/lib/messageIOClient-spec.coffee | 42 | 82 |
octoblu/meshblu:test/lib/messageIOClient-spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should map config', function() {
return expect(this.socketIOClient.on).to.have.been.calledWith('config');
});
describe('subscribe', function() {
describe('received only', function() {
beforeEach(function() {
this.sut.start();
return this.su... | it 'should map config', ->
expect(@socketIOClient.on).to.have.been.calledWith 'config'
describe 'subscribe', ->
describe 'received only', ->
beforeEach ->
@sut.start()
@sut.subscribe 'apple', ['received']
it 'should call emit on socketIOClient', ->
expect(@socketIOClien... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/messageIOClient-spec.coffee | MIT | 74b9692b0d7753855e99587fb5ea06058ab0074a | 815 | https://github.com/octoblu/meshblu/blob/74b9692b0d7753855e99587fb5ea06058ab0074a/test/lib/messageIOClient-spec.coffee | 42 | 82 |
octoblu/meshblu:test/lib/messageIOClient-spec.coffee:2:completion | completion | it 'should map config', ->
expect(@socketIOClient.on).to.have.been.calledWith 'config'
describe 'subscribe', ->
describe 'received only', ->
beforeEach ->
@sut.start()
@sut.subscribe 'apple', ['received']
it 'should call emit on socketIOClient', ->
expect(@socketIOClien... | describe 'broadcast only', ->
beforeEach ->
@sut.start()
@sut.subscribe 'pear', ['broadcast']
it 'should call emit on socketIOClient', ->
expect(@socketIOClient.emit).to.have.been.calledWith 'subscribe', 'pear_bc'
describe 'all kinds', ->
beforeEach ->
@sut.start(... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/messageIOClient-spec.coffee | MIT | 74b9692b0d7753855e99587fb5ea06058ab0074a | 815 | https://github.com/octoblu/meshblu/blob/74b9692b0d7753855e99587fb5ea06058ab0074a/test/lib/messageIOClient-spec.coffee | 42 | 82 |
octoblu/meshblu:test/lib/messageIOClient-spec.coffee:3:raw_corpus | raw_corpus | describe 'unsubscribe', ->
describe 'received only', ->
beforeEach ->
@sut.start()
@sut.unsubscribe 'banana', ['received']
it 'should call emit on socketIOClient', ->
expect(@socketIOClient.emit).to.have.been.calledWith 'unsubscribe', 'banana'
describe 'sent only', ->
... | CoffeeScript | octoblu/meshblu | test/lib/messageIOClient-spec.coffee | MIT | 74b9692b0d7753855e99587fb5ea06058ab0074a | 815 | https://github.com/octoblu/meshblu/blob/74b9692b0d7753855e99587fb5ea06058ab0074a/test/lib/messageIOClient-spec.coffee | 84 | 121 | ||
octoblu/meshblu:test/lib/messageIOClient-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'unsubscribe', ->
describe 'received only', ->
beforeEach ->
@sut.start()
@sut.unsubscribe 'banana', ['received']
it 'should call emit on socketIOClient', ->
expect(@socketIOClient.emit).to.have.been.calledWith 'u... | describe('unsubscribe', function() {
describe('received only', function() {
beforeEach(function() {
this.sut.start();
return this.sut.unsubscribe('banana', ['received']);
});
return it('should call emit on socketIOClient', function() {
return expect(this.socketIOClient.emit).to.have.been... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/messageIOClient-spec.coffee | MIT | 74b9692b0d7753855e99587fb5ea06058ab0074a | 815 | https://github.com/octoblu/meshblu/blob/74b9692b0d7753855e99587fb5ea06058ab0074a/test/lib/messageIOClient-spec.coffee | 84 | 121 |
octoblu/meshblu:test/lib/messageIOClient-spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('unsubscribe', function() {
describe('received only', function() {
beforeEach(function() {
this.sut.start();
return this.sut.unsubscribe('banana', ['received']);
});
return it('should call emit on socketIOClient', function() {
... | describe 'unsubscribe', ->
describe 'received only', ->
beforeEach ->
@sut.start()
@sut.unsubscribe 'banana', ['received']
it 'should call emit on socketIOClient', ->
expect(@socketIOClient.emit).to.have.been.calledWith 'unsubscribe', 'banana'
describe 'sent only', ->
... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/messageIOClient-spec.coffee | MIT | 74b9692b0d7753855e99587fb5ea06058ab0074a | 815 | https://github.com/octoblu/meshblu/blob/74b9692b0d7753855e99587fb5ea06058ab0074a/test/lib/messageIOClient-spec.coffee | 84 | 121 |
octoblu/meshblu:test/lib/messageIOClient-spec.coffee:3:completion | completion | describe 'unsubscribe', ->
describe 'received only', ->
beforeEach ->
@sut.start()
@sut.unsubscribe 'banana', ['received']
it 'should call emit on socketIOClient', ->
expect(@socketIOClient.emit).to.have.been.calledWith 'unsubscribe', 'banana'
describe 'sent only', ->
... | @sut.start()
@sut.unsubscribe 'coffee', ['broadcast']
it 'should call emit on socketIOClient', ->
expect(@socketIOClient.emit).to.have.been.calledWith 'unsubscribe', 'coffee_bc'
describe 'all kinds', ->
beforeEach ->
@sut.start()
@sut.unsubscribe 'apple', ['broadcast', ... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/messageIOClient-spec.coffee | MIT | 74b9692b0d7753855e99587fb5ea06058ab0074a | 815 | https://github.com/octoblu/meshblu/blob/74b9692b0d7753855e99587fb5ea06058ab0074a/test/lib/messageIOClient-spec.coffee | 84 | 121 |
mojs/mojs:src/shapes/cross.coffee:1:raw_corpus | raw_corpus | # ignore coffescript sudo code
Bit = require('./bit').default
class Cross extends Bit
# shape: 'path'
_declareDefaults: ->
super()
@_defaults.tag = 'path'
_draw:->
super()
p = @_props
radiusX = if @_props.radiusX? then @_props.radiusX else @_props.radius
radiusY = if @_props.radiusY? the... | CoffeeScript | mojs/mojs | src/shapes/cross.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/src/shapes/cross.coffee | 1 | 38 | ||
mojs/mojs:src/shapes/cross.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# ignore coffescript sudo code
Bit = require('./bit').default
class Cross extends Bit
# shape: 'path'
_declareDefaults: ->
super()
@_defaults.tag = 'path'
_draw:->
super()
p = @_props
radiusX = if @_props.radiusX? then @_props.radiusX ... | // ignore coffescript sudo code
var Bit, Cross;
Bit = require('./bit').default;
Cross = class Cross extends Bit {
// shape: 'path'
_declareDefaults() {
super._declareDefaults();
return this._defaults.tag = 'path';
}
_draw() {
var d, isRadiusX, isRadiusY, line1, line2, p, radiusX, radiusY, x, x1, ... | CoffeeScript | JavaScript | mojs/mojs | src/shapes/cross.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/src/shapes/cross.coffee | 1 | 38 |
mojs/mojs:src/shapes/cross.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// ignore coffescript sudo code
var Bit, Cross;
Bit = require('./bit').default;
Cross = class Cross extends Bit {
// shape: 'path'
_declareDefaults() {
super._declareDefaults();
return this._defaults.tag = 'path';
}
_draw() {
var d, isRadiusX... | # ignore coffescript sudo code
Bit = require('./bit').default
class Cross extends Bit
# shape: 'path'
_declareDefaults: ->
super()
@_defaults.tag = 'path'
_draw:->
super()
p = @_props
radiusX = if @_props.radiusX? then @_props.radiusX else @_props.radius
radiusY = if @_props.radiusY? the... | JavaScript | CoffeeScript | mojs/mojs | src/shapes/cross.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/src/shapes/cross.coffee | 1 | 38 |
mojs/mojs:src/shapes/cross.coffee:1:completion | completion | # ignore coffescript sudo code
Bit = require('./bit').default
class Cross extends Bit
# shape: 'path'
_declareDefaults: ->
super()
@_defaults.tag = 'path'
_draw:->
super()
p = @_props
radiusX = if @_props.radiusX? then @_props.radiusX else @_props.radius
radiusY = if @_props.radiusY? the... | x = @_props.width/2; y = @_props.height/2
x1 = x-radiusX; x2 = x+radiusX
line1 = "M#{x1},#{y} L#{x2},#{y}"
y1 = y-radiusY; y2 = y+radiusY
line2 = "M#{x},#{y1} L#{x},#{y2}"
d = "#{line1} #{line2}"
@el.setAttribute 'd', d
# save the properties
@_prevRadiusX = radiusX
@_prevRadiusY = r... | CoffeeScript | CoffeeScript | mojs/mojs | src/shapes/cross.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/src/shapes/cross.coffee | 1 | 38 |
mojs/mojs:src/shapes/cross.coffee:1:raw_corpus | raw_corpus | # ignore coffescript sudo code
Bit = require('./bit').default
class Cross extends Bit
# shape: 'path'
_declareDefaults: ->
super
@_defaults.tag = 'path'
_draw:->
super
p = @_props
radiusX = if @_props.radiusX? then @_props.radiusX else @_props.radius
radiusY = if @_props.radiusY? then @_... | CoffeeScript | mojs/mojs | src/shapes/cross.coffee | MIT | 7c34e766d9b361898a59adbc753862fa95de182a | 18,698 | https://github.com/mojs/mojs/blob/7c34e766d9b361898a59adbc753862fa95de182a/src/shapes/cross.coffee | 1 | 38 | ||
mojs/mojs:src/shapes/cross.coffee:1:completion | completion | # ignore coffescript sudo code
Bit = require('./bit').default
class Cross extends Bit
# shape: 'path'
_declareDefaults: ->
super
@_defaults.tag = 'path'
_draw:->
super
p = @_props
radiusX = if @_props.radiusX? then @_props.radiusX else @_props.radius
radiusY = if @_props.radiusY? then @_... | x = @_props.width/2; y = @_props.height/2
x1 = x-radiusX; x2 = x+radiusX
line1 = "M#{x1},#{y} L#{x2},#{y}"
y1 = y-radiusY; y2 = y+radiusY
line2 = "M#{x},#{y1} L#{x},#{y2}"
d = "#{line1} #{line2}"
@el.setAttribute 'd', d
# save the properties
@_prevRadiusX = radiusX
@_prevRadiusY = r... | CoffeeScript | CoffeeScript | mojs/mojs | src/shapes/cross.coffee | MIT | 7c34e766d9b361898a59adbc753862fa95de182a | 18,698 | https://github.com/mojs/mojs/blob/7c34e766d9b361898a59adbc753862fa95de182a/src/shapes/cross.coffee | 1 | 38 |
mojs/mojs:src/shapes/cross.coffee:1:raw_corpus | raw_corpus | # ignore coffescript sudo code
Bit = require('./bit').default or require('./bit');
class Cross extends Bit
# shape: 'path'
_declareDefaults: ->
super
@_defaults.tag = 'path'
_draw:->
super
p = @_props
radiusX = if @_props.radiusX? then @_props.radiusX else @_props.radius
radiusY = if @_p... | CoffeeScript | mojs/mojs | src/shapes/cross.coffee | MIT | 768850a20165488e3098a3003b153e905266dac8 | 18,698 | https://github.com/mojs/mojs/blob/768850a20165488e3098a3003b153e905266dac8/src/shapes/cross.coffee | 1 | 38 | ||
mojs/mojs:src/shapes/cross.coffee:1:completion | completion | # ignore coffescript sudo code
Bit = require('./bit').default or require('./bit');
class Cross extends Bit
# shape: 'path'
_declareDefaults: ->
super
@_defaults.tag = 'path'
_draw:->
super
p = @_props
radiusX = if @_props.radiusX? then @_props.radiusX else @_props.radius
radiusY = if @_p... | x = @_props.width/2; y = @_props.height/2
x1 = x-radiusX; x2 = x+radiusX
line1 = "M#{x1},#{y} L#{x2},#{y}"
y1 = y-radiusY; y2 = y+radiusY
line2 = "M#{x},#{y1} L#{x},#{y2}"
d = "#{line1} #{line2}"
@el.setAttribute 'd', d
# save the properties
@_prevRadiusX = radiusX
@_prevRadiusY = r... | CoffeeScript | CoffeeScript | mojs/mojs | src/shapes/cross.coffee | MIT | 768850a20165488e3098a3003b153e905266dac8 | 18,698 | https://github.com/mojs/mojs/blob/768850a20165488e3098a3003b153e905266dac8/src/shapes/cross.coffee | 1 | 38 |
buttercoin/buttercoin:test/datastore/currency.coffee:1:raw_corpus | raw_corpus | Currency = require('../../lib/datastore/currency')
Amount = require('../../lib/datastore/amount')
describe 'Currency', ->
describe '#get_balance', ->
it 'should return an Amount instance', ->
currency = new Currency()
amount = currency.get_balance()
amount.should.be.an.instanceOf(Amount)
it ... | CoffeeScript | buttercoin/buttercoin | test/datastore/currency.coffee | MIT | 890fe3dba37c2c3ec6d8102a22ea68525bb5dc1a | 663 | https://github.com/buttercoin/buttercoin/blob/890fe3dba37c2c3ec6d8102a22ea68525bb5dc1a/test/datastore/currency.coffee | 1 | 28 | ||
buttercoin/buttercoin:test/datastore/currency.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Currency = require('../../lib/datastore/currency')
Amount = require('../../lib/datastore/amount')
describe 'Currency', ->
describe '#get_balance', ->
it 'should return an Amount instance', ->
currency = new Currency()
amount = currency.get_bala... | var Amount, Currency;
Currency = require('../../lib/datastore/currency');
Amount = require('../../lib/datastore/amount');
describe('Currency', function() {
describe('#get_balance', function() {
return it('should return an Amount instance', function() {
var amount, currency;
currency = new Currency(... | CoffeeScript | JavaScript | buttercoin/buttercoin | test/datastore/currency.coffee | MIT | 890fe3dba37c2c3ec6d8102a22ea68525bb5dc1a | 663 | https://github.com/buttercoin/buttercoin/blob/890fe3dba37c2c3ec6d8102a22ea68525bb5dc1a/test/datastore/currency.coffee | 1 | 28 |
buttercoin/buttercoin:test/datastore/currency.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Amount, Currency;
Currency = require('../../lib/datastore/currency');
Amount = require('../../lib/datastore/amount');
describe('Currency', function() {
describe('#get_balance', function() {
return it('should return an Amount instance', function() {
... | Currency = require('../../lib/datastore/currency')
Amount = require('../../lib/datastore/amount')
describe 'Currency', ->
describe '#get_balance', ->
it 'should return an Amount instance', ->
currency = new Currency()
amount = currency.get_balance()
amount.should.be.an.instanceOf(Amount)
it ... | JavaScript | CoffeeScript | buttercoin/buttercoin | test/datastore/currency.coffee | MIT | 890fe3dba37c2c3ec6d8102a22ea68525bb5dc1a | 663 | https://github.com/buttercoin/buttercoin/blob/890fe3dba37c2c3ec6d8102a22ea68525bb5dc1a/test/datastore/currency.coffee | 1 | 28 |
buttercoin/buttercoin:test/datastore/currency.coffee:1:completion | completion | Currency = require('../../lib/datastore/currency')
Amount = require('../../lib/datastore/amount')
describe 'Currency', ->
describe '#get_balance', ->
it 'should return an Amount instance', ->
currency = new Currency()
amount = currency.get_balance()
amount.should.be.an.instanceOf(Amount)
it ... | it 'should be possible to cumulatively add to the balance', ->
currency = new Currency()
currency.increase_balance(new Amount('50'))
currency.get_balance().compareTo(new Amount('50')).should.equal(0)
currency.increase_balance(new Amount('100'))
currency.get_balance().compareTo(new Amount('150')).sho... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | test/datastore/currency.coffee | MIT | 890fe3dba37c2c3ec6d8102a22ea68525bb5dc1a | 663 | https://github.com/buttercoin/buttercoin/blob/890fe3dba37c2c3ec6d8102a22ea68525bb5dc1a/test/datastore/currency.coffee | 1 | 28 |
jianliaoim/talk-os:talk-account/client/config.coffee:1:raw_corpus | raw_corpus | if typeof window is 'undefined'
module.exports = require '../config/default'
else
module.exports = window._initialStore.config | CoffeeScript | jianliaoim/talk-os | talk-account/client/config.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/config.coffee | 1 | 4 | ||
jianliaoim/talk-os:talk-account/client/config.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if typeof window is 'undefined'
module.exports = require '../config/default'
else
module.exports = window._initialStore.config
``` | if (typeof window === 'undefined') {
module.exports = require('../config/default');
} else {
module.exports = window._initialStore.config;
} | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/client/config.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/config.coffee | 1 | 4 |
jianliaoim/talk-os:talk-account/client/config.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
if (typeof window === 'undefined') {
module.exports = require('../config/default');
} else {
module.exports = window._initialStore.config;
}
``` | if typeof window is 'undefined'
module.exports = require '../config/default'
else
module.exports = window._initialStore.config | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/client/config.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/config.coffee | 1 | 4 |
jianliaoim/talk-os:talk-account/client/config.coffee:1:completion | completion | if typeof window is 'undefined'
module.exports = require '../config/default' | else
module.exports = window._initialStore.config | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/client/config.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/config.coffee | 1 | 4 |
jianliaoim/talk-os:talk-web/client/app/quote-viewer.coffee:1:raw_corpus | raw_corpus | module.exports = React.createClass
displayName: 'quote-viewer'
mixins: [ PureRenderMixin ]
propTypes:
message: T.instanceOf(Immutable.Map).isRequired
onClose: T.func.isRequired
isFavorite: T.bool
getDefaultProps: ->
isFavorite: false
getQuote: ->
return if @props.message.get('attachment... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/quote-viewer.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/quote-viewer.coffee | 20 | 69 | ||
jianliaoim/talk-os:talk-web/client/app/quote-viewer.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = React.createClass
displayName: 'quote-viewer'
mixins: [ PureRenderMixin ]
propTypes:
message: T.instanceOf(Immutable.Map).isRequired
onClose: T.func.isRequired
isFavorite: T.bool
getDefaultProps: ->
isFavorite: false
... | module.exports = React.createClass({
displayName: 'quote-viewer',
mixins: [PureRenderMixin],
propTypes: {
message: T.instanceOf(Immutable.Map).isRequired,
onClose: T.func.isRequired,
isFavorite: T.bool
},
getDefaultProps: function() {
return {
isFavorite: false
};
},
getQuote: fu... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/quote-viewer.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/quote-viewer.coffee | 20 | 69 |
jianliaoim/talk-os:talk-web/client/app/quote-viewer.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = React.createClass({
displayName: 'quote-viewer',
mixins: [PureRenderMixin],
propTypes: {
message: T.instanceOf(Immutable.Map).isRequired,
onClose: T.func.isRequired,
isFavorite: T.bool
},
getDefaultProps: function() {
retu... | module.exports = React.createClass
displayName: 'quote-viewer'
mixins: [ PureRenderMixin ]
propTypes:
message: T.instanceOf(Immutable.Map).isRequired
onClose: T.func.isRequired
isFavorite: T.bool
getDefaultProps: ->
isFavorite: false
getQuote: ->
return if @props.message.get('attachment... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/quote-viewer.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/quote-viewer.coffee | 20 | 69 |
jianliaoim/talk-os:talk-web/client/app/quote-viewer.coffee:1:completion | completion | module.exports = React.createClass
displayName: 'quote-viewer'
mixins: [ PureRenderMixin ]
propTypes:
message: T.instanceOf(Immutable.Map).isRequired
onClose: T.func.isRequired
isFavorite: T.bool
getDefaultProps: ->
isFavorite: false
getQuote: ->
return if @props.message.get('attachment... | text = xss(cursor.get('text') or '')
cursor
# 收到的text可能是html也可能是纯文本,
# 两种情况里面都可能会有`\n`
# 需要正确判断他是不是html来正确渲染换行
.set 'isPlaintext', not detect.isHtml(text)
.set 'text', text
onClose: ->
@props.onClose()
onContentClick: (event) ->
if event.target.tag... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/quote-viewer.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/quote-viewer.coffee | 20 | 69 |
jianliaoim/talk-os:talk-web/client/app/quote-viewer.coffee:2:raw_corpus | raw_corpus | return noscript() if not quote?
avatar = @props.message.get('authorAvatarUrl') or @props.message.getIn(['creator', 'avatarUrl'])
style =
if avatar.length isnt 0
backgroundImage: "url(#{ avatar })"
else {}
if quote.has 'redirectUrl'
contentStyle =
height: "#{ window.innerH... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/quote-viewer.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/quote-viewer.coffee | 70 | 107 | ||
jianliaoim/talk-os:talk-web/client/app/quote-viewer.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return noscript() if not quote?
avatar = @props.message.get('authorAvatarUrl') or @props.message.getIn(['creator', 'avatarUrl'])
style =
if avatar.length isnt 0
backgroundImage: "url(#{ avatar })"
else {}
if quote.has 'redirectUr... | var avatar, contentClass, contentStyle, style;
return noscript()(typeof quote === "undefined" || quote === null ? (avatar = this.props.message.get('authorAvatarUrl') || this.props.message.getIn(['creator', 'avatarUrl']), style = avatar.length !== 0 ? {
backgroundImage: `url(${avatar})`
} : {}, quote.has('redirectUrl... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/quote-viewer.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/quote-viewer.coffee | 70 | 107 |
jianliaoim/talk-os:talk-web/client/app/quote-viewer.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var avatar, contentClass, contentStyle, style;
return noscript()(typeof quote === "undefined" || quote === null ? (avatar = this.props.message.get('authorAvatarUrl') || this.props.message.getIn(['creator', 'avatarUrl']), style = avatar.length !== 0 ? {
backgroun... | return noscript() if not quote?
avatar = @props.message.get('authorAvatarUrl') or @props.message.getIn(['creator', 'avatarUrl'])
style =
if avatar.length isnt 0
backgroundImage: "url(#{ avatar })"
else {}
if quote.has 'redirectUrl'
contentStyle =
height: "#{ window.innerH... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/quote-viewer.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/quote-viewer.coffee | 70 | 107 |
jianliaoim/talk-os:talk-web/client/app/quote-viewer.coffee:2:completion | completion | return noscript() if not quote?
avatar = @props.message.get('authorAvatarUrl') or @props.message.getIn(['creator', 'avatarUrl'])
style =
if avatar.length isnt 0
backgroundImage: "url(#{ avatar })"
else {}
if quote.has 'redirectUrl'
contentStyle =
height: "#{ window.innerH... | div className: 'header',
span className: 'avatar img-circle', style: style
UserAlias
_teamId: @props.message.get('_teamId')
_userId: @props.message.get('_creatorId')
replaceMe: true
defaultName: @props.message.get('authorName') or @props.message.getIn(['creator', ... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/quote-viewer.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/quote-viewer.coffee | 70 | 107 |
flosse/sloc:spec/sloc.spec.coffee:1:raw_corpus | raw_corpus | fs = require 'fs'
chai = require 'chai'
should = chai.should()
langs = require "./languages"
sloc = require "../src/sloc"
manyLines = ('# \n' for i in [0...10000]).join('')
longLine = ('### ###' for i in [0...10000]).join('')
describe "The sloc module", ->
it "should be a function", ->
... | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e26044011821c4e170859362f2de657d64118711 | 969 | https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/spec/sloc.spec.coffee | 1 | 50 | ||
flosse/sloc:spec/sloc.spec.coffee:1:completion | completion | fs = require 'fs'
chai = require 'chai'
should = chai.should()
langs = require "./languages"
sloc = require "../src/sloc"
manyLines = ('# \n' for i in [0...10000]).join('')
longLine = ('### ###' for i in [0...10000]).join('')
describe "The sloc module", ->
it "should be a function", ->
... | todo: 0
total: 3
it "should handle CR line endings", ->
sloc("a\rb\rc", "js").total.should.equal 3
describe "language support", ->
for l in langs then do (l) ->
for n in l.names then do (n) ->
it "should support #{n}", ->
res = sloc l.code, n
(n in sloc.e... | CoffeeScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e26044011821c4e170859362f2de657d64118711 | 969 | https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/spec/sloc.spec.coffee | 1 | 50 |
flosse/sloc:spec/sloc.spec.coffee:2:raw_corpus | raw_corpus | res.mixed .should.equal l.mixed, "Mixed"
if l.todo
res.todo .should.equal l.todo, "To Do" | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e26044011821c4e170859362f2de657d64118711 | 969 | https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/spec/sloc.spec.coffee | 51 | 53 | ||
flosse/sloc:spec/sloc.spec.coffee:3:raw_corpus | raw_corpus | it "should throw an error", ->
(-> sloc "foo", "foobar").should.throw()
(-> sloc null, "coffee") .should.throw()
it "keeps an array with all supported extensions", ->
sloc.extensions.should.be.an 'array'
for l in langs
for n in l.names
(n in sloc.extensions).should.be.true
it "keeps ... | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e26044011821c4e170859362f2de657d64118711 | 969 | https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/spec/sloc.spec.coffee | 55 | 97 | ||
flosse/sloc:spec/sloc.spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it "should throw an error", ->
(-> sloc "foo", "foobar").should.throw()
(-> sloc null, "coffee") .should.throw()
it "keeps an array with all supported extensions", ->
sloc.extensions.should.be.an 'array'
for l in langs
for n in l.names
... | var indexOf = [].indexOf;
it("should throw an error", function() {
(function() {
return sloc("foo", "foobar");
}).should.throw();
return (function() {
return sloc(null, "coffee");
}).should.throw();
});
it("keeps an array with all supported extensions", function() {
var i, l, len, n, results;
sloc... | CoffeeScript | JavaScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e26044011821c4e170859362f2de657d64118711 | 969 | https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/spec/sloc.spec.coffee | 55 | 97 |
flosse/sloc:spec/sloc.spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var indexOf = [].indexOf;
it("should throw an error", function() {
(function() {
return sloc("foo", "foobar");
}).should.throw();
return (function() {
return sloc(null, "coffee");
}).should.throw();
});
it("keeps an array with all supported extens... | it "should throw an error", ->
(-> sloc "foo", "foobar").should.throw()
(-> sloc null, "coffee") .should.throw()
it "keeps an array with all supported extensions", ->
sloc.extensions.should.be.an 'array'
for l in langs
for n in l.names
(n in sloc.extensions).should.be.true
it "keeps ... | JavaScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e26044011821c4e170859362f2de657d64118711 | 969 | https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/spec/sloc.spec.coffee | 55 | 97 |
flosse/sloc:spec/sloc.spec.coffee:3:completion | completion | it "should throw an error", ->
(-> sloc "foo", "foobar").should.throw()
(-> sloc null, "coffee") .should.throw()
it "keeps an array with all supported extensions", ->
sloc.extensions.should.be.an 'array'
for l in langs
for n in l.names
(n in sloc.extensions).should.be.true
it "keeps ... | sloc.keys.should.be.an 'array'
for k in sloc.keys
(k in keys).should.be.true
it "can handle at least 10.000 lines", ->
(-> sloc manyLines, "coffee") .should.not.throw()
it "can handle lines with at least 10.000 characters", ->
(-> sloc longLine, "coffee") .should.not.throw()
it "evaluates the... | CoffeeScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e26044011821c4e170859362f2de657d64118711 | 969 | https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/spec/sloc.spec.coffee | 55 | 97 |
flosse/sloc:spec/sloc.spec.coffee:4:raw_corpus | raw_corpus | fs.readFile "./spec/testfiles/test2.js", "utf-8", (err, code) ->
res = sloc code, "js"
res.source.should.equal 0
res.empty.should.equal 5
res.block.should.equal 13
res.total.should.equal 13
res.todo.should.equal 0
done()
it "evaluates an empty file correctly", ... | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e26044011821c4e170859362f2de657d64118711 | 969 | https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/spec/sloc.spec.coffee | 99 | 121 | ||
flosse/sloc:spec/sloc.spec.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
fs.readFile "./spec/testfiles/test2.js", "utf-8", (err, code) ->
res = sloc code, "js"
res.source.should.equal 0
res.empty.should.equal 5
res.block.should.equal 13
res.total.should.equal 13
res.todo.should.equal 0
... | fs.readFile("./spec/testfiles/test2.js", "utf-8", function(err, code) {
var res;
res = sloc(code, "js");
res.source.should.equal(0);
res.empty.should.equal(5);
res.block.should.equal(13);
res.total.should.equal(13);
res.todo.should.equal(0);
return done();
});
it("evaluates an empty file correctly", fu... | CoffeeScript | JavaScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e26044011821c4e170859362f2de657d64118711 | 969 | https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/spec/sloc.spec.coffee | 99 | 121 |
flosse/sloc:spec/sloc.spec.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
fs.readFile("./spec/testfiles/test2.js", "utf-8", function(err, code) {
var res;
res = sloc(code, "js");
res.source.should.equal(0);
res.empty.should.equal(5);
res.block.should.equal(13);
res.total.should.equal(13);
res.todo.should.equal(0);
return ... | fs.readFile "./spec/testfiles/test2.js", "utf-8", (err, code) ->
res = sloc code, "js"
res.source.should.equal 0
res.empty.should.equal 5
res.block.should.equal 13
res.total.should.equal 13
res.todo.should.equal 0
done()
it "evaluates an empty file correctly", ... | JavaScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e26044011821c4e170859362f2de657d64118711 | 969 | https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/spec/sloc.spec.coffee | 99 | 121 |
flosse/sloc:spec/sloc.spec.coffee:4:completion | completion | fs.readFile "./spec/testfiles/test2.js", "utf-8", (err, code) ->
res = sloc code, "js"
res.source.should.equal 0
res.empty.should.equal 5
res.block.should.equal 13
res.total.should.equal 13
res.todo.should.equal 0
done()
it "evaluates an empty file correctly", ... | res = sloc code, "js"
res.empty.should.equal 1
res.source.should.equal 0
res.total.should.equal 1
res.todo.should.equal 0
done()
it "ignores the last newline char", ->
res = sloc "foo\nbar\n", "js"
res.empty.should.equal 0
res.source.should.equal 2
res.total.should.equal... | CoffeeScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e26044011821c4e170859362f2de657d64118711 | 969 | https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/spec/sloc.spec.coffee | 99 | 121 |
flosse/sloc:spec/sloc.spec.coffee:4:raw_corpus | raw_corpus | fs.readFile "./spec/testfiles/test2.js", "utf-8", (err, code) ->
res = sloc code, "js"
res.source.should.equal 0
res.empty.should.equal 5
res.block.should.equal 13
res.total.should.equal 13
res.todo.should.equal 0
done()
it "evaluates an emty file correctly", (... | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | 47027d0dcf15b0b8eabbcc6365e210d14ab6853a | 969 | https://github.com/flosse/sloc/blob/47027d0dcf15b0b8eabbcc6365e210d14ab6853a/spec/sloc.spec.coffee | 99 | 121 | ||
flosse/sloc:spec/sloc.spec.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
fs.readFile "./spec/testfiles/test2.js", "utf-8", (err, code) ->
res = sloc code, "js"
res.source.should.equal 0
res.empty.should.equal 5
res.block.should.equal 13
res.total.should.equal 13
res.todo.should.equal 0
... | fs.readFile("./spec/testfiles/test2.js", "utf-8", function(err, code) {
var res;
res = sloc(code, "js");
res.source.should.equal(0);
res.empty.should.equal(5);
res.block.should.equal(13);
res.total.should.equal(13);
res.todo.should.equal(0);
return done();
});
it("evaluates an emty file correctly", fun... | CoffeeScript | JavaScript | flosse/sloc | spec/sloc.spec.coffee | MIT | 47027d0dcf15b0b8eabbcc6365e210d14ab6853a | 969 | https://github.com/flosse/sloc/blob/47027d0dcf15b0b8eabbcc6365e210d14ab6853a/spec/sloc.spec.coffee | 99 | 121 |
flosse/sloc:spec/sloc.spec.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
fs.readFile("./spec/testfiles/test2.js", "utf-8", function(err, code) {
var res;
res = sloc(code, "js");
res.source.should.equal(0);
res.empty.should.equal(5);
res.block.should.equal(13);
res.total.should.equal(13);
res.todo.should.equal(0);
return ... | fs.readFile "./spec/testfiles/test2.js", "utf-8", (err, code) ->
res = sloc code, "js"
res.source.should.equal 0
res.empty.should.equal 5
res.block.should.equal 13
res.total.should.equal 13
res.todo.should.equal 0
done()
it "evaluates an emty file correctly", (... | JavaScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | 47027d0dcf15b0b8eabbcc6365e210d14ab6853a | 969 | https://github.com/flosse/sloc/blob/47027d0dcf15b0b8eabbcc6365e210d14ab6853a/spec/sloc.spec.coffee | 99 | 121 |
flosse/sloc:spec/sloc.spec.coffee:4:completion | completion | fs.readFile "./spec/testfiles/test2.js", "utf-8", (err, code) ->
res = sloc code, "js"
res.source.should.equal 0
res.empty.should.equal 5
res.block.should.equal 13
res.total.should.equal 13
res.todo.should.equal 0
done()
it "evaluates an emty file correctly", (... | res = sloc code, "js"
res.empty.should.equal 1
res.source.should.equal 0
res.total.should.equal 1
res.todo.should.equal 0
done()
it "ignores the last newline char", ->
res = sloc "foo\nbar\n", "js"
res.empty.should.equal 0
res.source.should.equal 2
res.total.should.equal... | CoffeeScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | 47027d0dcf15b0b8eabbcc6365e210d14ab6853a | 969 | https://github.com/flosse/sloc/blob/47027d0dcf15b0b8eabbcc6365e210d14ab6853a/spec/sloc.spec.coffee | 99 | 121 |
flosse/sloc:spec/sloc.spec.coffee:3:raw_corpus | raw_corpus | it "should throw an error", ->
(-> sloc "foo", "foobar").should.throw()
(-> sloc null, "coffee") .should.throw()
it "keeps an array with all supported extensions", ->
sloc.extensions.should.be.an 'array'
for l in langs
for n in l.names
(n in sloc.extensions).should.be.true
it "keeps ... | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | c128b22a0a0dba1cfb2437557584da95d0c4d15a | 969 | https://github.com/flosse/sloc/blob/c128b22a0a0dba1cfb2437557584da95d0c4d15a/spec/sloc.spec.coffee | 55 | 96 | ||
flosse/sloc:spec/sloc.spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it "should throw an error", ->
(-> sloc "foo", "foobar").should.throw()
(-> sloc null, "coffee") .should.throw()
it "keeps an array with all supported extensions", ->
sloc.extensions.should.be.an 'array'
for l in langs
for n in l.names
... | var indexOf = [].indexOf;
it("should throw an error", function() {
(function() {
return sloc("foo", "foobar");
}).should.throw();
return (function() {
return sloc(null, "coffee");
}).should.throw();
});
it("keeps an array with all supported extensions", function() {
var i, l, len, n, results;
sloc... | CoffeeScript | JavaScript | flosse/sloc | spec/sloc.spec.coffee | MIT | c128b22a0a0dba1cfb2437557584da95d0c4d15a | 969 | https://github.com/flosse/sloc/blob/c128b22a0a0dba1cfb2437557584da95d0c4d15a/spec/sloc.spec.coffee | 55 | 96 |
flosse/sloc:spec/sloc.spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var indexOf = [].indexOf;
it("should throw an error", function() {
(function() {
return sloc("foo", "foobar");
}).should.throw();
return (function() {
return sloc(null, "coffee");
}).should.throw();
});
it("keeps an array with all supported extens... | it "should throw an error", ->
(-> sloc "foo", "foobar").should.throw()
(-> sloc null, "coffee") .should.throw()
it "keeps an array with all supported extensions", ->
sloc.extensions.should.be.an 'array'
for l in langs
for n in l.names
(n in sloc.extensions).should.be.true
it "keeps ... | JavaScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | c128b22a0a0dba1cfb2437557584da95d0c4d15a | 969 | https://github.com/flosse/sloc/blob/c128b22a0a0dba1cfb2437557584da95d0c4d15a/spec/sloc.spec.coffee | 55 | 96 |
flosse/sloc:spec/sloc.spec.coffee:3:completion | completion | it "should throw an error", ->
(-> sloc "foo", "foobar").should.throw()
(-> sloc null, "coffee") .should.throw()
it "keeps an array with all supported extensions", ->
sloc.extensions.should.be.an 'array'
for l in langs
for n in l.names
(n in sloc.extensions).should.be.true
it "keeps ... | for k in sloc.keys
(k in keys).should.be.true
it "can handle at least 10.000 lines", ->
(-> sloc manyLines, "coffee") .should.not.throw()
it "can handle lines with at least 10.000 characters", ->
(-> sloc longLine, "coffee") .should.not.throw()
it "evaluates the testfiles correctly", (done) ->
... | CoffeeScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | c128b22a0a0dba1cfb2437557584da95d0c4d15a | 969 | https://github.com/flosse/sloc/blob/c128b22a0a0dba1cfb2437557584da95d0c4d15a/spec/sloc.spec.coffee | 55 | 96 |
flosse/sloc:spec/sloc.spec.coffee:1:raw_corpus | raw_corpus | fs = require 'fs'
chai = require 'chai'
should = chai.should()
langs = require "./languages"
sloc = require "../src/sloc"
manyLines = ('# \n' for i in [0...10000]).join('')
longLine = ('### ###' for i in [0...10000]).join('')
describe "The sloc module", ->
it "should be a function", ->
... | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | 6252f7c8cf4d91bf031f07a659198c84581b265f | 969 | https://github.com/flosse/sloc/blob/6252f7c8cf4d91bf031f07a659198c84581b265f/spec/sloc.spec.coffee | 1 | 50 | ||
flosse/sloc:spec/sloc.spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
fs = require 'fs'
chai = require 'chai'
should = chai.should()
langs = require "./languages"
sloc = require "../src/sloc"
manyLines = ('# \n' for i in [0...10000]).join('')
longLine = ('### ###' for i in [0...10000]).join('')
describe... | var chai, fs, i, langs, longLine, manyLines, should, sloc,
indexOf = [].indexOf;
fs = require('fs');
chai = require('chai');
should = chai.should();
langs = require("./languages");
sloc = require("../src/sloc");
manyLines = ((function() {
var j, results;
results = [];
for (i = j = 0; j < 10000; i = ++j) {... | CoffeeScript | JavaScript | flosse/sloc | spec/sloc.spec.coffee | MIT | 6252f7c8cf4d91bf031f07a659198c84581b265f | 969 | https://github.com/flosse/sloc/blob/6252f7c8cf4d91bf031f07a659198c84581b265f/spec/sloc.spec.coffee | 1 | 50 |
flosse/sloc:spec/sloc.spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var chai, fs, i, langs, longLine, manyLines, should, sloc,
indexOf = [].indexOf;
fs = require('fs');
chai = require('chai');
should = chai.should();
langs = require("./languages");
sloc = require("../src/sloc");
manyLines = ((function() {
var j, results;
... | fs = require 'fs'
chai = require 'chai'
should = chai.should()
langs = require "./languages"
sloc = require "../src/sloc"
manyLines = ('# \n' for i in [0...10000]).join('')
longLine = ('### ###' for i in [0...10000]).join('')
describe "The sloc module", ->
it "should be a function", ->
... | JavaScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | 6252f7c8cf4d91bf031f07a659198c84581b265f | 969 | https://github.com/flosse/sloc/blob/6252f7c8cf4d91bf031f07a659198c84581b265f/spec/sloc.spec.coffee | 1 | 50 |
flosse/sloc:spec/sloc.spec.coffee:1:completion | completion | fs = require 'fs'
chai = require 'chai'
should = chai.should()
langs = require "./languages"
sloc = require "../src/sloc"
manyLines = ('# \n' for i in [0...10000]).join('')
longLine = ('### ###' for i in [0...10000]).join('')
describe "The sloc module", ->
it "should be a function", ->
... | total: 3
it "should handle CR line endings", ->
sloc("a\rb\rc", "js").total.should.equal 3
describe "language support", ->
for l in langs then do (l) ->
for n in l.names then do (n) ->
it "should support #{n}", ->
res = sloc l.code, n
(n in sloc.extensions).should.equa... | CoffeeScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | 6252f7c8cf4d91bf031f07a659198c84581b265f | 969 | https://github.com/flosse/sloc/blob/6252f7c8cf4d91bf031f07a659198c84581b265f/spec/sloc.spec.coffee | 1 | 50 |
flosse/sloc:spec/sloc.spec.coffee:1:raw_corpus | raw_corpus | fs = require 'fs'
chai = require 'chai'
should = chai.should()
langs = require "./languages"
sloc = require "../src/sloc"
manyLines = ('# \n' for i in [0...10000]).join('')
longLine = ('### ###' for i in [0...10000]).join('')
describe "The sloc module", ->
it "should be a function", ->
... | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e94ad913d1f146eeb75aa0c9963a05a2a690b1fe | 969 | https://github.com/flosse/sloc/blob/e94ad913d1f146eeb75aa0c9963a05a2a690b1fe/spec/sloc.spec.coffee | 1 | 49 | ||
flosse/sloc:spec/sloc.spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
fs = require 'fs'
chai = require 'chai'
should = chai.should()
langs = require "./languages"
sloc = require "../src/sloc"
manyLines = ('# \n' for i in [0...10000]).join('')
longLine = ('### ###' for i in [0...10000]).join('')
describe... | var chai, fs, i, langs, longLine, manyLines, should, sloc,
indexOf = [].indexOf;
fs = require('fs');
chai = require('chai');
should = chai.should();
langs = require("./languages");
sloc = require("../src/sloc");
manyLines = ((function() {
var j, results;
results = [];
for (i = j = 0; j < 10000; i = ++j) {... | CoffeeScript | JavaScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e94ad913d1f146eeb75aa0c9963a05a2a690b1fe | 969 | https://github.com/flosse/sloc/blob/e94ad913d1f146eeb75aa0c9963a05a2a690b1fe/spec/sloc.spec.coffee | 1 | 49 |
flosse/sloc:spec/sloc.spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var chai, fs, i, langs, longLine, manyLines, should, sloc,
indexOf = [].indexOf;
fs = require('fs');
chai = require('chai');
should = chai.should();
langs = require("./languages");
sloc = require("../src/sloc");
manyLines = ((function() {
var j, results;
... | fs = require 'fs'
chai = require 'chai'
should = chai.should()
langs = require "./languages"
sloc = require "../src/sloc"
manyLines = ('# \n' for i in [0...10000]).join('')
longLine = ('### ###' for i in [0...10000]).join('')
describe "The sloc module", ->
it "should be a function", ->
... | JavaScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e94ad913d1f146eeb75aa0c9963a05a2a690b1fe | 969 | https://github.com/flosse/sloc/blob/e94ad913d1f146eeb75aa0c9963a05a2a690b1fe/spec/sloc.spec.coffee | 1 | 49 |
flosse/sloc:spec/sloc.spec.coffee:1:completion | completion | fs = require 'fs'
chai = require 'chai'
should = chai.should()
langs = require "./languages"
sloc = require "../src/sloc"
manyLines = ('# \n' for i in [0...10000]).join('')
longLine = ('### ###' for i in [0...10000]).join('')
describe "The sloc module", ->
it "should be a function", ->
... | total: 3
it "should handle CR line endings", ->
sloc("a\rb\rc", "js").total.should.equal 3
describe "language support", ->
for l in langs then do (l) ->
for n in l.names then do (n) ->
it "should support #{n}", ->
res = sloc l.code, n
(n in sloc.extensions).should.equa... | CoffeeScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e94ad913d1f146eeb75aa0c9963a05a2a690b1fe | 969 | https://github.com/flosse/sloc/blob/e94ad913d1f146eeb75aa0c9963a05a2a690b1fe/spec/sloc.spec.coffee | 1 | 49 |
flosse/sloc:spec/sloc.spec.coffee:2:raw_corpus | raw_corpus | it "should throw an error", ->
(-> sloc "foo", "foobar").should.throw()
(-> sloc null, "coffee") .should.throw()
it "keeps an array with all supported extensions", ->
sloc.extensions.should.be.an 'array'
for l in langs
for n in l.names
(n in sloc.extensions).should.be.true
it "keeps ... | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e94ad913d1f146eeb75aa0c9963a05a2a690b1fe | 969 | https://github.com/flosse/sloc/blob/e94ad913d1f146eeb75aa0c9963a05a2a690b1fe/spec/sloc.spec.coffee | 51 | 90 | ||
flosse/sloc:spec/sloc.spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it "should throw an error", ->
(-> sloc "foo", "foobar").should.throw()
(-> sloc null, "coffee") .should.throw()
it "keeps an array with all supported extensions", ->
sloc.extensions.should.be.an 'array'
for l in langs
for n in l.names
... | var indexOf = [].indexOf;
it("should throw an error", function() {
(function() {
return sloc("foo", "foobar");
}).should.throw();
return (function() {
return sloc(null, "coffee");
}).should.throw();
});
it("keeps an array with all supported extensions", function() {
var i, l, len, n, results;
sloc... | CoffeeScript | JavaScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e94ad913d1f146eeb75aa0c9963a05a2a690b1fe | 969 | https://github.com/flosse/sloc/blob/e94ad913d1f146eeb75aa0c9963a05a2a690b1fe/spec/sloc.spec.coffee | 51 | 90 |
flosse/sloc:spec/sloc.spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var indexOf = [].indexOf;
it("should throw an error", function() {
(function() {
return sloc("foo", "foobar");
}).should.throw();
return (function() {
return sloc(null, "coffee");
}).should.throw();
});
it("keeps an array with all supported extens... | it "should throw an error", ->
(-> sloc "foo", "foobar").should.throw()
(-> sloc null, "coffee") .should.throw()
it "keeps an array with all supported extensions", ->
sloc.extensions.should.be.an 'array'
for l in langs
for n in l.names
(n in sloc.extensions).should.be.true
it "keeps ... | JavaScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e94ad913d1f146eeb75aa0c9963a05a2a690b1fe | 969 | https://github.com/flosse/sloc/blob/e94ad913d1f146eeb75aa0c9963a05a2a690b1fe/spec/sloc.spec.coffee | 51 | 90 |
flosse/sloc:spec/sloc.spec.coffee:2:completion | completion | it "should throw an error", ->
(-> sloc "foo", "foobar").should.throw()
(-> sloc null, "coffee") .should.throw()
it "keeps an array with all supported extensions", ->
sloc.extensions.should.be.an 'array'
for l in langs
for n in l.names
(n in sloc.extensions).should.be.true
it "keeps ... | for k in sloc.keys
(k in keys).should.be.true
it "can handle at least 10.000 lines", ->
(-> sloc manyLines, "coffee") .should.not.throw()
it "can handle lines with at least 10.000 characters", ->
(-> sloc longLine, "coffee") .should.not.throw()
it "evaluates the testfiles correctly", (done) ->
... | CoffeeScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e94ad913d1f146eeb75aa0c9963a05a2a690b1fe | 969 | https://github.com/flosse/sloc/blob/e94ad913d1f146eeb75aa0c9963a05a2a690b1fe/spec/sloc.spec.coffee | 51 | 90 |
flosse/sloc:spec/sloc.spec.coffee:3:raw_corpus | raw_corpus | fs.readFile "./spec/testfiles/test2.js", "utf-8", (err, code) ->
res = sloc code, "js"
res.source.should.equal 0
res.empty.should.equal 5
res.block.should.equal 13
res.total.should.equal 13
done()
it "evaluates an emty file correctly", (done) ->
fs.readFile "./spec... | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e94ad913d1f146eeb75aa0c9963a05a2a690b1fe | 969 | https://github.com/flosse/sloc/blob/e94ad913d1f146eeb75aa0c9963a05a2a690b1fe/spec/sloc.spec.coffee | 92 | 112 | ||
flosse/sloc:spec/sloc.spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
fs.readFile "./spec/testfiles/test2.js", "utf-8", (err, code) ->
res = sloc code, "js"
res.source.should.equal 0
res.empty.should.equal 5
res.block.should.equal 13
res.total.should.equal 13
done()
it "evaluates a... | fs.readFile("./spec/testfiles/test2.js", "utf-8", function(err, code) {
var res;
res = sloc(code, "js");
res.source.should.equal(0);
res.empty.should.equal(5);
res.block.should.equal(13);
res.total.should.equal(13);
return done();
});
it("evaluates an emty file correctly", function(done) {
return fs.re... | CoffeeScript | JavaScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e94ad913d1f146eeb75aa0c9963a05a2a690b1fe | 969 | https://github.com/flosse/sloc/blob/e94ad913d1f146eeb75aa0c9963a05a2a690b1fe/spec/sloc.spec.coffee | 92 | 112 |
flosse/sloc:spec/sloc.spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
fs.readFile("./spec/testfiles/test2.js", "utf-8", function(err, code) {
var res;
res = sloc(code, "js");
res.source.should.equal(0);
res.empty.should.equal(5);
res.block.should.equal(13);
res.total.should.equal(13);
return done();
});
it("evaluates a... | fs.readFile "./spec/testfiles/test2.js", "utf-8", (err, code) ->
res = sloc code, "js"
res.source.should.equal 0
res.empty.should.equal 5
res.block.should.equal 13
res.total.should.equal 13
done()
it "evaluates an emty file correctly", (done) ->
fs.readFile "./spec... | JavaScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e94ad913d1f146eeb75aa0c9963a05a2a690b1fe | 969 | https://github.com/flosse/sloc/blob/e94ad913d1f146eeb75aa0c9963a05a2a690b1fe/spec/sloc.spec.coffee | 92 | 112 |
flosse/sloc:spec/sloc.spec.coffee:3:completion | completion | fs.readFile "./spec/testfiles/test2.js", "utf-8", (err, code) ->
res = sloc code, "js"
res.source.should.equal 0
res.empty.should.equal 5
res.block.should.equal 13
res.total.should.equal 13
done()
it "evaluates an emty file correctly", (done) ->
fs.readFile "./spec... | res = sloc code, "js"
res.empty.should.equal 1
res.source.should.equal 0
res.total.should.equal 1
done()
it "ignores the last newline char", ->
res = sloc "foo\nbar\n", "js"
res.empty.should.equal 0
res.source.should.equal 2
res.total.should.equal 2 | CoffeeScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | e94ad913d1f146eeb75aa0c9963a05a2a690b1fe | 969 | https://github.com/flosse/sloc/blob/e94ad913d1f146eeb75aa0c9963a05a2a690b1fe/spec/sloc.spec.coffee | 92 | 112 |
flosse/sloc:spec/sloc.spec.coffee:1:raw_corpus | raw_corpus | fs = require 'fs'
chai = require 'chai'
should = chai.should()
langs = require "./languages"
sloc = require "../src/sloc"
manyLines = ('# \n' for i in [0...10000]).join('')
longLine = ('### ###' for i in [0...10000]).join('')
describe "The sloc module", ->
it "should be a function", ->
... | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | 5e19071b69aa00c16ca21d111a776917e1d45560 | 969 | https://github.com/flosse/sloc/blob/5e19071b69aa00c16ca21d111a776917e1d45560/spec/sloc.spec.coffee | 1 | 49 | ||
flosse/sloc:spec/sloc.spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
fs = require 'fs'
chai = require 'chai'
should = chai.should()
langs = require "./languages"
sloc = require "../src/sloc"
manyLines = ('# \n' for i in [0...10000]).join('')
longLine = ('### ###' for i in [0...10000]).join('')
describe... | var chai, fs, i, langs, longLine, manyLines, should, sloc,
indexOf = [].indexOf;
fs = require('fs');
chai = require('chai');
should = chai.should();
langs = require("./languages");
sloc = require("../src/sloc");
manyLines = ((function() {
var j, results;
results = [];
for (i = j = 0; j < 10000; i = ++j) {... | CoffeeScript | JavaScript | flosse/sloc | spec/sloc.spec.coffee | MIT | 5e19071b69aa00c16ca21d111a776917e1d45560 | 969 | https://github.com/flosse/sloc/blob/5e19071b69aa00c16ca21d111a776917e1d45560/spec/sloc.spec.coffee | 1 | 49 |
flosse/sloc:spec/sloc.spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var chai, fs, i, langs, longLine, manyLines, should, sloc,
indexOf = [].indexOf;
fs = require('fs');
chai = require('chai');
should = chai.should();
langs = require("./languages");
sloc = require("../src/sloc");
manyLines = ((function() {
var j, results;
... | fs = require 'fs'
chai = require 'chai'
should = chai.should()
langs = require "./languages"
sloc = require "../src/sloc"
manyLines = ('# \n' for i in [0...10000]).join('')
longLine = ('### ###' for i in [0...10000]).join('')
describe "The sloc module", ->
it "should be a function", ->
... | JavaScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | 5e19071b69aa00c16ca21d111a776917e1d45560 | 969 | https://github.com/flosse/sloc/blob/5e19071b69aa00c16ca21d111a776917e1d45560/spec/sloc.spec.coffee | 1 | 49 |
flosse/sloc:spec/sloc.spec.coffee:1:completion | completion | fs = require 'fs'
chai = require 'chai'
should = chai.should()
langs = require "./languages"
sloc = require "../src/sloc"
manyLines = ('# \n' for i in [0...10000]).join('')
longLine = ('### ###' for i in [0...10000]).join('')
describe "The sloc module", ->
it "should be a function", ->
... | total: 3
it "should handle CR line endings", ->
sloc("a\rb\rc", "js").total.should.equal 3
describe "language support", ->
for l in langs then do (l) ->
for n in l.names then do (n) ->
it "should support #{n}", ->
res = sloc l.code, n
(n in sloc.extensions).should.equa... | CoffeeScript | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | 5e19071b69aa00c16ca21d111a776917e1d45560 | 969 | https://github.com/flosse/sloc/blob/5e19071b69aa00c16ca21d111a776917e1d45560/spec/sloc.spec.coffee | 1 | 49 |
flosse/sloc:spec/sloc.spec.coffee:3:raw_corpus | raw_corpus | fs.readFile "./spec/testfiles/test2.js", "utf-8", (err, code) ->
res = sloc code, "js", debug: yes
res.source.should.equal 0
res.empty.should.equal 5
res.block.should.equal 13
res.total.should.equal 13
done()
it "evaluates an emty file correctly", (done) ->
fs.read... | CoffeeScript | flosse/sloc | spec/sloc.spec.coffee | MIT | 4f6431cb8102d28de5834068ff4cedc9a436f8e4 | 969 | https://github.com/flosse/sloc/blob/4f6431cb8102d28de5834068ff4cedc9a436f8e4/spec/sloc.spec.coffee | 92 | 112 | ||
flosse/sloc:spec/sloc.spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
fs.readFile "./spec/testfiles/test2.js", "utf-8", (err, code) ->
res = sloc code, "js", debug: yes
res.source.should.equal 0
res.empty.should.equal 5
res.block.should.equal 13
res.total.should.equal 13
done()
it ... | fs.readFile("./spec/testfiles/test2.js", "utf-8", function(err, code) {
var res;
res = sloc(code, "js", {
debug: true
});
res.source.should.equal(0);
res.empty.should.equal(5);
res.block.should.equal(13);
res.total.should.equal(13);
return done();
});
it("evaluates an emty file correctly", function... | CoffeeScript | JavaScript | flosse/sloc | spec/sloc.spec.coffee | MIT | 4f6431cb8102d28de5834068ff4cedc9a436f8e4 | 969 | https://github.com/flosse/sloc/blob/4f6431cb8102d28de5834068ff4cedc9a436f8e4/spec/sloc.spec.coffee | 92 | 112 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.