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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
buttercoin/buttercoin:lib/ews/ew_server.coffee:1:completion | completion | _ = require ('underscore')
stump = require('stump')
Q = require('q')
WebsocketListener = require('./ws_listener')
EngineProtocol = require('./e_protocol')
EngineServer = require('../engine_server')
helpers = require('enkihelpers')
module.exports = class EngineWebsocketServer extends EngineServer
@default_options =... | wsconfig: {port: @options.port}
protocol_factory: @new_connection
} )
@listener.listen()
stop: =>
if @closed
throw Error('ALREADY CLOSED')
@closed = true
@info 'SHUTTING DOWN'
cop = helpers.extend({}, @connection_map)
@connection_map = {}
return @listener.close().th... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | a825a9ea31d695f8abb600f3f27ff635a839c0c2 | 663 | https://github.com/buttercoin/buttercoin/blob/a825a9ea31d695f8abb600f3f27ff635a839c0c2/lib/ews/ew_server.coffee | 1 | 50 |
buttercoin/buttercoin:lib/ews/ew_server.coffee:2:raw_corpus | raw_corpus | })
protocol.start(connection)
connection_lost: (connection) =>
delete @connection_map[connection.conncounter]
send_all: ( obj ) =>
for x, y of @connection_map
console.log x
y.send_obj obj | CoffeeScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | a825a9ea31d695f8abb600f3f27ff635a839c0c2 | 663 | https://github.com/buttercoin/buttercoin/blob/a825a9ea31d695f8abb600f3f27ff635a839c0c2/lib/ews/ew_server.coffee | 51 | 60 | ||
buttercoin/buttercoin:lib/ews/ew_server.coffee:2:completion | completion | })
protocol.start(connection)
connection_lost: (connection) =>
delete @connection_map[connection.conncounter] | send_all: ( obj ) =>
for x, y of @connection_map
console.log x
y.send_obj obj | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | a825a9ea31d695f8abb600f3f27ff635a839c0c2 | 663 | https://github.com/buttercoin/buttercoin/blob/a825a9ea31d695f8abb600f3f27ff635a839c0c2/lib/ews/ew_server.coffee | 51 | 60 |
buttercoin/buttercoin:lib/ews/ew_server.coffee:1:raw_corpus | raw_corpus | _ = require ('underscore')
stump = require('stump')
Q = require('q')
WebsocketListener = require('./ws_listener')
EngineProtocol = require('./e_protocol')
EngineServer = require('../engine_server')
helpers = require('enkihelpers')
module.exports = class EngineWebsocketServer extends EngineServer
constructor: (opti... | CoffeeScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | 0bfa62c2b810ec4efa4cd4aff6b27d1aa12e2a03 | 663 | https://github.com/buttercoin/buttercoin/blob/0bfa62c2b810ec4efa4cd4aff6b27d1aa12e2a03/lib/ews/ew_server.coffee | 1 | 50 | ||
buttercoin/buttercoin:lib/ews/ew_server.coffee:1:completion | completion | _ = require ('underscore')
stump = require('stump')
Q = require('q')
WebsocketListener = require('./ws_listener')
EngineProtocol = require('./e_protocol')
EngineServer = require('../engine_server')
helpers = require('enkihelpers')
module.exports = class EngineWebsocketServer extends EngineServer
constructor: (opti... | wsconfig: {port: @options.port}
protocol_factory: @new_connection
} )
@listener.listen()
stop: =>
if @closed
throw Error('ALREADY CLOSED')
@closed = true
@info 'SHUTTING DOWN'
cop = helpers.extend({}, @connection_map)
@connection_map = {}
return @listener.close().th... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | 0bfa62c2b810ec4efa4cd4aff6b27d1aa12e2a03 | 663 | https://github.com/buttercoin/buttercoin/blob/0bfa62c2b810ec4efa4cd4aff6b27d1aa12e2a03/lib/ews/ew_server.coffee | 1 | 50 |
buttercoin/buttercoin:lib/ews/ew_server.coffee:2:raw_corpus | raw_corpus | })
protocol.start(connection)
connection_lost: (connection) =>
delete @connection_map[connection.conncounter]
send_all: ( obj ) =>
@info 'SEND ALL', obj
for x, y of @connection_map
console.log x
y.send_obj obj | CoffeeScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | eaa94ca8f63b9a3545b0f217d2e280ada471a47e | 663 | https://github.com/buttercoin/buttercoin/blob/eaa94ca8f63b9a3545b0f217d2e280ada471a47e/lib/ews/ew_server.coffee | 51 | 61 | ||
buttercoin/buttercoin:lib/ews/ew_server.coffee:2:completion | completion | })
protocol.start(connection)
connection_lost: (connection) =>
delete @connection_map[connection.conncounter] | send_all: ( obj ) =>
@info 'SEND ALL', obj
for x, y of @connection_map
console.log x
y.send_obj obj | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | eaa94ca8f63b9a3545b0f217d2e280ada471a47e | 663 | https://github.com/buttercoin/buttercoin/blob/eaa94ca8f63b9a3545b0f217d2e280ada471a47e/lib/ews/ew_server.coffee | 51 | 61 |
buttercoin/buttercoin:lib/ews/ew_server.coffee:2:raw_corpus | raw_corpus | })
protocol.start(connection)
connection_lost: (connection) =>
delete @connection_map[connection.conncounter]
send_all: ( obj ) =>
@info 'SEND ALL'
for x, y of @connection_map
y.send_obj obj | CoffeeScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | a557f655fbd8ff5f37d35d3ca94d025585bb08d2 | 663 | https://github.com/buttercoin/buttercoin/blob/a557f655fbd8ff5f37d35d3ca94d025585bb08d2/lib/ews/ew_server.coffee | 51 | 60 | ||
buttercoin/buttercoin:lib/ews/ew_server.coffee:2:completion | completion | })
protocol.start(connection)
connection_lost: (connection) =>
delete @connection_map[connection.conncounter] | send_all: ( obj ) =>
@info 'SEND ALL'
for x, y of @connection_map
y.send_obj obj | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | a557f655fbd8ff5f37d35d3ca94d025585bb08d2 | 663 | https://github.com/buttercoin/buttercoin/blob/a557f655fbd8ff5f37d35d3ca94d025585bb08d2/lib/ews/ew_server.coffee | 51 | 60 |
buttercoin/buttercoin:lib/ews/ew_server.coffee:1:raw_corpus | raw_corpus | stump = require('stump')
Q = require('q')
WebsocketListener = require('./ws_listener')
EngineProtocol = require('./e_protocol')
EngineServer = require('../engine_server')
helpers = require('enkihelpers')
module.exports = class EngineWebsocketServer extends EngineServer
start: =>
@connection_map = {}
@close... | CoffeeScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | 46d1f5270f26492ff7928771e4a55b06ed8c9aab | 663 | https://github.com/buttercoin/buttercoin/blob/46d1f5270f26492ff7928771e4a55b06ed8c9aab/lib/ews/ew_server.coffee | 1 | 50 | ||
buttercoin/buttercoin:lib/ews/ew_server.coffee:1:completion | completion | stump = require('stump')
Q = require('q')
WebsocketListener = require('./ws_listener')
EngineProtocol = require('./e_protocol')
EngineServer = require('../engine_server')
helpers = require('enkihelpers')
module.exports = class EngineWebsocketServer extends EngineServer
start: =>
@connection_map = {}
@close... | @closed = true
@info 'SHUTTING DOWN'
cop = helpers.extend({}, @connection_map)
@connection_map = {}
return @listener.close().then =>
@info 'LISTENER CLOSED'
Q.all( [y.disconnect() for x,y of cop] ).then =>
@info 'ALL CONNS CLOSED'
return true
new_connection: (connection) =... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | 46d1f5270f26492ff7928771e4a55b06ed8c9aab | 663 | https://github.com/buttercoin/buttercoin/blob/46d1f5270f26492ff7928771e4a55b06ed8c9aab/lib/ews/ew_server.coffee | 1 | 50 |
buttercoin/buttercoin:lib/ews/ew_server.coffee:1:raw_corpus | raw_corpus | stump = require('stump')
WebsocketListener = require('./ws_listener')
EngineProtocol = require('./e_protocol')
EngineServer = require('../engine_server')
helpers = require('enkihelpers')
module.exports = class EngineWebsocketServer extends EngineServer
start: =>
@connection_map = {}
@closed = false
@p... | CoffeeScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | c87785c085716042476fba3dee430b2baaacc139 | 663 | https://github.com/buttercoin/buttercoin/blob/c87785c085716042476fba3dee430b2baaacc139/lib/ews/ew_server.coffee | 1 | 50 | ||
buttercoin/buttercoin:lib/ews/ew_server.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
stump = require('stump')
WebsocketListener = require('./ws_listener')
EngineProtocol = require('./e_protocol')
EngineServer = require('../engine_server')
helpers = require('enkihelpers')
module.exports = class EngineWebsocketServer extends EngineServer
start... | var EngineProtocol, EngineServer, EngineWebsocketServer, WebsocketListener, helpers, stump,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
stump = require('stump');
WebsocketListener = require('./w... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | c87785c085716042476fba3dee430b2baaacc139 | 663 | https://github.com/buttercoin/buttercoin/blob/c87785c085716042476fba3dee430b2baaacc139/lib/ews/ew_server.coffee | 1 | 50 |
buttercoin/buttercoin:lib/ews/ew_server.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var EngineProtocol, EngineServer, EngineWebsocketServer, WebsocketListener, helpers, stump,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
stum... | stump = require('stump')
WebsocketListener = require('./ws_listener')
EngineProtocol = require('./e_protocol')
EngineServer = require('../engine_server')
helpers = require('enkihelpers')
module.exports = class EngineWebsocketServer extends EngineServer
start: =>
@connection_map = {}
@closed = false
@p... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | c87785c085716042476fba3dee430b2baaacc139 | 663 | https://github.com/buttercoin/buttercoin/blob/c87785c085716042476fba3dee430b2baaacc139/lib/ews/ew_server.coffee | 1 | 50 |
buttercoin/buttercoin:lib/ews/ew_server.coffee:1:completion | completion | stump = require('stump')
WebsocketListener = require('./ws_listener')
EngineProtocol = require('./e_protocol')
EngineServer = require('../engine_server')
helpers = require('enkihelpers')
module.exports = class EngineWebsocketServer extends EngineServer
start: =>
@connection_map = {}
@closed = false
@p... | @info 'SHUTTING DOWN'
cop = helpers.extend({}, @connection_map)
@connection_map = {}
return @listener.close().then =>
@info 'LISTENER CLOSED'
Q.all( [y.disconnect() for x,y of cop] ).then =>
@info 'ALL CONNS CLOSED'
return true
new_connection: (connection) => # this is our pro... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | c87785c085716042476fba3dee430b2baaacc139 | 663 | https://github.com/buttercoin/buttercoin/blob/c87785c085716042476fba3dee430b2baaacc139/lib/ews/ew_server.coffee | 1 | 50 |
buttercoin/buttercoin:lib/ews/ew_server.coffee:1:raw_corpus | raw_corpus | stump = require('stump')
WebsocketListener = require('./ws_listener')
EngineProtocol = require('./e_protocol')
EngineServer = require('../engine_server')
module.exports = class EngineWebsocketServer extends EngineServer
start: =>
@connection_map = {}
@pce.start().then =>
@listener = new WebsocketLis... | CoffeeScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | a029c1a623369cb4df0af6e982a2420b6c0d1a62 | 663 | https://github.com/buttercoin/buttercoin/blob/a029c1a623369cb4df0af6e982a2420b6c0d1a62/lib/ews/ew_server.coffee | 1 | 43 | ||
buttercoin/buttercoin:lib/ews/ew_server.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
stump = require('stump')
WebsocketListener = require('./ws_listener')
EngineProtocol = require('./e_protocol')
EngineServer = require('../engine_server')
module.exports = class EngineWebsocketServer extends EngineServer
start: =>
@connection_map = {}
... | var EngineProtocol, EngineServer, EngineWebsocketServer, WebsocketListener, stump,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
stump = require('stump');
WebsocketListener = require('./ws_listene... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | a029c1a623369cb4df0af6e982a2420b6c0d1a62 | 663 | https://github.com/buttercoin/buttercoin/blob/a029c1a623369cb4df0af6e982a2420b6c0d1a62/lib/ews/ew_server.coffee | 1 | 43 |
buttercoin/buttercoin:lib/ews/ew_server.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var EngineProtocol, EngineServer, EngineWebsocketServer, WebsocketListener, stump,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
stump = requi... | stump = require('stump')
WebsocketListener = require('./ws_listener')
EngineProtocol = require('./e_protocol')
EngineServer = require('../engine_server')
module.exports = class EngineWebsocketServer extends EngineServer
start: =>
@connection_map = {}
@pce.start().then =>
@listener = new WebsocketLis... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | a029c1a623369cb4df0af6e982a2420b6c0d1a62 | 663 | https://github.com/buttercoin/buttercoin/blob/a029c1a623369cb4df0af6e982a2420b6c0d1a62/lib/ews/ew_server.coffee | 1 | 43 |
buttercoin/buttercoin:lib/ews/ew_server.coffee:1:completion | completion | stump = require('stump')
WebsocketListener = require('./ws_listener')
EngineProtocol = require('./e_protocol')
EngineServer = require('../engine_server')
module.exports = class EngineWebsocketServer extends EngineServer
start: =>
@connection_map = {}
@pce.start().then =>
@listener = new WebsocketLis... | y.disconnect()
@connection_map = {}
return @listener.close()
new_connection: (connection) => # this is our protocol factory
@connection_map[ connection.conncounter ] = connection
protocol = new EngineProtocol({
pce: @pce
connection_lost: @connection_lost
send_all: @send_all
})... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/ews/ew_server.coffee | MIT | a029c1a623369cb4df0af6e982a2420b6c0d1a62 | 663 | https://github.com/buttercoin/buttercoin/blob/a029c1a623369cb4df0af6e982a2420b6c0d1a62/lib/ews/ew_server.coffee | 1 | 43 |
jianliaoim/talk-os:talk-web/test/spec/updater/settings.spec.coffee:1:raw_corpus | raw_corpus | Immutable = require 'immutable'
defaultStore = Immutable.fromJS
settings:
showFavorites: false
showInteBanner: true
showCollection: false
showTag: false
teamFootprints: {} # _teamId => unix time
foldedContacts: {} # [_teamId, _contactId]
describe 'Updater: settings', ->
beforeEach ->
... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/updater/settings.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/settings.spec.coffee | 1 | 44 | ||
jianliaoim/talk-os:talk-web/test/spec/updater/settings.spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Immutable = require 'immutable'
defaultStore = Immutable.fromJS
settings:
showFavorites: false
showInteBanner: true
showCollection: false
showTag: false
teamFootprints: {} # _teamId => unix time
foldedContacts: {} # [_teamId, _contactId... | var Immutable, defaultStore;
Immutable = require('immutable');
defaultStore = Immutable.fromJS({
settings: {
showFavorites: false,
showInteBanner: true,
showCollection: false,
showTag: false,
teamFootprints: {}, // _teamId => unix time
foldedContacts: {} // [_teamId, _contactId]
}
});
des... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/test/spec/updater/settings.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/settings.spec.coffee | 1 | 44 |
jianliaoim/talk-os:talk-web/test/spec/updater/settings.spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Immutable, defaultStore;
Immutable = require('immutable');
defaultStore = Immutable.fromJS({
settings: {
showFavorites: false,
showInteBanner: true,
showCollection: false,
showTag: false,
teamFootprints: {}, // _teamId => unix time
f... | Immutable = require 'immutable'
defaultStore = Immutable.fromJS
settings:
showFavorites: false
showInteBanner: true
showCollection: false
showTag: false
teamFootprints: {} # _teamId => unix time
foldedContacts: {} # [_teamId, _contactId]
describe 'Updater: settings', ->
beforeEach ->
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/updater/settings.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/settings.spec.coffee | 1 | 44 |
jianliaoim/talk-os:talk-web/test/spec/updater/settings.spec.coffee:1:completion | completion | Immutable = require 'immutable'
defaultStore = Immutable.fromJS
settings:
showFavorites: false
showInteBanner: true
showCollection: false
showTag: false
teamFootprints: {} # _teamId => unix time
foldedContacts: {} # [_teamId, _contactId]
describe 'Updater: settings', ->
beforeEach ->
... | describe 'method: update', ->
store = null
actionData = null
beforeEach ->
store = defaultStore
actionData = Immutable.fromJS
showFavorites: true
showInteBanner: false
showCollection: true
showTag: true
it 'should update settings', ->
newStore = @upda... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/updater/settings.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/settings.spec.coffee | 1 | 44 |
jianliaoim/talk-os:talk-web/test/spec/updater/settings.spec.coffee:2:raw_corpus | raw_corpus | expect(newStore.getIn(['settings'])).toEqualImmutable(expected)
describe 'method: teamFootprints', ->
store = null
actionData = null
beforeEach ->
store = defaultStore
actionData = Immutable.fromJS
_teamId: '1'
time: '2'
it 'should update teamFootprints', ->
newSt... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/updater/settings.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/settings.spec.coffee | 46 | 85 | ||
jianliaoim/talk-os:talk-web/test/spec/updater/settings.spec.coffee:2:completion | completion | expect(newStore.getIn(['settings'])).toEqualImmutable(expected)
describe 'method: teamFootprints', ->
store = null
actionData = null
beforeEach ->
store = defaultStore
actionData = Immutable.fromJS
_teamId: '1'
time: '2'
it 'should update teamFootprints', ->
newSt... | store = null
actionData = null
beforeEach ->
store = defaultStore
actionData = Immutable.fromJS
_teamId: '1'
_id: '2'
it 'should update teamFootprints', ->
newStore = @updater.foldContact(store, actionData)
_teamId = actionData.get('_teamId')
_id = actionData... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/updater/settings.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/settings.spec.coffee | 46 | 85 |
jianliaoim/talk-os:talk-web/test/spec/updater/settings.spec.coffee:3:raw_corpus | raw_corpus | beforeEach ->
store = defaultStore
actionData = Immutable.fromJS
_teamId: '1'
_id: '2'
it 'should update teamFootprints', ->
newStore = @updater.unfoldContact(store, actionData)
_teamId = actionData.get('_teamId')
_id = actionData.get('_id')
expect(newStore.get... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/updater/settings.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/settings.spec.coffee | 87 | 99 | ||
jianliaoim/talk-os:talk-web/test/spec/updater/settings.spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
beforeEach ->
store = defaultStore
actionData = Immutable.fromJS
_teamId: '1'
_id: '2'
it 'should update teamFootprints', ->
newStore = @updater.unfoldContact(store, actionData)
_teamId = actionData.get('_teamId')
... | beforeEach(function() {
var actionData, store;
store = defaultStore;
return actionData = Immutable.fromJS({
_teamId: '1',
_id: '2'
});
});
it('should update teamFootprints', function() {
var _id, _teamId, newStore;
newStore = this.updater.unfoldContact(store, actionData);
_teamId = actionData.get... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/test/spec/updater/settings.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/settings.spec.coffee | 87 | 99 |
jianliaoim/talk-os:talk-web/test/spec/updater/settings.spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
beforeEach(function() {
var actionData, store;
store = defaultStore;
return actionData = Immutable.fromJS({
_teamId: '1',
_id: '2'
});
});
it('should update teamFootprints', function() {
var _id, _teamId, newStore;
newStore = this.updater.unfol... | beforeEach ->
store = defaultStore
actionData = Immutable.fromJS
_teamId: '1'
_id: '2'
it 'should update teamFootprints', ->
newStore = @updater.unfoldContact(store, actionData)
_teamId = actionData.get('_teamId')
_id = actionData.get('_id')
expect(newStore.get... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/updater/settings.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/settings.spec.coffee | 87 | 99 |
jianliaoim/talk-os:talk-web/test/spec/updater/settings.spec.coffee:3:completion | completion | beforeEach ->
store = defaultStore
actionData = Immutable.fromJS
_teamId: '1'
_id: '2' | it 'should update teamFootprints', ->
newStore = @updater.unfoldContact(store, actionData)
_teamId = actionData.get('_teamId')
_id = actionData.get('_id')
expect(newStore.getIn(['settings', 'foldedContacts', _teamId, _id])).toEqual(false) | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/updater/settings.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/settings.spec.coffee | 87 | 99 |
mojs/mojs:spec/shapes/curve.coffee:1:raw_corpus | raw_corpus | Curve = mojs.shapesMap.getShape('curve')
Bit = mojs.shapesMap.getShape('bit')
ns = 'http://www.w3.org/2000/svg'
svg = document.createElementNS?(ns, "svg")
curve = new Curve ctx: svg
describe 'Curve ->', ->
it 'should extend Bit', ->
expect(curve instanceof Bit).toBe(true)
describe '_declareDefau... | CoffeeScript | mojs/mojs | spec/shapes/curve.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/curve.coffee | 1 | 41 | ||
mojs/mojs:spec/shapes/curve.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Curve = mojs.shapesMap.getShape('curve')
Bit = mojs.shapesMap.getShape('bit')
ns = 'http://www.w3.org/2000/svg'
svg = document.createElementNS?(ns, "svg")
curve = new Curve ctx: svg
describe 'Curve ->', ->
it 'should extend Bit', ->
expect(cu... | var Bit, Curve, curve, ns, svg;
Curve = mojs.shapesMap.getShape('curve');
Bit = mojs.shapesMap.getShape('bit');
ns = 'http://www.w3.org/2000/svg';
svg = typeof document.createElementNS === "function" ? document.createElementNS(ns, "svg") : void 0;
curve = new Curve({
ctx: svg
});
describe('Curve ->', function()... | CoffeeScript | JavaScript | mojs/mojs | spec/shapes/curve.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/curve.coffee | 1 | 41 |
mojs/mojs:spec/shapes/curve.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Bit, Curve, curve, ns, svg;
Curve = mojs.shapesMap.getShape('curve');
Bit = mojs.shapesMap.getShape('bit');
ns = 'http://www.w3.org/2000/svg';
svg = typeof document.createElementNS === "function" ? document.createElementNS(ns, "svg") : void 0;
curve = new ... | Curve = mojs.shapesMap.getShape('curve')
Bit = mojs.shapesMap.getShape('bit')
ns = 'http://www.w3.org/2000/svg'
svg = document.createElementNS?(ns, "svg")
curve = new Curve ctx: svg
describe 'Curve ->', ->
it 'should extend Bit', ->
expect(curve instanceof Bit).toBe(true)
describe '_declareDefau... | JavaScript | CoffeeScript | mojs/mojs | spec/shapes/curve.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/curve.coffee | 1 | 41 |
mojs/mojs:spec/shapes/curve.coffee:2:raw_corpus | raw_corpus | describe '_draw method ->', ->
it 'should call super', ->
spyOn Bit::, '_draw'
curve._draw()
expect(Bit::_draw).toHaveBeenCalled()
it 'should call `el.setAttribute` for `d` attribute ', ->
radiusX = 20; radiusY = 30
curve = new Curve ctx: svg, radiusX, radiusY
curve._draw()
... | CoffeeScript | mojs/mojs | spec/shapes/curve.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/curve.coffee | 43 | 81 | ||
mojs/mojs:spec/shapes/curve.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe '_draw method ->', ->
it 'should call super', ->
spyOn Bit::, '_draw'
curve._draw()
expect(Bit::_draw).toHaveBeenCalled()
it 'should call `el.setAttribute` for `d` attribute ', ->
radiusX = 20; radiusY = 30
curve = n... | describe('_draw method ->', function() {
it('should call super', function() {
spyOn(Bit.prototype, '_draw');
curve._draw();
return expect(Bit.prototype._draw).toHaveBeenCalled();
});
it('should call `el.setAttribute` for `d` attribute ', function() {
var curve, d, isD1, isD2, p, radiusX, radiusY, ... | CoffeeScript | JavaScript | mojs/mojs | spec/shapes/curve.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/curve.coffee | 43 | 81 |
mojs/mojs:spec/shapes/curve.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('_draw method ->', function() {
it('should call super', function() {
spyOn(Bit.prototype, '_draw');
curve._draw();
return expect(Bit.prototype._draw).toHaveBeenCalled();
});
it('should call `el.setAttribute` for `d` attribute ', function(... | describe '_draw method ->', ->
it 'should call super', ->
spyOn Bit::, '_draw'
curve._draw()
expect(Bit::_draw).toHaveBeenCalled()
it 'should call `el.setAttribute` for `d` attribute ', ->
radiusX = 20; radiusY = 30
curve = new Curve ctx: svg, radiusX, radiusY
curve._draw()
... | JavaScript | CoffeeScript | mojs/mojs | spec/shapes/curve.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/curve.coffee | 43 | 81 |
mojs/mojs:spec/shapes/curve.coffee:2:completion | completion | describe '_draw method ->', ->
it 'should call super', ->
spyOn Bit::, '_draw'
curve._draw()
expect(Bit::_draw).toHaveBeenCalled()
it 'should call `el.setAttribute` for `d` attribute ', ->
radiusX = 20; radiusY = 30
curve = new Curve ctx: svg, radiusX, radiusY
curve._draw()
... | x2 = x
x3 = x + radiusX
y1 = y - radiusY
y2 = y
y3 = y + radiusY
d = curve.el.getAttribute('d')
isD1 = d is "M#{x1} #{y} Q #{x2} #{ y - 2*radiusY } #{x3} #{y}"
isD2 = d is "M #{x1} #{y} Q #{x2} #{ y - 2*radiusY } #{x3} #{y}"
expect( isD1 or isD2 ).toBe true
it 'shou... | CoffeeScript | CoffeeScript | mojs/mojs | spec/shapes/curve.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/curve.coffee | 43 | 81 |
mojs/mojs:spec/shapes/curve.coffee:3:raw_corpus | raw_corpus | x = 1*p.x
y = 1*p.y
x1 = x - radiusX
x2 = x
x3 = x + radiusX
y1 = y - radiusY
y2 = y
y3 = y + radiusY
expect( curve._prevRadiusX ).toBe radiusX
expect( curve._prevRadiusY ).toBe radiusY
expect( curve._prevPoints ).toBe p.points
it 'should not set the ... | CoffeeScript | mojs/mojs | spec/shapes/curve.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/curve.coffee | 83 | 128 | ||
mojs/mojs:spec/shapes/curve.coffee:3:completion | completion | x = 1*p.x
y = 1*p.y
x1 = x - radiusX
x2 = x
x3 = x + radiusX
y1 = y - radiusY
y2 = y
y3 = y + radiusY
expect( curve._prevRadiusX ).toBe radiusX
expect( curve._prevRadiusY ).toBe radiusY
expect( curve._prevPoints ).toBe p.points
it 'should not set the ... | .not.toHaveBeenCalled()
it 'should set `d` attribute if `radiusX` changed', ->
curve = new Curve
ctx: document.createElementNS?(ns, "svg")
radius: 20
points: 10
curve._draw()
spyOn curve.el, 'setAttribute'
curve._props.radiusX = 30
curve._draw()
expect... | CoffeeScript | CoffeeScript | mojs/mojs | spec/shapes/curve.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/curve.coffee | 83 | 128 |
mojs/mojs:spec/shapes/curve.coffee:4:raw_corpus | raw_corpus | it 'should set `d` attribute if `points` changed', ->
curve = new Curve
ctx: document.createElementNS?(ns, "svg")
radius: 20
points: 10
curve._draw()
spyOn curve.el, 'setAttribute'
curve._props.points = 30
curve._draw()
expect( curve.el.setAttribute ).toHav... | CoffeeScript | mojs/mojs | spec/shapes/curve.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/curve.coffee | 130 | 155 | ||
mojs/mojs:spec/shapes/curve.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should set `d` attribute if `points` changed', ->
curve = new Curve
ctx: document.createElementNS?(ns, "svg")
radius: 20
points: 10
curve._draw()
spyOn curve.el, 'setAttribute'
curve._props.points = 30
... | it('should set `d` attribute if `points` changed', function() {
var curve;
curve = new Curve({
ctx: typeof document.createElementNS === "function" ? document.createElementNS(ns, "svg") : void 0,
radius: 20,
points: 10
});
curve._draw();
spyOn(curve.el, 'setAttribute');
curve._props.points = 30;
... | CoffeeScript | JavaScript | mojs/mojs | spec/shapes/curve.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/curve.coffee | 130 | 155 |
mojs/mojs:spec/shapes/curve.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should set `d` attribute if `points` changed', function() {
var curve;
curve = new Curve({
ctx: typeof document.createElementNS === "function" ? document.createElementNS(ns, "svg") : void 0,
radius: 20,
points: 10
});
curve._draw();
spyOn(... | it 'should set `d` attribute if `points` changed', ->
curve = new Curve
ctx: document.createElementNS?(ns, "svg")
radius: 20
points: 10
curve._draw()
spyOn curve.el, 'setAttribute'
curve._props.points = 30
curve._draw()
expect( curve.el.setAttribute ).toHav... | JavaScript | CoffeeScript | mojs/mojs | spec/shapes/curve.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/curve.coffee | 130 | 155 |
mojs/mojs:spec/shapes/curve.coffee:4:completion | completion | it 'should set `d` attribute if `points` changed', ->
curve = new Curve
ctx: document.createElementNS?(ns, "svg")
radius: 20
points: 10
curve._draw()
spyOn curve.el, 'setAttribute'
curve._props.points = 30
curve._draw()
expect( curve.el.setAttribute ).toHav... | radiusX = 20; radiusY = 30
curve = new Curve ctx: svg, radiusX, radiusY
p = curve._props
radiusX = if p.radiusX? then p.radiusX else p.radius
radiusY = if p.radiusY? then p.radiusY else p.radius
dRadius = radiusX + radiusY
sqrt = Math.sqrt((3*radiusX + radiusY)*(radiusX + 3*radius... | CoffeeScript | CoffeeScript | mojs/mojs | spec/shapes/curve.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/curve.coffee | 130 | 155 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee:1:raw_corpus | raw_corpus | ###
# Copyright (c) 2013-2018 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | 1 | 41 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee:1:completion | completion | ###
# Copyright (c) 2013-2018 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | jsObject: '='
data: '='
refresh: '='
link: (scope, element, attrs) ->
$element = $(element)
$parent = $element.parent()
intervalPromise = null
# Resize function
resize = ->
parentHeight = $parent.height()
... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | 1 | 41 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee:2:raw_corpus | raw_corpus | # Create JS object and invoke onCreate
resize()
if scope.jsObject.onCreate?
scope.jsObject.onCreate($element, scope.data)
# Update when data changes
if scope.jsObject.onData?
scope.$watch 'data', (data) ->
scope.jsObjec... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | 43 | 80 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Create JS object and invoke onCreate
resize()
if scope.jsObject.onCreate?
scope.jsObject.onCreate($element, scope.data)
# Update when data changes
if scope.jsObject.onData?
scope.$... | // Create JS object and invoke onCreate
var eventName, intervalFn, intervalPromise, resizeEvent;
resize();
if (scope.jsObject.onCreate != null) {
scope.jsObject.onCreate($element, scope.data);
}
// Update when data changes
if (scope.jsObject.onData != null) {
scope.$watch('data', function(data) {
return scop... | CoffeeScript | JavaScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | 43 | 80 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Create JS object and invoke onCreate
var eventName, intervalFn, intervalPromise, resizeEvent;
resize();
if (scope.jsObject.onCreate != null) {
scope.jsObject.onCreate($element, scope.data);
}
// Update when data changes
if (scope.jsObject.onData != null) {
... | # Create JS object and invoke onCreate
resize()
if scope.jsObject.onCreate?
scope.jsObject.onCreate($element, scope.data)
# Update when data changes
if scope.jsObject.onData?
scope.$watch 'data', (data) ->
scope.jsObjec... | JavaScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | 43 | 80 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee:2:completion | completion | # Create JS object and invoke onCreate
resize()
if scope.jsObject.onCreate?
scope.jsObject.onCreate($element, scope.data)
# Update when data changes
if scope.jsObject.onData?
scope.$watch 'data', (data) ->
scope.jsObjec... | # Resize on window resize, and invoke onResize event (if exists)
resizeEvent = ->
resize()
if scope.jsObject.onResize?
scope.jsObject.onResize($element, scope.data)
$parent.resize _.throttle(resizeEvent, 200, { leading: false, trailing: true }... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | 43 | 80 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee:3:raw_corpus | raw_corpus | $parent.off 'resize'
$parent.off 'scroll'
return
return
} | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | 83 | 88 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee:1:raw_corpus | raw_corpus | ###
# Copyright (c) 2013-2015 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | 1 | 41 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee:1:completion | completion | ###
# Copyright (c) 2013-2015 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | jsObject: '='
data: '='
refresh: '='
link: (scope, element, attrs) ->
$element = $(element)
$parent = $element.parent()
intervalPromise = null
# Resize function
resize = ->
parentHeight = $parent.height()
... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/widgets/javascript/directives.jsContainer.coffee | 1 | 41 |
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:1:raw_corpus | raw_corpus | PHPCSFixer = require "../src/beautifiers/php-cs-fixer"
Beautifier = require "../src/beautifiers/beautifier"
Executable = require "../src/beautifiers/executable"
path = require 'path'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to... | CoffeeScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/spec/beautifier-php-cs-fixer-spec.coffee | 1 | 39 | ||
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
PHPCSFixer = require "../src/beautifiers/php-cs-fixer"
Beautifier = require "../src/beautifiers/beautifier"
Executable = require "../src/beautifiers/executable"
path = require 'path'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
#... | var Beautifier, Executable, PHPCSFixer, isWindows, path;
PHPCSFixer = require("../src/beautifiers/php-cs-fixer");
Beautifier = require("../src/beautifiers/beautifier");
Executable = require("../src/beautifiers/executable");
path = require('path');
// Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to r... | CoffeeScript | JavaScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/spec/beautifier-php-cs-fixer-spec.coffee | 1 | 39 |
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Beautifier, Executable, PHPCSFixer, isWindows, path;
PHPCSFixer = require("../src/beautifiers/php-cs-fixer");
Beautifier = require("../src/beautifiers/beautifier");
Executable = require("../src/beautifiers/executable");
path = require('path');
// Use the c... | PHPCSFixer = require "../src/beautifiers/php-cs-fixer"
Beautifier = require "../src/beautifiers/beautifier"
Executable = require "../src/beautifiers/executable"
path = require 'path'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to... | JavaScript | CoffeeScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/spec/beautifier-php-cs-fixer-spec.coffee | 1 | 39 |
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:1:completion | completion | PHPCSFixer = require "../src/beautifiers/php-cs-fixer"
Beautifier = require "../src/beautifiers/beautifier"
Executable = require "../src/beautifiers/executable"
path = require 'path'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to... | # Activate package
waitsForPromise ->
activationPromise = atom.packages.activatePackage('atom-beautify')
# Force activate package
pack = atom.packages.getLoadedPackage("atom-beautify")
pack.activateNow()
# Change logger level
atom.config.set('atom-beautify.general.loggerLevel', '... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/spec/beautifier-php-cs-fixer-spec.coffee | 1 | 39 |
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:2:raw_corpus | raw_corpus | afterEach ->
Executable.prototype.spawn = execSpawn
OSSpecificSpecs = ->
text = "<?php echo \"test\"; ?>"
it "should error when beautifier's program not found", ->
expect(beautifier).not.toBe(null)
expect(beautifier instanceof Beautifier).toBe(true)
waitsForPromise shoul... | CoffeeScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/spec/beautifier-php-cs-fixer-spec.coffee | 41 | 82 | ||
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
afterEach ->
Executable.prototype.spawn = execSpawn
OSSpecificSpecs = ->
text = "<?php echo \"test\"; ?>"
it "should error when beautifier's program not found", ->
expect(beautifier).not.toBe(null)
expect(beautifier instanc... | var OSSpecificSpecs;
afterEach(function() {
return Executable.prototype.spawn = execSpawn;
});
OSSpecificSpecs = function() {
var failWhichProgram, text;
text = "<?php echo \"test\"; ?>";
it("should error when beautifier's program not found", function() {
expect(beautifier).not.toBe(null);
expect(beau... | CoffeeScript | JavaScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/spec/beautifier-php-cs-fixer-spec.coffee | 41 | 82 |
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var OSSpecificSpecs;
afterEach(function() {
return Executable.prototype.spawn = execSpawn;
});
OSSpecificSpecs = function() {
var failWhichProgram, text;
text = "<?php echo \"test\"; ?>";
it("should error when beautifier's program not found", function() {... | afterEach ->
Executable.prototype.spawn = execSpawn
OSSpecificSpecs = ->
text = "<?php echo \"test\"; ?>"
it "should error when beautifier's program not found", ->
expect(beautifier).not.toBe(null)
expect(beautifier instanceof Beautifier).toBe(true)
waitsForPromise shoul... | JavaScript | CoffeeScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/spec/beautifier-php-cs-fixer-spec.coffee | 41 | 82 |
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:2:completion | completion | afterEach ->
Executable.prototype.spawn = execSpawn
OSSpecificSpecs = ->
text = "<?php echo \"test\"; ?>"
it "should error when beautifier's program not found", ->
expect(beautifier).not.toBe(null)
expect(beautifier instanceof Beautifier).toBe(true)
waitsForPromise shoul... | er.code = 'ENOENT'
return beautifier.Promise.reject(er)
# Beautify
p = beautifier.loadExecutables().then(() -> beautifier.beautify(text, language, options))
expect(p).not.toBe(null)
expect(p instanceof beautifier.Promise).toBe(true)
cb = (v) ->
#... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/spec/beautifier-php-cs-fixer-spec.coffee | 41 | 82 |
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:3:raw_corpus | raw_corpus | if not Executable.isWindows and failingProgram is "php"
# Only applicable on Windows
return
waitsForPromise shouldReject: true, ->
language = "PHP"
options = {
fixers: ""
levels: ""
}
cb = (v) ->
... | CoffeeScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/spec/beautifier-php-cs-fixer-spec.coffee | 84 | 132 | ||
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if not Executable.isWindows and failingProgram is "php"
# Only applicable on Windows
return
waitsForPromise shouldReject: true, ->
language = "PHP"
options = {
fixers: ""
level... | if (!Executable.isWindows && failingProgram === "php") {
return;
}
// Only applicable on Windows
waitsForPromise({
shouldReject: true
}, function() {
var cb, language, options, p;
language = "PHP";
options = {
fixers: "",
levels: ""
};
cb = function(v) {
// console.log('cb value', v)
expe... | CoffeeScript | JavaScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/spec/beautifier-php-cs-fixer-spec.coffee | 84 | 132 |
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
if (!Executable.isWindows && failingProgram === "php") {
return;
}
// Only applicable on Windows
waitsForPromise({
shouldReject: true
}, function() {
var cb, language, options, p;
language = "PHP";
options = {
fixers: "",
levels: ""
};
cb = f... | if not Executable.isWindows and failingProgram is "php"
# Only applicable on Windows
return
waitsForPromise shouldReject: true, ->
language = "PHP"
options = {
fixers: ""
levels: ""
}
cb = (v) ->
... | JavaScript | CoffeeScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/spec/beautifier-php-cs-fixer-spec.coffee | 84 | 132 |
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:3:completion | completion | if not Executable.isWindows and failingProgram is "php"
# Only applicable on Windows
return
waitsForPromise shouldReject: true, ->
language = "PHP"
options = {
fixers: ""
levels: ""
}
cb = (v) ->
... | beautifier.Promise.resolve(failingProgram)
else
# which(exe, options)
# console.log('fake exe path', exe)
beautifier.Promise.resolve("/#{exe}")
# oldSpawn = beautifier.spawn.bind(beautifier)
# beautifier.spawn
Executable.... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/spec/beautifier-php-cs-fixer-spec.coffee | 84 | 132 |
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:4:raw_corpus | raw_corpus | failWhichProgram('PHP')
# failWhichProgram('php-cs-fixer')
unless isWindows
describe "Mac/Linux", ->
beforeEach ->
# console.log('mac/linx')
Executable.isWindows = () -> false
do OSSpecificSpecs
describe "Windows", ->
beforeEach ->
# console.log... | CoffeeScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/spec/beautifier-php-cs-fixer-spec.coffee | 134 | 152 | ||
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:4:completion | completion | failWhichProgram('PHP')
# failWhichProgram('php-cs-fixer')
unless isWindows
describe "Mac/Linux", ->
beforeEach ->
# console.log('mac/linx')
Executable.isWindows = () -> false | do OSSpecificSpecs
describe "Windows", ->
beforeEach ->
# console.log('windows')
Executable.isWindows = () -> true
do OSSpecificSpecs | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/spec/beautifier-php-cs-fixer-spec.coffee | 134 | 152 |
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:1:raw_corpus | raw_corpus | PHPCSFixer = require "../src/beautifiers/php-cs-fixer"
Beautifier = require "../src/beautifiers/beautifier"
Executable = require "../src/beautifiers/executable"
path = require 'path'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to... | CoffeeScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 200f53ea38ba06d794629ac2a48ae8e5d2538ffb | 1,503 | https://github.com/Glavin001/atom-beautify/blob/200f53ea38ba06d794629ac2a48ae8e5d2538ffb/spec/beautifier-php-cs-fixer-spec.coffee | 1 | 39 | ||
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
PHPCSFixer = require "../src/beautifiers/php-cs-fixer"
Beautifier = require "../src/beautifiers/beautifier"
Executable = require "../src/beautifiers/executable"
path = require 'path'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
#... | var Beautifier, Executable, PHPCSFixer, isWindows, path;
PHPCSFixer = require("../src/beautifiers/php-cs-fixer");
Beautifier = require("../src/beautifiers/beautifier");
Executable = require("../src/beautifiers/executable");
path = require('path');
// Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to r... | CoffeeScript | JavaScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 200f53ea38ba06d794629ac2a48ae8e5d2538ffb | 1,503 | https://github.com/Glavin001/atom-beautify/blob/200f53ea38ba06d794629ac2a48ae8e5d2538ffb/spec/beautifier-php-cs-fixer-spec.coffee | 1 | 39 |
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Beautifier, Executable, PHPCSFixer, isWindows, path;
PHPCSFixer = require("../src/beautifiers/php-cs-fixer");
Beautifier = require("../src/beautifiers/beautifier");
Executable = require("../src/beautifiers/executable");
path = require('path');
// Use the c... | PHPCSFixer = require "../src/beautifiers/php-cs-fixer"
Beautifier = require "../src/beautifiers/beautifier"
Executable = require "../src/beautifiers/executable"
path = require 'path'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to... | JavaScript | CoffeeScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 200f53ea38ba06d794629ac2a48ae8e5d2538ffb | 1,503 | https://github.com/Glavin001/atom-beautify/blob/200f53ea38ba06d794629ac2a48ae8e5d2538ffb/spec/beautifier-php-cs-fixer-spec.coffee | 1 | 39 |
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:1:completion | completion | PHPCSFixer = require "../src/beautifiers/php-cs-fixer"
Beautifier = require "../src/beautifiers/beautifier"
Executable = require "../src/beautifiers/executable"
path = require 'path'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to... | # Activate package
waitsForPromise ->
activationPromise = atom.packages.activatePackage('atom-beautify')
# Force activate package
pack = atom.packages.getLoadedPackage("atom-beautify")
pack.activateNow()
# Change logger level
atom.config.set('atom-beautify.general.loggerLevel', '... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | 200f53ea38ba06d794629ac2a48ae8e5d2538ffb | 1,503 | https://github.com/Glavin001/atom-beautify/blob/200f53ea38ba06d794629ac2a48ae8e5d2538ffb/spec/beautifier-php-cs-fixer-spec.coffee | 1 | 39 |
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:1:raw_corpus | raw_corpus | PHPCSFixer = require "../src/beautifiers/php-cs-fixer"
Beautifier = require "../src/beautifiers/beautifier"
Executable = require "../src/beautifiers/executable"
path = require 'path'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to... | CoffeeScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | bc21afd424728591ea45eb8c1153df0a1b719a70 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/bc21afd424728591ea45eb8c1153df0a1b719a70/spec/beautifier-php-cs-fixer-spec.coffee | 1 | 39 | ||
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
PHPCSFixer = require "../src/beautifiers/php-cs-fixer"
Beautifier = require "../src/beautifiers/beautifier"
Executable = require "../src/beautifiers/executable"
path = require 'path'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
#... | var Beautifier, Executable, PHPCSFixer, isWindows, path;
PHPCSFixer = require("../src/beautifiers/php-cs-fixer");
Beautifier = require("../src/beautifiers/beautifier");
Executable = require("../src/beautifiers/executable");
path = require('path');
// Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to r... | CoffeeScript | JavaScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | bc21afd424728591ea45eb8c1153df0a1b719a70 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/bc21afd424728591ea45eb8c1153df0a1b719a70/spec/beautifier-php-cs-fixer-spec.coffee | 1 | 39 |
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Beautifier, Executable, PHPCSFixer, isWindows, path;
PHPCSFixer = require("../src/beautifiers/php-cs-fixer");
Beautifier = require("../src/beautifiers/beautifier");
Executable = require("../src/beautifiers/executable");
path = require('path');
// Use the c... | PHPCSFixer = require "../src/beautifiers/php-cs-fixer"
Beautifier = require "../src/beautifiers/beautifier"
Executable = require "../src/beautifiers/executable"
path = require 'path'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to... | JavaScript | CoffeeScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | bc21afd424728591ea45eb8c1153df0a1b719a70 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/bc21afd424728591ea45eb8c1153df0a1b719a70/spec/beautifier-php-cs-fixer-spec.coffee | 1 | 39 |
Glavin001/atom-beautify:spec/beautifier-php-cs-fixer-spec.coffee:1:completion | completion | PHPCSFixer = require "../src/beautifiers/php-cs-fixer"
Beautifier = require "../src/beautifiers/beautifier"
Executable = require "../src/beautifiers/executable"
path = require 'path'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to... | # Activate package
waitsForPromise ->
activationPromise = atom.packages.activatePackage('atom-beautify')
# Force activate package
pack = atom.packages.getLoadedPackage("atom-beautify")
pack.activateNow()
# Change logger level
# atom.config.set('atom-beautify._loggerLevel', 'verbo... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | spec/beautifier-php-cs-fixer-spec.coffee | MIT | bc21afd424728591ea45eb8c1153df0a1b719a70 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/bc21afd424728591ea45eb8c1153df0a1b719a70/spec/beautifier-php-cs-fixer-spec.coffee | 1 | 39 |
soulwire/Coffee-Physics:source/behaviour/Collision.coffee:1:raw_corpus | raw_corpus | ### Collision Behaviour ###
# TODO: Collision response for non Verlet integrators.
class Collision extends Behaviour
constructor: (@useMass = yes, @callback = null) ->
# Pool of collidable particles.
@pool = []
# Delta between particle positions.
@_delta = new Vector()
... | CoffeeScript | soulwire/Coffee-Physics | source/behaviour/Collision.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/behaviour/Collision.coffee | 1 | 50 | ||
soulwire/Coffee-Physics:source/behaviour/Collision.coffee:1:completion | completion | ### Collision Behaviour ###
# TODO: Collision response for non Verlet integrators.
class Collision extends Behaviour
constructor: (@useMass = yes, @callback = null) ->
# Pool of collidable particles.
@pool = []
# Delta between particle positions.
@_delta = new Vector()
... | # Squared distance between particles.
distSq = @_delta.magSq()
# Sum of both radii.
radii = p.radius + o.radius
# Check if particles collide.
if distSq <= radii * radii
# Compute real distance.
dist = Math.sqrt distSq
... | CoffeeScript | CoffeeScript | soulwire/Coffee-Physics | source/behaviour/Collision.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/behaviour/Collision.coffee | 1 | 50 |
soulwire/Coffee-Physics:source/behaviour/Collision.coffee:2:raw_corpus | raw_corpus | p.pos.add (@_delta.clone().norm().scale overlap * -r1)
o.pos.add (@_delta.norm().scale overlap * r2)
# Fire callback if defined.
@callback?(p, o, overlap) | CoffeeScript | soulwire/Coffee-Physics | source/behaviour/Collision.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/behaviour/Collision.coffee | 51 | 55 | ||
soulwire/Coffee-Physics:source/behaviour/Collision.coffee:2:completion | completion | p.pos.add (@_delta.clone().norm().scale overlap * -r1)
o.pos.add (@_delta.norm().scale overlap * r2) | # Fire callback if defined.
@callback?(p, o, overlap) | CoffeeScript | CoffeeScript | soulwire/Coffee-Physics | source/behaviour/Collision.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/behaviour/Collision.coffee | 51 | 55 |
soulwire/Coffee-Physics:source/behaviour/Collision.coffee:1:raw_corpus | raw_corpus | ### Collision Behaviour ###
# TODO: Collision response for non Verlet integrators.
class Collision extends Behaviour
constructor: (@useMass = yes, @callback = null) ->
# Pool of collidable particles.
@pool = []
# Delta between particle positions.
@_delta = new Vector()
... | CoffeeScript | soulwire/Coffee-Physics | source/behaviour/Collision.coffee | MIT | ba14a0098cc4127f93bb414ec069840c461880b8 | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/ba14a0098cc4127f93bb414ec069840c461880b8/source/behaviour/Collision.coffee | 1 | 50 | ||
soulwire/Coffee-Physics:source/behaviour/Collision.coffee:1:completion | completion | ### Collision Behaviour ###
# TODO: Collision response for non Verlet integrators.
class Collision extends Behaviour
constructor: (@useMass = yes, @callback = null) ->
# Pool of collidable particles.
@pool = []
# Delta between particle positions.
@_delta = new Vector()
... | # Squared distance between particles.
distSq = @_delta.magSq()
# Sum of both radii.
radii = p.radius + o.radius
# Check if particles collide.
if distSq <= radii * radii
# Compute real distance.
dist = Math.sqrt distSq
... | CoffeeScript | CoffeeScript | soulwire/Coffee-Physics | source/behaviour/Collision.coffee | MIT | ba14a0098cc4127f93bb414ec069840c461880b8 | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/ba14a0098cc4127f93bb414ec069840c461880b8/source/behaviour/Collision.coffee | 1 | 50 |
soulwire/Coffee-Physics:source/behaviour/Collision.coffee:1:raw_corpus | raw_corpus | ### Collision Behaviour ###
# TODO: Collision response for non Verlet integrators.
class Collision extends Behaviour
constructor: (@useMass = yes, @callback = null) ->
# Pool of collidable particles.
@pool = []
# Delta between particle positions.
@_delta = new Vector()
... | CoffeeScript | soulwire/Coffee-Physics | source/behaviour/Collision.coffee | MIT | c6dd1005d54eb52f41702ef54077f1ee6bbbabd0 | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/c6dd1005d54eb52f41702ef54077f1ee6bbbabd0/source/behaviour/Collision.coffee | 1 | 50 | ||
soulwire/Coffee-Physics:source/behaviour/Collision.coffee:1:completion | completion | ### Collision Behaviour ###
# TODO: Collision response for non Verlet integrators.
class Collision extends Behaviour
constructor: (@useMass = yes, @callback = null) ->
# Pool of collidable particles.
@pool = []
# Delta between particle positions.
@_delta = new Vector()
... | if o isnt p
# Delta between particles positions.
(@_delta.copy o.pos).sub p.pos
# Squared distance between particles.
distSq = @_delta.magSq()
# Sum of both radii.
radii = p.radius + o.radius
# Check if p... | CoffeeScript | CoffeeScript | soulwire/Coffee-Physics | source/behaviour/Collision.coffee | MIT | c6dd1005d54eb52f41702ef54077f1ee6bbbabd0 | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/c6dd1005d54eb52f41702ef54077f1ee6bbbabd0/source/behaviour/Collision.coffee | 1 | 50 |
soulwire/Coffee-Physics:source/behaviour/Collision.coffee:2:raw_corpus | raw_corpus | r1 = if @useMass then o.mass / mt else 0.5
r2 = if @useMass then p.mass / mt else 0.5
# Move particles so they no longer overlap.
p.pos.add (@_delta.clone().norm().scale overlap * -r1)
o.pos.add (@_delta.norm().scale overlap * r2)
... | CoffeeScript | soulwire/Coffee-Physics | source/behaviour/Collision.coffee | MIT | c6dd1005d54eb52f41702ef54077f1ee6bbbabd0 | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/c6dd1005d54eb52f41702ef54077f1ee6bbbabd0/source/behaviour/Collision.coffee | 51 | 59 | ||
soulwire/Coffee-Physics:source/behaviour/Collision.coffee:2:completion | completion | r1 = if @useMass then o.mass / mt else 0.5
r2 = if @useMass then p.mass / mt else 0.5
# Move particles so they no longer overlap. | p.pos.add (@_delta.clone().norm().scale overlap * -r1)
o.pos.add (@_delta.norm().scale overlap * r2)
# Fire callback if defined.
@callback?(p, o, overlap) | CoffeeScript | CoffeeScript | soulwire/Coffee-Physics | source/behaviour/Collision.coffee | MIT | c6dd1005d54eb52f41702ef54077f1ee6bbbabd0 | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/c6dd1005d54eb52f41702ef54077f1ee6bbbabd0/source/behaviour/Collision.coffee | 51 | 59 |
octoblu/meshblu:test/lib/getDeviceIfAuthorized-spec.coffee:1:raw_corpus | raw_corpus | getDeviceIfAuthorized = require '../../lib/getDeviceIfAuthorized'
describe 'getDeviceIfAuthorized', ->
describe 'when called with a device', ->
beforeEach ->
@sut = getDeviceIfAuthorized
@toDevice = {uuid: 'to-device', configureWhitelist: ['from-device']}
@getDevice = sinon.stub().yield... | CoffeeScript | octoblu/meshblu | test/lib/getDeviceIfAuthorized-spec.coffee | MIT | 3c3b617d35de4ce729923fcc3e6028b278bf6e86 | 815 | https://github.com/octoblu/meshblu/blob/3c3b617d35de4ce729923fcc3e6028b278bf6e86/test/lib/getDeviceIfAuthorized-spec.coffee | 1 | 39 | ||
octoblu/meshblu:test/lib/getDeviceIfAuthorized-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
getDeviceIfAuthorized = require '../../lib/getDeviceIfAuthorized'
describe 'getDeviceIfAuthorized', ->
describe 'when called with a device', ->
beforeEach ->
@sut = getDeviceIfAuthorized
@toDevice = {uuid: 'to-device', configureWhitelist: ... | var getDeviceIfAuthorized;
getDeviceIfAuthorized = require('../../lib/getDeviceIfAuthorized');
describe('getDeviceIfAuthorized', function() {
return describe('when called with a device', function() {
beforeEach(function() {
this.sut = getDeviceIfAuthorized;
this.toDevice = {
uuid: 'to-device... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/getDeviceIfAuthorized-spec.coffee | MIT | 3c3b617d35de4ce729923fcc3e6028b278bf6e86 | 815 | https://github.com/octoblu/meshblu/blob/3c3b617d35de4ce729923fcc3e6028b278bf6e86/test/lib/getDeviceIfAuthorized-spec.coffee | 1 | 39 |
octoblu/meshblu:test/lib/getDeviceIfAuthorized-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var getDeviceIfAuthorized;
getDeviceIfAuthorized = require('../../lib/getDeviceIfAuthorized');
describe('getDeviceIfAuthorized', function() {
return describe('when called with a device', function() {
beforeEach(function() {
this.sut = getDeviceIfAutho... | getDeviceIfAuthorized = require '../../lib/getDeviceIfAuthorized'
describe 'getDeviceIfAuthorized', ->
describe 'when called with a device', ->
beforeEach ->
@sut = getDeviceIfAuthorized
@toDevice = {uuid: 'to-device', configureWhitelist: ['from-device']}
@getDevice = sinon.stub().yield... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/getDeviceIfAuthorized-spec.coffee | MIT | 3c3b617d35de4ce729923fcc3e6028b278bf6e86 | 815 | https://github.com/octoblu/meshblu/blob/3c3b617d35de4ce729923fcc3e6028b278bf6e86/test/lib/getDeviceIfAuthorized-spec.coffee | 1 | 39 |
octoblu/meshblu:test/lib/getDeviceIfAuthorized-spec.coffee:1:completion | completion | getDeviceIfAuthorized = require '../../lib/getDeviceIfAuthorized'
describe 'getDeviceIfAuthorized', ->
describe 'when called with a device', ->
beforeEach ->
@sut = getDeviceIfAuthorized
@toDevice = {uuid: 'to-device', configureWhitelist: ['from-device']}
@getDevice = sinon.stub().yield... | describe 'when canDiscover yields an error', ->
beforeEach ->
@canDiscover.yield new Error('unauthorized')
it 'should yield the error', ->
expect(@callback).to.have.been.calledWith new Error
describe 'when canDiscover yields no error and a false', ->
beforeEach ->
@canDis... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/getDeviceIfAuthorized-spec.coffee | MIT | 3c3b617d35de4ce729923fcc3e6028b278bf6e86 | 815 | https://github.com/octoblu/meshblu/blob/3c3b617d35de4ce729923fcc3e6028b278bf6e86/test/lib/getDeviceIfAuthorized-spec.coffee | 1 | 39 |
xhan/qqbot:src/defaults.coffee:1:raw_corpus | raw_corpus | # a place to store user defaults
defaults = {}
fs = require 'fs'
path = 'tmp/store.json'
empty = (obj)->
Object.keys(obj).length == 0
exports.set_path = (newpath)->
path = newpath
exports.data = (key,value)->
read() if empty? defaults
if key and value
defaults[key] = value
else if key
... | CoffeeScript | xhan/qqbot | src/defaults.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/defaults.coffee | 1 | 29 | ||
xhan/qqbot:src/defaults.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# a place to store user defaults
defaults = {}
fs = require 'fs'
path = 'tmp/store.json'
empty = (obj)->
Object.keys(obj).length == 0
exports.set_path = (newpath)->
path = newpath
exports.data = (key,value)->
read() if empty? defaults
if key ... | // a place to store user defaults
var defaults, empty, fs, path, read;
defaults = {};
fs = require('fs');
path = 'tmp/store.json';
empty = function(obj) {
return Object.keys(obj).length === 0;
};
exports.set_path = function(newpath) {
return path = newpath;
};
exports.data = function(key, value) {
if (typeo... | CoffeeScript | JavaScript | xhan/qqbot | src/defaults.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/defaults.coffee | 1 | 29 |
xhan/qqbot:src/defaults.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// a place to store user defaults
var defaults, empty, fs, path, read;
defaults = {};
fs = require('fs');
path = 'tmp/store.json';
empty = function(obj) {
return Object.keys(obj).length === 0;
};
exports.set_path = function(newpath) {
return path = newpath... | # a place to store user defaults
defaults = {}
fs = require 'fs'
path = 'tmp/store.json'
empty = (obj)->
Object.keys(obj).length == 0
exports.set_path = (newpath)->
path = newpath
exports.data = (key,value)->
read() if empty? defaults
if key and value
defaults[key] = value
else if key
... | JavaScript | CoffeeScript | xhan/qqbot | src/defaults.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/defaults.coffee | 1 | 29 |
xhan/qqbot:src/defaults.coffee:1:completion | completion | # a place to store user defaults
defaults = {}
fs = require 'fs'
path = 'tmp/store.json'
empty = (obj)->
Object.keys(obj).length == 0
exports.set_path = (newpath)->
path = newpath
exports.data = (key,value)->
read() if empty? defaults | if key and value
defaults[key] = value
else if key
defaults[key]
else
defaults
exports.save = ->
fs.writeFileSync path , JSON.stringify defaults
read = exports.read = ->
try
defaults = JSON.parse( fs.readFileSync path )
catch error
console.log error | CoffeeScript | CoffeeScript | xhan/qqbot | src/defaults.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/defaults.coffee | 1 | 29 |
xhan/qqbot:src/defaults.coffee:1:raw_corpus | raw_corpus | # a place to store user defaults
defaults = {}
fs = require 'fs'
empty = (obj)->
Object.keys(obj).length == 0
exports.data = (key,value)->
read() if empty? defaults
if key and value
defaults[key] = value
else if key
defaults[key]
else
defaults
exports.save = ->
fs.... | CoffeeScript | xhan/qqbot | src/defaults.coffee | MIT | b71cec3954fa3d40c38a737413dbb2fa5055dc7d | 1,435 | https://github.com/xhan/qqbot/blob/b71cec3954fa3d40c38a737413dbb2fa5055dc7d/src/defaults.coffee | 1 | 25 | ||
xhan/qqbot:src/defaults.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# a place to store user defaults
defaults = {}
fs = require 'fs'
empty = (obj)->
Object.keys(obj).length == 0
exports.data = (key,value)->
read() if empty? defaults
if key and value
defaults[key] = value
else if key
defaults[... | // a place to store user defaults
var defaults, empty, fs, read;
defaults = {};
fs = require('fs');
empty = function(obj) {
return Object.keys(obj).length === 0;
};
exports.data = function(key, value) {
if (typeof empty === "function" ? empty(defaults) : void 0) {
read();
}
if (key && value) {
retur... | CoffeeScript | JavaScript | xhan/qqbot | src/defaults.coffee | MIT | b71cec3954fa3d40c38a737413dbb2fa5055dc7d | 1,435 | https://github.com/xhan/qqbot/blob/b71cec3954fa3d40c38a737413dbb2fa5055dc7d/src/defaults.coffee | 1 | 25 |
xhan/qqbot:src/defaults.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// a place to store user defaults
var defaults, empty, fs, read;
defaults = {};
fs = require('fs');
empty = function(obj) {
return Object.keys(obj).length === 0;
};
exports.data = function(key, value) {
if (typeof empty === "function" ? empty(defaults) : vo... | # a place to store user defaults
defaults = {}
fs = require 'fs'
empty = (obj)->
Object.keys(obj).length == 0
exports.data = (key,value)->
read() if empty? defaults
if key and value
defaults[key] = value
else if key
defaults[key]
else
defaults
exports.save = ->
fs.... | JavaScript | CoffeeScript | xhan/qqbot | src/defaults.coffee | MIT | b71cec3954fa3d40c38a737413dbb2fa5055dc7d | 1,435 | https://github.com/xhan/qqbot/blob/b71cec3954fa3d40c38a737413dbb2fa5055dc7d/src/defaults.coffee | 1 | 25 |
xhan/qqbot:src/defaults.coffee:1:completion | completion | # a place to store user defaults
defaults = {}
fs = require 'fs'
empty = (obj)->
Object.keys(obj).length == 0
exports.data = (key,value)->
read() if empty? defaults
if key and value
defaults[key] = value | else if key
defaults[key]
else
defaults
exports.save = ->
fs.writeFileSync 'tmp/store.json' , JSON.stringify defaults
read = exports.read = ->
try
defaults = JSON.parse( fs.readFileSync 'tmp/store.json' )
catch error
console.log error | CoffeeScript | CoffeeScript | xhan/qqbot | src/defaults.coffee | MIT | b71cec3954fa3d40c38a737413dbb2fa5055dc7d | 1,435 | https://github.com/xhan/qqbot/blob/b71cec3954fa3d40c38a737413dbb2fa5055dc7d/src/defaults.coffee | 1 | 25 |
oozcitak/xmlbuilder-js:test/issues/249.coffee:1:raw_corpus | raw_corpus | path = require('path')
fs = require('fs')
suite 'Tests specific to issues:', ->
test 'Issue #249: separateArrayItems ', ->
obj = p:
"@someattr": "something"
'#text': [
{ span: { "@someattr2": "something2", "#text": "line1" } }
{ br: "" }
{ span: { "@someattr2": "something2", ... | CoffeeScript | oozcitak/xmlbuilder-js | test/issues/249.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/issues/249.coffee | 1 | 26 | ||
oozcitak/xmlbuilder-js:test/issues/249.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
path = require('path')
fs = require('fs')
suite 'Tests specific to issues:', ->
test 'Issue #249: separateArrayItems ', ->
obj = p:
"@someattr": "something"
'#text': [
{ span: { "@someattr2": "something2", "#text": "line1" } }
... | var fs, path;
path = require('path');
fs = require('fs');
suite('Tests specific to issues:', function() {
return test('Issue #249: separateArrayItems ', function() {
var doc, obj;
obj = {
p: {
"@someattr": "something",
'#text': [
{
span: {
"@someatt... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | test/issues/249.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/issues/249.coffee | 1 | 26 |
oozcitak/xmlbuilder-js:test/issues/249.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var fs, path;
path = require('path');
fs = require('fs');
suite('Tests specific to issues:', function() {
return test('Issue #249: separateArrayItems ', function() {
var doc, obj;
obj = {
p: {
"@someattr": "something",
'#text': [
... | path = require('path')
fs = require('fs')
suite 'Tests specific to issues:', ->
test 'Issue #249: separateArrayItems ', ->
obj = p:
"@someattr": "something"
'#text': [
{ span: { "@someattr2": "something2", "#text": "line1" } }
{ br: "" }
{ span: { "@someattr2": "something2", ... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | test/issues/249.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/issues/249.coffee | 1 | 26 |
oozcitak/xmlbuilder-js:test/issues/249.coffee:1:completion | completion | path = require('path')
fs = require('fs')
suite 'Tests specific to issues:', ->
test 'Issue #249: separateArrayItems ', ->
obj = p:
"@someattr": "something"
'#text': [
{ span: { "@someattr2": "something2", "#text": "line1" } }
{ br: "" }
{ span: { "@someattr2": "something2", ... | doc = xml(obj, { headless: true })
eq(
doc.end({ pretty: true })
"""
<p someattr="something">
<span someattr2="something2">line1</span>
<br/>
<span someattr2="something2">line2</span>
</p>
"""
) | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | test/issues/249.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/issues/249.coffee | 1 | 26 |
jianliaoim/talk-os:talk-web/client/actions/topic-prefs.coffee:1:raw_corpus | raw_corpus | dispatcher = require '../dispatcher'
lang = require '../locales/lang'
notifyActions = require '../actions/notify'
api = require '../network/api'
exports.update = (_roomId, data, success, fail) ->
config =
pathParams:
id: _roomId
data: data
api.rooms.prefs.put(config)
.then (resp) ->
dispat... | CoffeeScript | jianliaoim/talk-os | talk-web/client/actions/topic-prefs.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/topic-prefs.coffee | 1 | 19 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.