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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/switch.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
switch day
when "Mon" then go_to_work()
when "Tue" then go_to_the_park()
when "Thu" then go_ice_fishing()
when "Fri", "Sat"
if day is bingo_day
go_to_bingo()
go_dancing()
when "Sun" then go_to_church()
else go_to_work()
``` | switch (day) {
case "Mon":
go_to_work();
break;
case "Tue":
go_to_the_park();
break;
case "Thu":
go_ice_fishing();
break;
case "Fri":
case "Sat":
if (day === bingo_day) {
go_to_bingo();
go_dancing();
}
break;
case "Sun":
go_to_church();
break;
defaul... | CoffeeScript | JavaScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/documentation/coffee/switch.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/switch.coffee | 1 | 10 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/switch.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
switch (day) {
case "Mon":
go_to_work();
break;
case "Tue":
go_to_the_park();
break;
case "Thu":
go_ice_fishing();
break;
case "Fri":
case "Sat":
if (day === bingo_day) {
go_to_bingo();
go_dancing();
}
break... | switch day
when "Mon" then go_to_work()
when "Tue" then go_to_the_park()
when "Thu" then go_ice_fishing()
when "Fri", "Sat"
if day is bingo_day
go_to_bingo()
go_dancing()
when "Sun" then go_to_church()
else go_to_work() | JavaScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/documentation/coffee/switch.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/switch.coffee | 1 | 10 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/switch.coffee:1:completion | completion | switch day
when "Mon" then go_to_work()
when "Tue" then go_to_the_park()
when "Thu" then go_ice_fishing()
when "Fri", "Sat" | if day is bingo_day
go_to_bingo()
go_dancing()
when "Sun" then go_to_church()
else go_to_work() | CoffeeScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/documentation/coffee/switch.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/switch.coffee | 1 | 10 |
jianliaoim/talk-os:talk-account/server/apis/mixins/auth.coffee:1:raw_corpus | raw_corpus | Err = require 'err1st'
Promise = require 'bluebird'
limbo = require 'limbo'
{
UserModel
MobileModel
EmailModel
UnionModel
} = limbo.use 'account'
module.exports = authMixin =
###*
* 验证 accountToken 并查找用户信息
* @return {Model} user
###
verifyAccount: (req, res, callback) ->
if req.headers?.author... | CoffeeScript | jianliaoim/talk-os | talk-account/server/apis/mixins/auth.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/apis/mixins/auth.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-account/server/apis/mixins/auth.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Err = require 'err1st'
Promise = require 'bluebird'
limbo = require 'limbo'
{
UserModel
MobileModel
EmailModel
UnionModel
} = limbo.use 'account'
module.exports = authMixin =
###*
* 验证 accountToken 并查找用户信息
* @return {Model} user
###
verifyAc... | var EmailModel, Err, MobileModel, Promise, UnionModel, UserModel, authMixin, limbo;
Err = require('err1st');
Promise = require('bluebird');
limbo = require('limbo');
({UserModel, MobileModel, EmailModel, UnionModel} = limbo.use('account'));
module.exports = authMixin = {
/**
* 验证 accountToken 并查找用户信息
* @re... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/server/apis/mixins/auth.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/apis/mixins/auth.coffee | 1 | 50 |
jianliaoim/talk-os:talk-account/server/apis/mixins/auth.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var EmailModel, Err, MobileModel, Promise, UnionModel, UserModel, authMixin, limbo;
Err = require('err1st');
Promise = require('bluebird');
limbo = require('limbo');
({UserModel, MobileModel, EmailModel, UnionModel} = limbo.use('account'));
module.exports = au... | Err = require 'err1st'
Promise = require 'bluebird'
limbo = require 'limbo'
{
UserModel
MobileModel
EmailModel
UnionModel
} = limbo.use 'account'
module.exports = authMixin =
###*
* 验证 accountToken 并查找用户信息
* @return {Model} user
###
verifyAccount: (req, res, callback) ->
if req.headers?.author... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/apis/mixins/auth.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/apis/mixins/auth.coffee | 1 | 50 |
jianliaoim/talk-os:talk-account/server/apis/mixins/auth.coffee:1:completion | completion | Err = require 'err1st'
Promise = require 'bluebird'
limbo = require 'limbo'
{
UserModel
MobileModel
EmailModel
UnionModel
} = limbo.use 'account'
module.exports = authMixin =
###*
* 验证 accountToken 并查找用户信息
* @return {Model} user
###
verifyAccount: (req, res, callback) ->
if req.headers?.author... | * @return {Model} user
###
appendUserDetail: (req, res, callback) ->
{user} = req.get()
$mobile = MobileModel.findOneAsync user: user._id
$email = EmailModel.findOneAsync user: user._id
$unions = UnionModel.findAsync user: user._id
$user = Promise.all [$mobile, $email, $unions]
.spread (mo... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/apis/mixins/auth.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/apis/mixins/auth.coffee | 1 | 50 |
jianliaoim/talk-os:talk-account/server/apis/mixins/auth.coffee:2:raw_corpus | raw_corpus | setTimeout ->
callback()
, 1000 | CoffeeScript | jianliaoim/talk-os | talk-account/server/apis/mixins/auth.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/apis/mixins/auth.coffee | 51 | 53 | ||
jianliaoim/talk-os:talk-account/server/apis/mixins/auth.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
setTimeout ->
callback()
, 1000
``` | setTimeout(function() {
return callback();
}, 1000); | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/server/apis/mixins/auth.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/apis/mixins/auth.coffee | 51 | 53 |
jianliaoim/talk-os:talk-account/server/apis/mixins/auth.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
setTimeout(function() {
return callback();
}, 1000);
``` | setTimeout ->
callback()
, 1000 | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/apis/mixins/auth.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/apis/mixins/auth.coffee | 51 | 53 |
oozcitak/xmlbuilder-js:test/basic/primitives.coffee:1:raw_corpus | raw_corpus | suite 'Implicit Conversion to Primitives:', ->
test 'String', ->
eq(
xml('test', {}, {}, { headless: true })
.ele('node', 'hello')
.nod('node', 'hello')
.ins('node', 'hello')
.end()
xml('test', {}, {}, { headless: true })
.ele('node', new String('hello'))
... | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/primitives.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/primitives.coffee | 1 | 34 | ||
oozcitak/xmlbuilder-js:test/basic/primitives.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
suite 'Implicit Conversion to Primitives:', ->
test 'String', ->
eq(
xml('test', {}, {}, { headless: true })
.ele('node', 'hello')
.nod('node', 'hello')
.ins('node', 'hello')
.end()
xml('test', {}, {}, { headless:... | suite('Implicit Conversion to Primitives:', function() {
test('String', function() {
return eq(xml('test', {}, {}, {
headless: true
}).ele('node', 'hello').nod('node', 'hello').ins('node', 'hello').end(), xml('test', {}, {}, {
headless: true
}).ele('node', new String('hello')).nod('node', new ... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | test/basic/primitives.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/primitives.coffee | 1 | 34 |
oozcitak/xmlbuilder-js:test/basic/primitives.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
suite('Implicit Conversion to Primitives:', function() {
test('String', function() {
return eq(xml('test', {}, {}, {
headless: true
}).ele('node', 'hello').nod('node', 'hello').ins('node', 'hello').end(), xml('test', {}, {}, {
headless: true
... | suite 'Implicit Conversion to Primitives:', ->
test 'String', ->
eq(
xml('test', {}, {}, { headless: true })
.ele('node', 'hello')
.nod('node', 'hello')
.ins('node', 'hello')
.end()
xml('test', {}, {}, { headless: true })
.ele('node', new String('hello'))
... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/primitives.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/primitives.coffee | 1 | 34 |
oozcitak/xmlbuilder-js:test/basic/primitives.coffee:1:completion | completion | suite 'Implicit Conversion to Primitives:', ->
test 'String', ->
eq(
xml('test', {}, {}, { headless: true })
.ele('node', 'hello')
.nod('node', 'hello')
.ins('node', 'hello')
.end()
xml('test', {}, {}, { headless: true })
.ele('node', new String('hello'))
... | xml('test', {}, {}, { headless: true })
.ele('node', true)
.end()
xml('test', {}, {}, { headless: true })
.ele('node', new Boolean(true))
.end()
)
test 'Number', ->
eq(
xml('test', {}, {}, { headless: true })
.ele('node', 123)
.end()
xml('test... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/primitives.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/primitives.coffee | 1 | 34 |
kahmali/meteor-restivus:test/route_unit_tests.coffee:1:raw_corpus | raw_corpus | describe 'A route', =>
Api = new Restivus
it 'can be constructed with options', (test) =>
route = new share.Route Api, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},
get: -> 'GET test-route-1'
test.equal route.path, 'test-route-1'
test.isTrue route.options.authRequired
... | CoffeeScript | kahmali/meteor-restivus | test/route_unit_tests.coffee | MIT | b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb | 541 | https://github.com/kahmali/meteor-restivus/blob/b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb/test/route_unit_tests.coffee | 1 | 43 | ||
kahmali/meteor-restivus:test/route_unit_tests.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'A route', =>
Api = new Restivus
it 'can be constructed with options', (test) =>
route = new share.Route Api, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},
get: -> 'GET test-route-1'
test.equal route.path, 'tes... | describe('A route', () => {
var Api;
Api = new Restivus();
it('can be constructed with options', (test) => {
var route;
route = new share.Route(Api, 'test-route-1', {
authRequired: true,
roleRequired: ['admin', 'dev']
}, {
get: function() {
return 'GET test-route-1';
}
... | CoffeeScript | JavaScript | kahmali/meteor-restivus | test/route_unit_tests.coffee | MIT | b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb | 541 | https://github.com/kahmali/meteor-restivus/blob/b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb/test/route_unit_tests.coffee | 1 | 43 |
kahmali/meteor-restivus:test/route_unit_tests.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('A route', () => {
var Api;
Api = new Restivus();
it('can be constructed with options', (test) => {
var route;
route = new share.Route(Api, 'test-route-1', {
authRequired: true,
roleRequired: ['admin', 'dev']
}, {
get: f... | describe 'A route', =>
Api = new Restivus
it 'can be constructed with options', (test) =>
route = new share.Route Api, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},
get: -> 'GET test-route-1'
test.equal route.path, 'test-route-1'
test.isTrue route.options.authRequired
... | JavaScript | CoffeeScript | kahmali/meteor-restivus | test/route_unit_tests.coffee | MIT | b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb | 541 | https://github.com/kahmali/meteor-restivus/blob/b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb/test/route_unit_tests.coffee | 1 | 43 |
kahmali/meteor-restivus:test/route_unit_tests.coffee:1:completion | completion | describe 'A route', =>
Api = new Restivus
it 'can be constructed with options', (test) =>
route = new share.Route Api, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},
get: -> 'GET test-route-1'
test.equal route.path, 'test-route-1'
test.isTrue route.options.authRequired
... | route = new share.Route Api, 'test-route-3',
get: -> 'GET test-route-2'
post: -> 'POST test-route-2'
put: -> 'PUT test-route-2'
patch: -> 'PATCH test-route-2'
delete: -> 'DELETE test-route-2'
options: -> 'OPTIONS test-route-2'
test.equal route.endpoints.get(), 'GET test-route-2'... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/route_unit_tests.coffee | MIT | b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb | 541 | https://github.com/kahmali/meteor-restivus/blob/b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb/test/route_unit_tests.coffee | 1 | 43 |
kahmali/meteor-restivus:test/route_unit_tests.coffee:1:raw_corpus | raw_corpus | describe 'A route', =>
Api = new Restivus
it 'can be constructed with options', (test) =>
route = new @Route Api, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},
get: -> 'GET test-route-1'
test.equal route.path, 'test-route-1'
test.isTrue route.options.authRequired
test... | CoffeeScript | kahmali/meteor-restivus | test/route_unit_tests.coffee | MIT | a95178c9c3f6c87ff65729d9f491dd4ca2132a20 | 541 | https://github.com/kahmali/meteor-restivus/blob/a95178c9c3f6c87ff65729d9f491dd4ca2132a20/test/route_unit_tests.coffee | 1 | 43 | ||
kahmali/meteor-restivus:test/route_unit_tests.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'A route', =>
Api = new Restivus
it 'can be constructed with options', (test) =>
route = new @Route Api, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},
get: -> 'GET test-route-1'
test.equal route.path, 'test-rou... | describe('A route', () => {
var Api;
Api = new Restivus();
it('can be constructed with options', (test) => {
var route;
route = new this.Route(Api, 'test-route-1', {
authRequired: true,
roleRequired: ['admin', 'dev']
}, {
get: function() {
return 'GET test-route-1';
}
... | CoffeeScript | JavaScript | kahmali/meteor-restivus | test/route_unit_tests.coffee | MIT | a95178c9c3f6c87ff65729d9f491dd4ca2132a20 | 541 | https://github.com/kahmali/meteor-restivus/blob/a95178c9c3f6c87ff65729d9f491dd4ca2132a20/test/route_unit_tests.coffee | 1 | 43 |
kahmali/meteor-restivus:test/route_unit_tests.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('A route', () => {
var Api;
Api = new Restivus();
it('can be constructed with options', (test) => {
var route;
route = new this.Route(Api, 'test-route-1', {
authRequired: true,
roleRequired: ['admin', 'dev']
}, {
get: fu... | describe 'A route', =>
Api = new Restivus
it 'can be constructed with options', (test) =>
route = new @Route Api, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},
get: -> 'GET test-route-1'
test.equal route.path, 'test-route-1'
test.isTrue route.options.authRequired
test... | JavaScript | CoffeeScript | kahmali/meteor-restivus | test/route_unit_tests.coffee | MIT | a95178c9c3f6c87ff65729d9f491dd4ca2132a20 | 541 | https://github.com/kahmali/meteor-restivus/blob/a95178c9c3f6c87ff65729d9f491dd4ca2132a20/test/route_unit_tests.coffee | 1 | 43 |
kahmali/meteor-restivus:test/route_unit_tests.coffee:1:completion | completion | describe 'A route', =>
Api = new Restivus
it 'can be constructed with options', (test) =>
route = new @Route Api, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},
get: -> 'GET test-route-1'
test.equal route.path, 'test-route-1'
test.isTrue route.options.authRequired
test... | route = new @Route Api, 'test-route-3',
get: -> 'GET test-route-2'
post: -> 'POST test-route-2'
put: -> 'PUT test-route-2'
patch: -> 'PATCH test-route-2'
delete: -> 'DELETE test-route-2'
options: -> 'OPTIONS test-route-2'
test.equal route.endpoints.get(), 'GET test-route-2'
... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/route_unit_tests.coffee | MIT | a95178c9c3f6c87ff65729d9f491dd4ca2132a20 | 541 | https://github.com/kahmali/meteor-restivus/blob/a95178c9c3f6c87ff65729d9f491dd4ca2132a20/test/route_unit_tests.coffee | 1 | 43 |
kahmali/meteor-restivus:test/route_unit_tests.coffee:1:raw_corpus | raw_corpus | describe 'A route', =>
it 'can be constructed with options', (test) =>
route = new @Route new @Restivus, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},
get: -> 'GET test-route-1'
test.equal route.path, 'test-route-1'
test.isTrue route.options.authRequired
test.isTrue _.c... | CoffeeScript | kahmali/meteor-restivus | test/route_unit_tests.coffee | MIT | fb35e931dfbc59851480ce4d66d6ae348b2e3f18 | 541 | https://github.com/kahmali/meteor-restivus/blob/fb35e931dfbc59851480ce4d66d6ae348b2e3f18/test/route_unit_tests.coffee | 1 | 42 | ||
kahmali/meteor-restivus:test/route_unit_tests.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'A route', =>
it 'can be constructed with options', (test) =>
route = new @Route new @Restivus, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},
get: -> 'GET test-route-1'
test.equal route.path, 'test-route-1'
t... | describe('A route', () => {
it('can be constructed with options', (test) => {
var route;
route = new this.Route(new this.Restivus(), 'test-route-1', {
authRequired: true,
roleRequired: ['admin', 'dev']
}, {
get: function() {
return 'GET test-route-1';
}
});
test.equ... | CoffeeScript | JavaScript | kahmali/meteor-restivus | test/route_unit_tests.coffee | MIT | fb35e931dfbc59851480ce4d66d6ae348b2e3f18 | 541 | https://github.com/kahmali/meteor-restivus/blob/fb35e931dfbc59851480ce4d66d6ae348b2e3f18/test/route_unit_tests.coffee | 1 | 42 |
kahmali/meteor-restivus:test/route_unit_tests.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('A route', () => {
it('can be constructed with options', (test) => {
var route;
route = new this.Route(new this.Restivus(), 'test-route-1', {
authRequired: true,
roleRequired: ['admin', 'dev']
}, {
get: function() {
... | describe 'A route', =>
it 'can be constructed with options', (test) =>
route = new @Route new @Restivus, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},
get: -> 'GET test-route-1'
test.equal route.path, 'test-route-1'
test.isTrue route.options.authRequired
test.isTrue _.c... | JavaScript | CoffeeScript | kahmali/meteor-restivus | test/route_unit_tests.coffee | MIT | fb35e931dfbc59851480ce4d66d6ae348b2e3f18 | 541 | https://github.com/kahmali/meteor-restivus/blob/fb35e931dfbc59851480ce4d66d6ae348b2e3f18/test/route_unit_tests.coffee | 1 | 42 |
kahmali/meteor-restivus:test/route_unit_tests.coffee:1:completion | completion | describe 'A route', =>
it 'can be constructed with options', (test) =>
route = new @Route new @Restivus, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},
get: -> 'GET test-route-1'
test.equal route.path, 'test-route-1'
test.isTrue route.options.authRequired
test.isTrue _.c... | get: -> 'GET test-route-2'
post: -> 'POST test-route-2'
put: -> 'PUT test-route-2'
patch: -> 'PATCH test-route-2'
delete: -> 'DELETE test-route-2'
options: -> 'OPTIONS test-route-2'
test.equal route.endpoints.get(), 'GET test-route-2'
test.equal route.endpoints.post(), 'POST test-... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/route_unit_tests.coffee | MIT | fb35e931dfbc59851480ce4d66d6ae348b2e3f18 | 541 | https://github.com/kahmali/meteor-restivus/blob/fb35e931dfbc59851480ce4d66d6ae348b2e3f18/test/route_unit_tests.coffee | 1 | 42 |
gterrono/houston:client/partials/admin_nav.coffee:1:raw_corpus | raw_corpus | # Top Nav
Template._houston_navbar.events
'click #houston-logout': (e) ->
e.preventDefault()
Meteor.logout()
Template._houston_navbar.helpers
'bugreport_url': ->
message = encodeURIComponent """
To make sure we can help you quickly, please include the version of Houston
you are using, steps to replicat... | CoffeeScript | gterrono/houston | client/partials/admin_nav.coffee | MIT | 581357048f3577f0487ed598e26eaf063c813183 | 802 | https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/client/partials/admin_nav.coffee | 1 | 26 | ||
gterrono/houston:client/partials/admin_nav.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Top Nav
Template._houston_navbar.events
'click #houston-logout': (e) ->
e.preventDefault()
Meteor.logout()
Template._houston_navbar.helpers
'bugreport_url': ->
message = encodeURIComponent """
To make sure we can help you quickly, please includ... | // Top Nav
Template._houston_navbar.events({
'click #houston-logout': function(e) {
e.preventDefault();
return Meteor.logout();
}
});
Template._houston_navbar.helpers({
'bugreport_url': function() {
var message;
message = encodeURIComponent(`To make sure we can help you quickly, please include th... | CoffeeScript | JavaScript | gterrono/houston | client/partials/admin_nav.coffee | MIT | 581357048f3577f0487ed598e26eaf063c813183 | 802 | https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/client/partials/admin_nav.coffee | 1 | 26 |
gterrono/houston:client/partials/admin_nav.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Top Nav
Template._houston_navbar.events({
'click #houston-logout': function(e) {
e.preventDefault();
return Meteor.logout();
}
});
Template._houston_navbar.helpers({
'bugreport_url': function() {
var message;
message = encodeURIComponent(`... | # Top Nav
Template._houston_navbar.events
'click #houston-logout': (e) ->
e.preventDefault()
Meteor.logout()
Template._houston_navbar.helpers
'bugreport_url': ->
message = encodeURIComponent """
To make sure we can help you quickly, please include the version of Houston
you are using, steps to replicat... | JavaScript | CoffeeScript | gterrono/houston | client/partials/admin_nav.coffee | MIT | 581357048f3577f0487ed598e26eaf063c813183 | 802 | https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/client/partials/admin_nav.coffee | 1 | 26 |
gterrono/houston:client/partials/admin_nav.coffee:1:completion | completion | # Top Nav
Template._houston_navbar.events
'click #houston-logout': (e) ->
e.preventDefault()
Meteor.logout()
Template._houston_navbar.helpers
'bugreport_url': ->
message = encodeURIComponent """
To make sure we can help you quickly, please include the version of Houston
you are using, steps to replicat... | Thanks!
"""
"https://github.com/gterrono/houston/issues/new?body=#{message}"
'menu_items': ->
return Houston.menu._get_menu_items()
'isActive' : -> 'active' if Router.current()?.path == @path
# Side Nav
Template._houston_sidenav.helpers
collections: ->
Houston._collections.collections.find().fetch()
... | CoffeeScript | CoffeeScript | gterrono/houston | client/partials/admin_nav.coffee | MIT | 581357048f3577f0487ed598e26eaf063c813183 | 802 | https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/client/partials/admin_nav.coffee | 1 | 26 |
cdglabs/apparatus:src/viewer.coffee:2:raw_corpus | raw_corpus | window.ApparatusViewer = class ApparatusViewer
constructor: (@options) ->
# TODO: Add selection of which element to view?
@_getElement()
@_getProjectAndLoad()
# Returns an object representing the attribute node with label `label`,
# provided this label is unique. The object returned is an
# `Appara... | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 1a881c2587d95023eb83254f35df0c1ff70ba6db | 1,052 | https://github.com/cdglabs/apparatus/blob/1a881c2587d95023eb83254f35df0c1ff70ba6db/src/viewer.coffee | 48 | 88 | ||
cdglabs/apparatus:src/viewer.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
window.ApparatusViewer = class ApparatusViewer
constructor: (@options) ->
# TODO: Add selection of which element to view?
@_getElement()
@_getProjectAndLoad()
# Returns an object representing the attribute node with label `label`,
# provided th... | var ApparatusViewer;
window.ApparatusViewer = ApparatusViewer = class ApparatusViewer {
constructor(options) {
this.options = options;
// TODO: Add selection of which element to view?
this._getElement();
this._getProjectAndLoad();
}
// Returns an object representing the attribute node with label... | CoffeeScript | JavaScript | cdglabs/apparatus | src/viewer.coffee | MIT | 1a881c2587d95023eb83254f35df0c1ff70ba6db | 1,052 | https://github.com/cdglabs/apparatus/blob/1a881c2587d95023eb83254f35df0c1ff70ba6db/src/viewer.coffee | 48 | 88 |
cdglabs/apparatus:src/viewer.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ApparatusViewer;
window.ApparatusViewer = ApparatusViewer = class ApparatusViewer {
constructor(options) {
this.options = options;
// TODO: Add selection of which element to view?
this._getElement();
this._getProjectAndLoad();
}
// Retur... | window.ApparatusViewer = class ApparatusViewer
constructor: (@options) ->
# TODO: Add selection of which element to view?
@_getElement()
@_getProjectAndLoad()
# Returns an object representing the attribute node with label `label`,
# provided this label is unique. The object returned is an
# `Appara... | JavaScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 1a881c2587d95023eb83254f35df0c1ff70ba6db | 1,052 | https://github.com/cdglabs/apparatus/blob/1a881c2587d95023eb83254f35df0c1ff70ba6db/src/viewer.coffee | 48 | 88 |
cdglabs/apparatus:src/viewer.coffee:2:completion | completion | window.ApparatusViewer = class ApparatusViewer
constructor: (@options) ->
# TODO: Add selection of which element to view?
@_getElement()
@_getProjectAndLoad()
# Returns an object representing the attribute node with label `label`,
# provided this label is unique. The object returned is an
# `Appara... | if attribute
foundMultiple = true
attribute = node
nodeVisitor.visit(@_project.editingElement)
nodeVisitor.finish()
if not foundSome
throw "Found no attributes with label #{label}"
if foundMultiple
throw "Found multiple attributes with label #{label}"
return new At... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 1a881c2587d95023eb83254f35df0c1ff70ba6db | 1,052 | https://github.com/cdglabs/apparatus/blob/1a881c2587d95023eb83254f35df0c1ff70ba6db/src/viewer.coffee | 48 | 88 |
cdglabs/apparatus:src/viewer.coffee:3:raw_corpus | raw_corpus | if @options.element?
@_element = @options.element
else if @options.selector?
@_element = document.querySelector(@options.selector)
else
throw "Either `element` or `selector` must be provided as an option"
_getProjectAndLoad: ->
if @options.projectData and @options.url
throw "Do no... | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 1a881c2587d95023eb83254f35df0c1ff70ba6db | 1,052 | https://github.com/cdglabs/apparatus/blob/1a881c2587d95023eb83254f35df0c1ff70ba6db/src/viewer.coffee | 90 | 128 | ||
cdglabs/apparatus:src/viewer.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if @options.element?
@_element = @options.element
else if @options.selector?
@_element = document.querySelector(@options.selector)
else
throw "Either `element` or `selector` must be provided as an option"
_getProjectAndLoad: ->
if... | if (this.options.element != null) {
this._element = this.options.element;
} else if (this.options.selector != null) {
this._element = document.querySelector(this.options.selector);
} else {
throw "Either `element` or `selector` must be provided as an option";
}
({
_getProjectAndLoad: function() {
var xhr;
... | CoffeeScript | JavaScript | cdglabs/apparatus | src/viewer.coffee | MIT | 1a881c2587d95023eb83254f35df0c1ff70ba6db | 1,052 | https://github.com/cdglabs/apparatus/blob/1a881c2587d95023eb83254f35df0c1ff70ba6db/src/viewer.coffee | 90 | 128 |
cdglabs/apparatus:src/viewer.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
if (this.options.element != null) {
this._element = this.options.element;
} else if (this.options.selector != null) {
this._element = document.querySelector(this.options.selector);
} else {
throw "Either `element` or `selector` must be provided as an option";... | if @options.element?
@_element = @options.element
else if @options.selector?
@_element = document.querySelector(@options.selector)
else
throw "Either `element` or `selector` must be provided as an option"
_getProjectAndLoad: ->
if @options.projectData and @options.url
throw "Do no... | JavaScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 1a881c2587d95023eb83254f35df0c1ff70ba6db | 1,052 | https://github.com/cdglabs/apparatus/blob/1a881c2587d95023eb83254f35df0c1ff70ba6db/src/viewer.coffee | 90 | 128 |
cdglabs/apparatus:src/viewer.coffee:3:completion | completion | if @options.element?
@_element = @options.element
else if @options.selector?
@_element = document.querySelector(@options.selector)
else
throw "Either `element` or `selector` must be provided as an option"
_getProjectAndLoad: ->
if @options.projectData and @options.url
throw "Do no... | @_projectData = JSON.parse(xhr.responseText)
@_deserializeProjectData()
@_load()
xhr.open("GET", @options.url)
xhr.send()
else
throw "Either `projectData` or `url` must be provided as an option"
_load: ->
# Now we can actually load the diagram!
# Use regionOfInteres... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 1a881c2587d95023eb83254f35df0c1ff70ba6db | 1,052 | https://github.com/cdglabs/apparatus/blob/1a881c2587d95023eb83254f35df0c1ff70ba6db/src/viewer.coffee | 90 | 128 |
cdglabs/apparatus:src/viewer.coffee:4:raw_corpus | raw_corpus | refreshEventNames = [
"mousedown"
"mousemove"
"mouseup"
]
@willRefreshNextFrame = false
for eventName in refreshEventNames
@_element.addEventListener(eventName, => @_refresh())
_deserializeProjectData: ->
serializer = Model.SerializerWithBuiltIns.getSerializer()
@_project... | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 1a881c2587d95023eb83254f35df0c1ff70ba6db | 1,052 | https://github.com/cdglabs/apparatus/blob/1a881c2587d95023eb83254f35df0c1ff70ba6db/src/viewer.coffee | 130 | 168 | ||
cdglabs/apparatus:src/viewer.coffee:4:completion | completion | refreshEventNames = [
"mousedown"
"mousemove"
"mouseup"
]
@willRefreshNextFrame = false
for eventName in refreshEventNames
@_element.addEventListener(eventName, => @_refresh())
_deserializeProjectData: ->
serializer = Model.SerializerWithBuiltIns.getSerializer()
@_project... | _refresh: ->
return if @willRefreshNextFrame
@willRefreshNextFrame = true
requestAnimationFrame =>
@_render()
@willRefreshNextFrame = false
ApparatusViewer.Attribute = class Attribute
constructor: (@_attribute, @_viewer) ->
# Returns the current value of the attribute.
value: ->
@_a... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 1a881c2587d95023eb83254f35df0c1ff70ba6db | 1,052 | https://github.com/cdglabs/apparatus/blob/1a881c2587d95023eb83254f35df0c1ff70ba6db/src/viewer.coffee | 130 | 168 |
cdglabs/apparatus:src/viewer.coffee:5:raw_corpus | raw_corpus | # ADVANCED USAGE: Returns a reference to the internal `Attribute` node
# represented by this object. You can read and write to this object, but
# beware: its representation and behavior are subject to change.
raw: ->
@_attribute | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 1a881c2587d95023eb83254f35df0c1ff70ba6db | 1,052 | https://github.com/cdglabs/apparatus/blob/1a881c2587d95023eb83254f35df0c1ff70ba6db/src/viewer.coffee | 170 | 174 | ||
cdglabs/apparatus:src/viewer.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# ADVANCED USAGE: Returns a reference to the internal `Attribute` node
# represented by this object. You can read and write to this object, but
# beware: its representation and behavior are subject to change.
raw: ->
@_attribute
``` | // ADVANCED USAGE: Returns a reference to the internal `Attribute` node
// represented by this object. You can read and write to this object, but
// beware: its representation and behavior are subject to change.
({
raw: function() {
return this._attribute;
}
}); | CoffeeScript | JavaScript | cdglabs/apparatus | src/viewer.coffee | MIT | 1a881c2587d95023eb83254f35df0c1ff70ba6db | 1,052 | https://github.com/cdglabs/apparatus/blob/1a881c2587d95023eb83254f35df0c1ff70ba6db/src/viewer.coffee | 170 | 174 |
cdglabs/apparatus:src/viewer.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// ADVANCED USAGE: Returns a reference to the internal `Attribute` node
// represented by this object. You can read and write to this object, but
// beware: its representation and behavior are subject to change.
({
raw: function() {
return this._attribute;
... | # ADVANCED USAGE: Returns a reference to the internal `Attribute` node
# represented by this object. You can read and write to this object, but
# beware: its representation and behavior are subject to change.
raw: ->
@_attribute | JavaScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 1a881c2587d95023eb83254f35df0c1ff70ba6db | 1,052 | https://github.com/cdglabs/apparatus/blob/1a881c2587d95023eb83254f35df0c1ff70ba6db/src/viewer.coffee | 170 | 174 |
cdglabs/apparatus:src/viewer.coffee:5:completion | completion | # ADVANCED USAGE: Returns a reference to the internal `Attribute` node
# represented by this object. You can read and write to this object, but | # beware: its representation and behavior are subject to change.
raw: ->
@_attribute | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 1a881c2587d95023eb83254f35df0c1ff70ba6db | 1,052 | https://github.com/cdglabs/apparatus/blob/1a881c2587d95023eb83254f35df0c1ff70ba6db/src/viewer.coffee | 170 | 174 |
cdglabs/apparatus:src/viewer.coffee:3:raw_corpus | raw_corpus | if @options.element?
@_element = @options.element
else if @options.selector?
@_element = document.querySelector(@options.selector)
else
throw "Either `element` or `selector` must be provided as an option"
_getProjectAndLoad: ->
if @options.projectData and @options.url
throw "Do no... | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | bab26b55d8f8e722203ecd647fdf3daa30e05a8e | 1,052 | https://github.com/cdglabs/apparatus/blob/bab26b55d8f8e722203ecd647fdf3daa30e05a8e/src/viewer.coffee | 87 | 129 | ||
cdglabs/apparatus:src/viewer.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if @options.element?
@_element = @options.element
else if @options.selector?
@_element = document.querySelector(@options.selector)
else
throw "Either `element` or `selector` must be provided as an option"
_getProjectAndLoad: ->
if... | if (this.options.element != null) {
this._element = this.options.element;
} else if (this.options.selector != null) {
this._element = document.querySelector(this.options.selector);
} else {
throw "Either `element` or `selector` must be provided as an option";
}
({
_getProjectAndLoad: function() {
var xhr;
... | CoffeeScript | JavaScript | cdglabs/apparatus | src/viewer.coffee | MIT | bab26b55d8f8e722203ecd647fdf3daa30e05a8e | 1,052 | https://github.com/cdglabs/apparatus/blob/bab26b55d8f8e722203ecd647fdf3daa30e05a8e/src/viewer.coffee | 87 | 129 |
cdglabs/apparatus:src/viewer.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
if (this.options.element != null) {
this._element = this.options.element;
} else if (this.options.selector != null) {
this._element = document.querySelector(this.options.selector);
} else {
throw "Either `element` or `selector` must be provided as an option";... | if @options.element?
@_element = @options.element
else if @options.selector?
@_element = document.querySelector(@options.selector)
else
throw "Either `element` or `selector` must be provided as an option"
_getProjectAndLoad: ->
if @options.projectData and @options.url
throw "Do no... | JavaScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | bab26b55d8f8e722203ecd647fdf3daa30e05a8e | 1,052 | https://github.com/cdglabs/apparatus/blob/bab26b55d8f8e722203ecd647fdf3daa30e05a8e/src/viewer.coffee | 87 | 129 |
cdglabs/apparatus:src/viewer.coffee:3:completion | completion | if @options.element?
@_element = @options.element
else if @options.selector?
@_element = document.querySelector(@options.selector)
else
throw "Either `element` or `selector` must be provided as an option"
_getProjectAndLoad: ->
if @options.projectData and @options.url
throw "Do no... | @_load()
xhr.open("GET", @options.url)
xhr.send()
else
throw "Either `projectData` or `url` must be provided as an option"
_load: ->
# Now we can actually load the diagram!
# Use regionOfInterest to compute view matrix:
{regionOfInterest} = @options
rect = @_element.getBounding... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | bab26b55d8f8e722203ecd647fdf3daa30e05a8e | 1,052 | https://github.com/cdglabs/apparatus/blob/bab26b55d8f8e722203ecd647fdf3daa30e05a8e/src/viewer.coffee | 87 | 129 |
cdglabs/apparatus:src/viewer.coffee:4:raw_corpus | raw_corpus | @willRefreshNextFrame = false
for eventName in refreshEventNames
@_element.addEventListener(eventName, => @_refresh())
_deserializeProjectData: ->
serializer = Model.SerializerWithBuiltIns.getSerializer()
@_project = serializer.dejsonify(@_projectData)
_render: ->
Dataflow.run =>
R.ren... | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | bab26b55d8f8e722203ecd647fdf3daa30e05a8e | 1,052 | https://github.com/cdglabs/apparatus/blob/bab26b55d8f8e722203ecd647fdf3daa30e05a8e/src/viewer.coffee | 131 | 169 | ||
cdglabs/apparatus:src/viewer.coffee:4:completion | completion | @willRefreshNextFrame = false
for eventName in refreshEventNames
@_element.addEventListener(eventName, => @_refresh())
_deserializeProjectData: ->
serializer = Model.SerializerWithBuiltIns.getSerializer()
@_project = serializer.dejsonify(@_projectData)
_render: ->
Dataflow.run =>
R.ren... | ApparatusViewer.Attribute = class Attribute
constructor: (@_attribute, @_viewer) ->
# Returns the current value of the attribute.
value: ->
@_attribute.value()
# Sets the defining expression of the attribute to the string given.
setExpression: (exprString) ->
@_attribute.setExpression(exprString)
... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | bab26b55d8f8e722203ecd647fdf3daa30e05a8e | 1,052 | https://github.com/cdglabs/apparatus/blob/bab26b55d8f8e722203ecd647fdf3daa30e05a8e/src/viewer.coffee | 131 | 169 |
cdglabs/apparatus:src/viewer.coffee:3:raw_corpus | raw_corpus | if @options.element?
@_element = @options.element
else if @options.selector?
@_element = document.querySelector(@options.selector)
else
throw "Either `element` or `selector` must be provided as an option"
_getProjectAndLoad: ->
if @options.projectData and @options.url
throw "Do no... | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | c22160bfcc295183708aac06661100e6d7b7a50f | 1,052 | https://github.com/cdglabs/apparatus/blob/c22160bfcc295183708aac06661100e6d7b7a50f/src/viewer.coffee | 87 | 135 | ||
cdglabs/apparatus:src/viewer.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if @options.element?
@_element = @options.element
else if @options.selector?
@_element = document.querySelector(@options.selector)
else
throw "Either `element` or `selector` must be provided as an option"
_getProjectAndLoad: ->
if... | if (this.options.element != null) {
this._element = this.options.element;
} else if (this.options.selector != null) {
this._element = document.querySelector(this.options.selector);
} else {
throw "Either `element` or `selector` must be provided as an option";
}
({
_getProjectAndLoad: function() {
var xhr;
... | CoffeeScript | JavaScript | cdglabs/apparatus | src/viewer.coffee | MIT | c22160bfcc295183708aac06661100e6d7b7a50f | 1,052 | https://github.com/cdglabs/apparatus/blob/c22160bfcc295183708aac06661100e6d7b7a50f/src/viewer.coffee | 87 | 135 |
cdglabs/apparatus:src/viewer.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
if (this.options.element != null) {
this._element = this.options.element;
} else if (this.options.selector != null) {
this._element = document.querySelector(this.options.selector);
} else {
throw "Either `element` or `selector` must be provided as an option";... | if @options.element?
@_element = @options.element
else if @options.selector?
@_element = document.querySelector(@options.selector)
else
throw "Either `element` or `selector` must be provided as an option"
_getProjectAndLoad: ->
if @options.projectData and @options.url
throw "Do no... | JavaScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | c22160bfcc295183708aac06661100e6d7b7a50f | 1,052 | https://github.com/cdglabs/apparatus/blob/c22160bfcc295183708aac06661100e6d7b7a50f/src/viewer.coffee | 87 | 135 |
cdglabs/apparatus:src/viewer.coffee:3:completion | completion | if @options.element?
@_element = @options.element
else if @options.selector?
@_element = document.querySelector(@options.selector)
else
throw "Either `element` or `selector` must be provided as an option"
_getProjectAndLoad: ->
if @options.projectData and @options.url
throw "Do no... | else
throw "Either `projectData` or `url` must be provided as an option"
_load: ->
# Now we can actually load the diagram!
# Use regionOfInterest to compute view matrix:
{regionOfInterest} = @options
rect = @_element.getBoundingClientRect()
@_project.editingElement.zoomViewMatrixToRegionOf... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | c22160bfcc295183708aac06661100e6d7b7a50f | 1,052 | https://github.com/cdglabs/apparatus/blob/c22160bfcc295183708aac06661100e6d7b7a50f/src/viewer.coffee | 87 | 135 |
cdglabs/apparatus:src/viewer.coffee:3:raw_corpus | raw_corpus | if @options.element?
@_element = @options.element
else if @options.selector?
@_element = document.querySelector(@options.selector)
else
throw "Either `element` or `selector` must be provided as an option"
_getProjectAndLoad: ->
if @options.projectData and @options.url
throw "Do no... | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 204ad5caa9ca11c12cf450a23e316a103981dc9c | 1,052 | https://github.com/cdglabs/apparatus/blob/204ad5caa9ca11c12cf450a23e316a103981dc9c/src/viewer.coffee | 87 | 128 | ||
cdglabs/apparatus:src/viewer.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if @options.element?
@_element = @options.element
else if @options.selector?
@_element = document.querySelector(@options.selector)
else
throw "Either `element` or `selector` must be provided as an option"
_getProjectAndLoad: ->
if... | if (this.options.element != null) {
this._element = this.options.element;
} else if (this.options.selector != null) {
this._element = document.querySelector(this.options.selector);
} else {
throw "Either `element` or `selector` must be provided as an option";
}
({
_getProjectAndLoad: function() {
var xhr;
... | CoffeeScript | JavaScript | cdglabs/apparatus | src/viewer.coffee | MIT | 204ad5caa9ca11c12cf450a23e316a103981dc9c | 1,052 | https://github.com/cdglabs/apparatus/blob/204ad5caa9ca11c12cf450a23e316a103981dc9c/src/viewer.coffee | 87 | 128 |
cdglabs/apparatus:src/viewer.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
if (this.options.element != null) {
this._element = this.options.element;
} else if (this.options.selector != null) {
this._element = document.querySelector(this.options.selector);
} else {
throw "Either `element` or `selector` must be provided as an option";... | if @options.element?
@_element = @options.element
else if @options.selector?
@_element = document.querySelector(@options.selector)
else
throw "Either `element` or `selector` must be provided as an option"
_getProjectAndLoad: ->
if @options.projectData and @options.url
throw "Do no... | JavaScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 204ad5caa9ca11c12cf450a23e316a103981dc9c | 1,052 | https://github.com/cdglabs/apparatus/blob/204ad5caa9ca11c12cf450a23e316a103981dc9c/src/viewer.coffee | 87 | 128 |
cdglabs/apparatus:src/viewer.coffee:3:completion | completion | if @options.element?
@_element = @options.element
else if @options.selector?
@_element = document.querySelector(@options.selector)
else
throw "Either `element` or `selector` must be provided as an option"
_getProjectAndLoad: ->
if @options.projectData and @options.url
throw "Do no... | @_load()
xhr.open("GET", @options.url)
xhr.send()
else
throw "Either `projectData` or `url` must be provided as an option"
_load: ->
# Now we can actually load the diagram!
# Use regionOfInterest to compute view matrix:
{regionOfInterest} = @options
rect = @_element.getBounding... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 204ad5caa9ca11c12cf450a23e316a103981dc9c | 1,052 | https://github.com/cdglabs/apparatus/blob/204ad5caa9ca11c12cf450a23e316a103981dc9c/src/viewer.coffee | 87 | 128 |
cdglabs/apparatus:src/viewer.coffee:4:raw_corpus | raw_corpus | @_render()
refreshEventNames = [
"mousedown"
"mousemove"
"mouseup"
"keydown"
"keyup"
"scroll"
"change"
"wheel"
"mousewheel"
]
@willRefreshNextFrame = false
for eventName in refreshEventNames
@_element.addEventListener(eventName, => @_refresh(... | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 204ad5caa9ca11c12cf450a23e316a103981dc9c | 1,052 | https://github.com/cdglabs/apparatus/blob/204ad5caa9ca11c12cf450a23e316a103981dc9c/src/viewer.coffee | 130 | 170 | ||
cdglabs/apparatus:src/viewer.coffee:4:completion | completion | @_render()
refreshEventNames = [
"mousedown"
"mousemove"
"mouseup"
"keydown"
"keyup"
"scroll"
"change"
"wheel"
"mousewheel"
]
@willRefreshNextFrame = false
for eventName in refreshEventNames
@_element.addEventListener(eventName, => @_refresh(... | @_project = serializer.dejsonify(@_projectData)
_render: ->
Dataflow.run =>
R.render(R.Viewer({project: @_project}), @_element)
@options.onRender?.apply(this)
_refresh: ->
return if @willRefreshNextFrame
@willRefreshNextFrame = true
requestAnimationFrame =>
@_render()
@willRe... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 204ad5caa9ca11c12cf450a23e316a103981dc9c | 1,052 | https://github.com/cdglabs/apparatus/blob/204ad5caa9ca11c12cf450a23e316a103981dc9c/src/viewer.coffee | 130 | 170 |
cdglabs/apparatus:src/viewer.coffee:5:raw_corpus | raw_corpus | # Sets the defining expression of the attribute to the string given.
setExpression: (exprString) ->
@_attribute.setExpression(exprString)
@_viewer._refresh()
return
# ADVANCED USAGE: Returns a reference to the internal `Attribute` node
# represented by this object. You can read and write to this obje... | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 204ad5caa9ca11c12cf450a23e316a103981dc9c | 1,052 | https://github.com/cdglabs/apparatus/blob/204ad5caa9ca11c12cf450a23e316a103981dc9c/src/viewer.coffee | 172 | 182 | ||
cdglabs/apparatus:src/viewer.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Sets the defining expression of the attribute to the string given.
setExpression: (exprString) ->
@_attribute.setExpression(exprString)
@_viewer._refresh()
return
# ADVANCED USAGE: Returns a reference to the internal `Attribute` node
# repres... | // Sets the defining expression of the attribute to the string given.
({
setExpression: function(exprString) {
this._attribute.setExpression(exprString);
this._viewer._refresh();
},
// ADVANCED USAGE: Returns a reference to the internal `Attribute` node
// represented by this object. You can read and wr... | CoffeeScript | JavaScript | cdglabs/apparatus | src/viewer.coffee | MIT | 204ad5caa9ca11c12cf450a23e316a103981dc9c | 1,052 | https://github.com/cdglabs/apparatus/blob/204ad5caa9ca11c12cf450a23e316a103981dc9c/src/viewer.coffee | 172 | 182 |
cdglabs/apparatus:src/viewer.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Sets the defining expression of the attribute to the string given.
({
setExpression: function(exprString) {
this._attribute.setExpression(exprString);
this._viewer._refresh();
},
// ADVANCED USAGE: Returns a reference to the internal `Attribute` no... | # Sets the defining expression of the attribute to the string given.
setExpression: (exprString) ->
@_attribute.setExpression(exprString)
@_viewer._refresh()
return
# ADVANCED USAGE: Returns a reference to the internal `Attribute` node
# represented by this object. You can read and write to this obje... | JavaScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 204ad5caa9ca11c12cf450a23e316a103981dc9c | 1,052 | https://github.com/cdglabs/apparatus/blob/204ad5caa9ca11c12cf450a23e316a103981dc9c/src/viewer.coffee | 172 | 182 |
cdglabs/apparatus:src/viewer.coffee:5:completion | completion | # Sets the defining expression of the attribute to the string given.
setExpression: (exprString) ->
@_attribute.setExpression(exprString)
@_viewer._refresh()
return | # ADVANCED USAGE: Returns a reference to the internal `Attribute` node
# represented by this object. You can read and write to this object, but
# beware: its representation and behavior are subject to change.
raw: ->
@_attribute | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 204ad5caa9ca11c12cf450a23e316a103981dc9c | 1,052 | https://github.com/cdglabs/apparatus/blob/204ad5caa9ca11c12cf450a23e316a103981dc9c/src/viewer.coffee | 172 | 182 |
cdglabs/apparatus:src/viewer.coffee:2:raw_corpus | raw_corpus | window.ApparatusViewer = class ApparatusViewer
constructor: (@options) ->
# TODO: Add selection of which element to view?
@_getElement()
@_getProjectAndLoad()
# Returns an object representing the attribute node with label `label`,
# provided this label is unique. The object returned is an
# `Appara... | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | cd663820b774f1fa481a9f2fcde035b5394ab65e | 1,052 | https://github.com/cdglabs/apparatus/blob/cd663820b774f1fa481a9f2fcde035b5394ab65e/src/viewer.coffee | 45 | 85 | ||
cdglabs/apparatus:src/viewer.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
window.ApparatusViewer = class ApparatusViewer
constructor: (@options) ->
# TODO: Add selection of which element to view?
@_getElement()
@_getProjectAndLoad()
# Returns an object representing the attribute node with label `label`,
# provided th... | var ApparatusViewer;
window.ApparatusViewer = ApparatusViewer = class ApparatusViewer {
constructor(options) {
this.options = options;
// TODO: Add selection of which element to view?
this._getElement();
this._getProjectAndLoad();
}
// Returns an object representing the attribute node with label... | CoffeeScript | JavaScript | cdglabs/apparatus | src/viewer.coffee | MIT | cd663820b774f1fa481a9f2fcde035b5394ab65e | 1,052 | https://github.com/cdglabs/apparatus/blob/cd663820b774f1fa481a9f2fcde035b5394ab65e/src/viewer.coffee | 45 | 85 |
cdglabs/apparatus:src/viewer.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ApparatusViewer;
window.ApparatusViewer = ApparatusViewer = class ApparatusViewer {
constructor(options) {
this.options = options;
// TODO: Add selection of which element to view?
this._getElement();
this._getProjectAndLoad();
}
// Retur... | window.ApparatusViewer = class ApparatusViewer
constructor: (@options) ->
# TODO: Add selection of which element to view?
@_getElement()
@_getProjectAndLoad()
# Returns an object representing the attribute node with label `label`,
# provided this label is unique. The object returned is an
# `Appara... | JavaScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | cd663820b774f1fa481a9f2fcde035b5394ab65e | 1,052 | https://github.com/cdglabs/apparatus/blob/cd663820b774f1fa481a9f2fcde035b5394ab65e/src/viewer.coffee | 45 | 85 |
cdglabs/apparatus:src/viewer.coffee:2:completion | completion | window.ApparatusViewer = class ApparatusViewer
constructor: (@options) ->
# TODO: Add selection of which element to view?
@_getElement()
@_getProjectAndLoad()
# Returns an object representing the attribute node with label `label`,
# provided this label is unique. The object returned is an
# `Appara... | if attribute
foundMultiple = true
attribute = node
nodeVisitor.visit(@_project.editingElement)
nodeVisitor.finish()
if not foundSome
throw "Found no attributes with label #{label}"
if foundMultiple
throw "Found multiple attributes with label #{label}"
return new At... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | cd663820b774f1fa481a9f2fcde035b5394ab65e | 1,052 | https://github.com/cdglabs/apparatus/blob/cd663820b774f1fa481a9f2fcde035b5394ab65e/src/viewer.coffee | 45 | 85 |
cdglabs/apparatus:src/viewer.coffee:4:raw_corpus | raw_corpus | @_render()
refreshEventNames = [
"mousedown"
"mousemove"
"mouseup"
"keydown"
"keyup"
"scroll"
"change"
"wheel"
"mousewheel"
]
@willRefreshNextFrame = false
for eventName in refreshEventNames
@_element.addEventListener(eventName, => @_refresh(... | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | cd663820b774f1fa481a9f2fcde035b5394ab65e | 1,052 | https://github.com/cdglabs/apparatus/blob/cd663820b774f1fa481a9f2fcde035b5394ab65e/src/viewer.coffee | 130 | 170 | ||
cdglabs/apparatus:src/viewer.coffee:4:completion | completion | @_render()
refreshEventNames = [
"mousedown"
"mousemove"
"mouseup"
"keydown"
"keyup"
"scroll"
"change"
"wheel"
"mousewheel"
]
@willRefreshNextFrame = false
for eventName in refreshEventNames
@_element.addEventListener(eventName, => @_refresh(... | @_project = serializer.dejsonify(@_projectData)
_render: ->
Dataflow.run =>
R.render(R.Viewer({project: @_project}), @_element)
@options.onRender?.apply(this)
_refresh: ->
return if @willRefreshNextFrame
@willRefreshNextFrame = true
requestAnimationFrame =>
@_render()
@willRe... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | cd663820b774f1fa481a9f2fcde035b5394ab65e | 1,052 | https://github.com/cdglabs/apparatus/blob/cd663820b774f1fa481a9f2fcde035b5394ab65e/src/viewer.coffee | 130 | 170 |
cdglabs/apparatus:src/viewer.coffee:5:raw_corpus | raw_corpus | # Sets the defining expression of the attribute to the string given.
setExpression: (exprString) ->
@_attribute.setExpression(exprString)
return
# ADVANCED USAGE: Returns a reference to the internal `Attribute` node
# represented by this object. You can read and write to this object, but
# beware: its ... | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | cd663820b774f1fa481a9f2fcde035b5394ab65e | 1,052 | https://github.com/cdglabs/apparatus/blob/cd663820b774f1fa481a9f2fcde035b5394ab65e/src/viewer.coffee | 172 | 181 | ||
cdglabs/apparatus:src/viewer.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Sets the defining expression of the attribute to the string given.
setExpression: (exprString) ->
@_attribute.setExpression(exprString)
return
# ADVANCED USAGE: Returns a reference to the internal `Attribute` node
# represented by this object. Yo... | // Sets the defining expression of the attribute to the string given.
({
setExpression: function(exprString) {
this._attribute.setExpression(exprString);
},
// ADVANCED USAGE: Returns a reference to the internal `Attribute` node
// represented by this object. You can read and write to this object, but
// ... | CoffeeScript | JavaScript | cdglabs/apparatus | src/viewer.coffee | MIT | cd663820b774f1fa481a9f2fcde035b5394ab65e | 1,052 | https://github.com/cdglabs/apparatus/blob/cd663820b774f1fa481a9f2fcde035b5394ab65e/src/viewer.coffee | 172 | 181 |
cdglabs/apparatus:src/viewer.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Sets the defining expression of the attribute to the string given.
({
setExpression: function(exprString) {
this._attribute.setExpression(exprString);
},
// ADVANCED USAGE: Returns a reference to the internal `Attribute` node
// represented by this o... | # Sets the defining expression of the attribute to the string given.
setExpression: (exprString) ->
@_attribute.setExpression(exprString)
return
# ADVANCED USAGE: Returns a reference to the internal `Attribute` node
# represented by this object. You can read and write to this object, but
# beware: its ... | JavaScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | cd663820b774f1fa481a9f2fcde035b5394ab65e | 1,052 | https://github.com/cdglabs/apparatus/blob/cd663820b774f1fa481a9f2fcde035b5394ab65e/src/viewer.coffee | 172 | 181 |
cdglabs/apparatus:src/viewer.coffee:5:completion | completion | # Sets the defining expression of the attribute to the string given.
setExpression: (exprString) ->
@_attribute.setExpression(exprString)
return | # ADVANCED USAGE: Returns a reference to the internal `Attribute` node
# represented by this object. You can read and write to this object, but
# beware: its representation and behavior are subject to change.
raw: ->
@_attribute | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | cd663820b774f1fa481a9f2fcde035b5394ab65e | 1,052 | https://github.com/cdglabs/apparatus/blob/cd663820b774f1fa481a9f2fcde035b5394ab65e/src/viewer.coffee | 172 | 181 |
cdglabs/apparatus:src/viewer.coffee:4:raw_corpus | raw_corpus | @_render()
refreshEventNames = [
"mousedown"
"mousemove"
"mouseup"
"keydown"
"keyup"
"scroll"
"change"
"wheel"
"mousewheel"
]
@willRefreshNextFrame = false
for eventName in refreshEventNames
window.addEventListener(eventName, => @_refresh())
... | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 666399f42bd64a6c01357fe7e536fb0e8b85d874 | 1,052 | https://github.com/cdglabs/apparatus/blob/666399f42bd64a6c01357fe7e536fb0e8b85d874/src/viewer.coffee | 130 | 170 | ||
cdglabs/apparatus:src/viewer.coffee:4:completion | completion | @_render()
refreshEventNames = [
"mousedown"
"mousemove"
"mouseup"
"keydown"
"keyup"
"scroll"
"change"
"wheel"
"mousewheel"
]
@willRefreshNextFrame = false
for eventName in refreshEventNames
window.addEventListener(eventName, => @_refresh())
... | @_project = serializer.dejsonify(@_projectData)
_render: ->
Dataflow.run =>
R.render(R.Viewer({project: @_project}), @_element)
@options.onRender?.apply(this)
_refresh: ->
return if @willRefreshNextFrame
@willRefreshNextFrame = true
requestAnimationFrame =>
@_render()
@willRe... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/viewer.coffee | MIT | 666399f42bd64a6c01357fe7e536fb0e8b85d874 | 1,052 | https://github.com/cdglabs/apparatus/blob/666399f42bd64a6c01357fe7e536fb0e8b85d874/src/viewer.coffee | 130 | 170 |
meltingice/psd.js:lib/psd/nodes/ancestry.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
module.exports =
root: ->
return @ if @isRoot()
return @parent.root()
isRoot: -> @depth() is 0
children: -> @_children
ancestors: ->
return [] if not @parent? or @parent.isRoot()
return @parent.ancestors().concat [@parent]
hasChildren: -> @_children.length > 0
child... | CoffeeScript | meltingice/psd.js | lib/psd/nodes/ancestry.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/nodes/ancestry.coffee | 1 | 44 | ||
meltingice/psd.js:lib/psd/nodes/ancestry.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
module.exports =
root: ->
return @ if @isRoot()
return @parent.root()
isRoot: -> @depth() is 0
children: -> @_children
ancestors: ->
return [] if not @parent? or @parent.isRoot()
return @parent.ancestors().concat [... | var _;
_ = require('lodash');
module.exports = {
root: function() {
if (this.isRoot()) {
return this;
}
return this.parent.root();
},
isRoot: function() {
return this.depth() === 0;
},
children: function() {
return this._children;
},
ancestors: function() {
if ((this.parent... | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/nodes/ancestry.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/nodes/ancestry.coffee | 1 | 44 |
meltingice/psd.js:lib/psd/nodes/ancestry.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _;
_ = require('lodash');
module.exports = {
root: function() {
if (this.isRoot()) {
return this;
}
return this.parent.root();
},
isRoot: function() {
return this.depth() === 0;
},
children: function() {
return this._childr... | _ = require 'lodash'
module.exports =
root: ->
return @ if @isRoot()
return @parent.root()
isRoot: -> @depth() is 0
children: -> @_children
ancestors: ->
return [] if not @parent? or @parent.isRoot()
return @parent.ancestors().concat [@parent]
hasChildren: -> @_children.length > 0
child... | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/ancestry.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/nodes/ancestry.coffee | 1 | 44 |
meltingice/psd.js:lib/psd/nodes/ancestry.coffee:1:completion | completion | _ = require 'lodash'
module.exports =
root: ->
return @ if @isRoot()
return @parent.root()
isRoot: -> @depth() is 0
children: -> @_children
ancestors: ->
return [] if not @parent? or @parent.isRoot()
return @parent.ancestors().concat [@parent]
hasChildren: -> @_children.length > 0
child... | nextSibling: ->
return null unless @parent?
index = @siblings().indexOf(@)
@siblings()[index + 1]
prevSibling: ->
return null unless @parent?
index = @siblings().indexOf(@)
@siblings()[index - 1]
hasSiblings: -> @siblings().length > 1
onlyChild: -> not @hasSiblings()
descendants: -> _... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/ancestry.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/nodes/ancestry.coffee | 1 | 44 |
meltingice/psd.js:lib/psd/nodes/ancestry.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
module.exports =
root: ->
return @ if isRoot()
return @parent.root()
isRoot: -> @depth() is 0
children: -> @_children
ancestors: ->
return [] if not @parent? or @parent.isRoot()
return @parent.ancestors().concat [@parent]
hasChildren: -> @_children.length > 0
childl... | CoffeeScript | meltingice/psd.js | lib/psd/nodes/ancestry.coffee | MIT | ad21712fd68b99cacb607911177f73b729d5504e | 2,846 | https://github.com/meltingice/psd.js/blob/ad21712fd68b99cacb607911177f73b729d5504e/lib/psd/nodes/ancestry.coffee | 1 | 44 | ||
meltingice/psd.js:lib/psd/nodes/ancestry.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
module.exports =
root: ->
return @ if isRoot()
return @parent.root()
isRoot: -> @depth() is 0
children: -> @_children
ancestors: ->
return [] if not @parent? or @parent.isRoot()
return @parent.ancestors().concat [@... | var _;
_ = require('lodash');
module.exports = {
root: function() {
if (isRoot()) {
return this;
}
return this.parent.root();
},
isRoot: function() {
return this.depth() === 0;
},
children: function() {
return this._children;
},
ancestors: function() {
if ((this.parent == n... | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/nodes/ancestry.coffee | MIT | ad21712fd68b99cacb607911177f73b729d5504e | 2,846 | https://github.com/meltingice/psd.js/blob/ad21712fd68b99cacb607911177f73b729d5504e/lib/psd/nodes/ancestry.coffee | 1 | 44 |
meltingice/psd.js:lib/psd/nodes/ancestry.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _;
_ = require('lodash');
module.exports = {
root: function() {
if (isRoot()) {
return this;
}
return this.parent.root();
},
isRoot: function() {
return this.depth() === 0;
},
children: function() {
return this._children;
... | _ = require 'lodash'
module.exports =
root: ->
return @ if isRoot()
return @parent.root()
isRoot: -> @depth() is 0
children: -> @_children
ancestors: ->
return [] if not @parent? or @parent.isRoot()
return @parent.ancestors().concat [@parent]
hasChildren: -> @_children.length > 0
childl... | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/ancestry.coffee | MIT | ad21712fd68b99cacb607911177f73b729d5504e | 2,846 | https://github.com/meltingice/psd.js/blob/ad21712fd68b99cacb607911177f73b729d5504e/lib/psd/nodes/ancestry.coffee | 1 | 44 |
meltingice/psd.js:lib/psd/nodes/ancestry.coffee:1:completion | completion | _ = require 'lodash'
module.exports =
root: ->
return @ if isRoot()
return @parent.root()
isRoot: -> @depth() is 0
children: -> @_children
ancestors: ->
return [] if not @parent? or @parent.isRoot()
return @parent.ancestors().concat [@parent]
hasChildren: -> @_children.length > 0
childl... | nextSibling: ->
return null unless @parent?
index = @siblings().indexOf(@)
@siblings()[index + 1]
prevSibling: ->
return null unless @parent?
index = @siblings().indexOf(@)
@siblings()[index - 1]
hasSiblings: -> @siblings().length > 1
onlyChild: -> not @hasSiblings()
descendants: -> _... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/ancestry.coffee | MIT | ad21712fd68b99cacb607911177f73b729d5504e | 2,846 | https://github.com/meltingice/psd.js/blob/ad21712fd68b99cacb607911177f73b729d5504e/lib/psd/nodes/ancestry.coffee | 1 | 44 |
meltingice/psd.js:lib/psd/nodes/ancestry.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
module.exports =
root: ->
return @ if isRoot()
return @parent.root()
isRoot: -> @depth() is 0
ancestors: ->
return [] if not @parent? or @parent.isRoot()
return @parent.ancestors().concat [@parent]
hasChildren: -> @children.length > 0
childless: -> not @hasChildren()
... | CoffeeScript | meltingice/psd.js | lib/psd/nodes/ancestry.coffee | MIT | 33021c04c7074390ce72658be0bee4197c4b27c2 | 2,846 | https://github.com/meltingice/psd.js/blob/33021c04c7074390ce72658be0bee4197c4b27c2/lib/psd/nodes/ancestry.coffee | 1 | 42 | ||
meltingice/psd.js:lib/psd/nodes/ancestry.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
module.exports =
root: ->
return @ if isRoot()
return @parent.root()
isRoot: -> @depth() is 0
ancestors: ->
return [] if not @parent? or @parent.isRoot()
return @parent.ancestors().concat [@parent]
hasChildren: -> ... | var _;
_ = require('lodash');
module.exports = {
root: function() {
if (isRoot()) {
return this;
}
return this.parent.root();
},
isRoot: function() {
return this.depth() === 0;
},
ancestors: function() {
if ((this.parent == null) || this.parent.isRoot()) {
return [];
}
... | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/nodes/ancestry.coffee | MIT | 33021c04c7074390ce72658be0bee4197c4b27c2 | 2,846 | https://github.com/meltingice/psd.js/blob/33021c04c7074390ce72658be0bee4197c4b27c2/lib/psd/nodes/ancestry.coffee | 1 | 42 |
meltingice/psd.js:lib/psd/nodes/ancestry.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _;
_ = require('lodash');
module.exports = {
root: function() {
if (isRoot()) {
return this;
}
return this.parent.root();
},
isRoot: function() {
return this.depth() === 0;
},
ancestors: function() {
if ((this.parent == nul... | _ = require 'lodash'
module.exports =
root: ->
return @ if isRoot()
return @parent.root()
isRoot: -> @depth() is 0
ancestors: ->
return [] if not @parent? or @parent.isRoot()
return @parent.ancestors().concat [@parent]
hasChildren: -> @children.length > 0
childless: -> not @hasChildren()
... | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/ancestry.coffee | MIT | 33021c04c7074390ce72658be0bee4197c4b27c2 | 2,846 | https://github.com/meltingice/psd.js/blob/33021c04c7074390ce72658be0bee4197c4b27c2/lib/psd/nodes/ancestry.coffee | 1 | 42 |
meltingice/psd.js:lib/psd/nodes/ancestry.coffee:1:completion | completion | _ = require 'lodash'
module.exports =
root: ->
return @ if isRoot()
return @parent.root()
isRoot: -> @depth() is 0
ancestors: ->
return [] if not @parent? or @parent.isRoot()
return @parent.ancestors().concat [@parent]
hasChildren: -> @children.length > 0
childless: -> not @hasChildren()
... | return null unless @parent?
index = @siblings().indexOf(@)
@siblings()[index + 1]
prevSibling: ->
return null unless @parent?
index = @siblings().indexOf(@)
@siblings()[index - 1]
hasSiblings: -> @siblings().length > 1
onlyChild: -> not @hasSiblings()
descendants: -> _.flatten @children.m... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/ancestry.coffee | MIT | 33021c04c7074390ce72658be0bee4197c4b27c2 | 2,846 | https://github.com/meltingice/psd.js/blob/33021c04c7074390ce72658be0bee4197c4b27c2/lib/psd/nodes/ancestry.coffee | 1 | 42 |
meltingice/psd.js:lib/psd/nodes/ancestry.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
module.exports =
root: ->
return @ if isRoot()
return @parent.root()
isRoot: -> @depth() is 0
ancestors: ->
return [] if not @parent? or @parent.isRoot()
return @parent.ancestors().concat [@parent]
hasChildren: -> @children().length > 0
childless: -> not @hasChildren()... | CoffeeScript | meltingice/psd.js | lib/psd/nodes/ancestry.coffee | MIT | aabb6de133eab9ae0a16981d0706fb83ce69fdba | 2,846 | https://github.com/meltingice/psd.js/blob/aabb6de133eab9ae0a16981d0706fb83ce69fdba/lib/psd/nodes/ancestry.coffee | 1 | 42 | ||
meltingice/psd.js:lib/psd/nodes/ancestry.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
module.exports =
root: ->
return @ if isRoot()
return @parent.root()
isRoot: -> @depth() is 0
ancestors: ->
return [] if not @parent? or @parent.isRoot()
return @parent.ancestors().concat [@parent]
hasChildren: -> ... | var _;
_ = require('lodash');
module.exports = {
root: function() {
if (isRoot()) {
return this;
}
return this.parent.root();
},
isRoot: function() {
return this.depth() === 0;
},
ancestors: function() {
if ((this.parent == null) || this.parent.isRoot()) {
return [];
}
... | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/nodes/ancestry.coffee | MIT | aabb6de133eab9ae0a16981d0706fb83ce69fdba | 2,846 | https://github.com/meltingice/psd.js/blob/aabb6de133eab9ae0a16981d0706fb83ce69fdba/lib/psd/nodes/ancestry.coffee | 1 | 42 |
meltingice/psd.js:lib/psd/nodes/ancestry.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _;
_ = require('lodash');
module.exports = {
root: function() {
if (isRoot()) {
return this;
}
return this.parent.root();
},
isRoot: function() {
return this.depth() === 0;
},
ancestors: function() {
if ((this.parent == nul... | _ = require 'lodash'
module.exports =
root: ->
return @ if isRoot()
return @parent.root()
isRoot: -> @depth() is 0
ancestors: ->
return [] if not @parent? or @parent.isRoot()
return @parent.ancestors().concat [@parent]
hasChildren: -> @children().length > 0
childless: -> not @hasChildren()... | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/ancestry.coffee | MIT | aabb6de133eab9ae0a16981d0706fb83ce69fdba | 2,846 | https://github.com/meltingice/psd.js/blob/aabb6de133eab9ae0a16981d0706fb83ce69fdba/lib/psd/nodes/ancestry.coffee | 1 | 42 |
meltingice/psd.js:lib/psd/nodes/ancestry.coffee:1:completion | completion | _ = require 'lodash'
module.exports =
root: ->
return @ if isRoot()
return @parent.root()
isRoot: -> @depth() is 0
ancestors: ->
return [] if not @parent? or @parent.isRoot()
return @parent.ancestors().concat [@parent]
hasChildren: -> @children().length > 0
childless: -> not @hasChildren()... | return null unless @parent?
index = @siblings().indexOf(@)
@siblings()[index + 1]
prevSibling: ->
return null unless @parent?
index = @siblings().indexOf(@)
@siblings()[index - 1]
hasSiblings: -> @siblings().length > 1
onlyChild: -> not @hasSiblings()
descendants: -> _.flatten @children()... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/ancestry.coffee | MIT | aabb6de133eab9ae0a16981d0706fb83ce69fdba | 2,846 | https://github.com/meltingice/psd.js/blob/aabb6de133eab9ae0a16981d0706fb83ce69fdba/lib/psd/nodes/ancestry.coffee | 1 | 42 |
abe33/atom-pigments:lib/color-marker-element.coffee:1:raw_corpus | raw_corpus | class ColorMarkerElement extends HTMLElement
EventsDelegation.includeInto(this)
renderer: new RENDERERS.background
createdCallback: ->
{CompositeDisposable, Emitter} = require 'atom' unless Emitter?
@emitter = new Emitter
@released = true
attachedCallback: ->
detachedCallback: ->
onDidRele... | CoffeeScript | abe33/atom-pigments | lib/color-marker-element.coffee | MIT | 5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8 | 518 | https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/color-marker-element.coffee | 13 | 62 | ||
abe33/atom-pigments:lib/color-marker-element.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class ColorMarkerElement extends HTMLElement
EventsDelegation.includeInto(this)
renderer: new RENDERERS.background
createdCallback: ->
{CompositeDisposable, Emitter} = require 'atom' unless Emitter?
@emitter = new Emitter
@released = true
... | var ColorMarkerElement;
ColorMarkerElement = (function() {
class ColorMarkerElement extends HTMLElement {
createdCallback() {
var CompositeDisposable, Emitter;
if (typeof Emitter === "undefined" || Emitter === null) {
({CompositeDisposable, Emitter} = require('atom'));
}
this.emit... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/color-marker-element.coffee | MIT | 5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8 | 518 | https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/color-marker-element.coffee | 13 | 62 |
abe33/atom-pigments:lib/color-marker-element.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ColorMarkerElement;
ColorMarkerElement = (function() {
class ColorMarkerElement extends HTMLElement {
createdCallback() {
var CompositeDisposable, Emitter;
if (typeof Emitter === "undefined" || Emitter === null) {
({CompositeDisposabl... | class ColorMarkerElement extends HTMLElement
EventsDelegation.includeInto(this)
renderer: new RENDERERS.background
createdCallback: ->
{CompositeDisposable, Emitter} = require 'atom' unless Emitter?
@emitter = new Emitter
@released = true
attachedCallback: ->
detachedCallback: ->
onDidRele... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/color-marker-element.coffee | MIT | 5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8 | 518 | https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/color-marker-element.coffee | 13 | 62 |
abe33/atom-pigments:lib/color-marker-element.coffee:1:completion | completion | class ColorMarkerElement extends HTMLElement
EventsDelegation.includeInto(this)
renderer: new RENDERERS.background
createdCallback: ->
{CompositeDisposable, Emitter} = require 'atom' unless Emitter?
@emitter = new Emitter
@released = true
attachedCallback: ->
detachedCallback: ->
onDidRele... | @released = false
@subscriptions = new CompositeDisposable
@subscriptions.add @colorMarker.marker.onDidDestroy => @release()
@subscriptions.add @colorMarker.marker.onDidChange (data) =>
{isValid} = data
if isValid then @bufferElement.requestMarkerUpdate([this]) else @release()
@subscription... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-marker-element.coffee | MIT | 5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8 | 518 | https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/color-marker-element.coffee | 13 | 62 |
abe33/atom-pigments:lib/color-marker-element.coffee:2:raw_corpus | raw_corpus | render: ->
return unless @colorMarker? and @colorMarker.color? and @renderer?
{colorMarker, renderer, bufferElement} = this
return if bufferElement.editor.isDestroyed()
@innerHTML = ''
{style, regions, class: cls} = renderer.render(colorMarker)
regions = (regions or []).filter (r) -> r?
... | CoffeeScript | abe33/atom-pigments | lib/color-marker-element.coffee | MIT | 5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8 | 518 | https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/color-marker-element.coffee | 63 | 111 | ||
abe33/atom-pigments:lib/color-marker-element.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
render: ->
return unless @colorMarker? and @colorMarker.color? and @renderer?
{colorMarker, renderer, bufferElement} = this
return if bufferElement.editor.isDestroyed()
@innerHTML = ''
{style, regions, class: cls} = renderer.render(colorMark... | ({
render: function() {
var bufferElement, cls, colorMarker, i, k, len, region, regions, renderer, style, v;
if (!((this.colorMarker != null) && (this.colorMarker.color != null) && (this.renderer != null))) {
return;
}
({colorMarker, renderer, bufferElement} = this);
if (bufferElement.editor... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/color-marker-element.coffee | MIT | 5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8 | 518 | https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/color-marker-element.coffee | 63 | 111 |
abe33/atom-pigments:lib/color-marker-element.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
render: function() {
var bufferElement, cls, colorMarker, i, k, len, region, regions, renderer, style, v;
if (!((this.colorMarker != null) && (this.colorMarker.color != null) && (this.renderer != null))) {
return;
}
({colorMarker, rendere... | render: ->
return unless @colorMarker? and @colorMarker.color? and @renderer?
{colorMarker, renderer, bufferElement} = this
return if bufferElement.editor.isDestroyed()
@innerHTML = ''
{style, regions, class: cls} = renderer.render(colorMarker)
regions = (regions or []).filter (r) -> r?
... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/color-marker-element.coffee | MIT | 5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8 | 518 | https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/color-marker-element.coffee | 63 | 111 |
abe33/atom-pigments:lib/color-marker-element.coffee:2:completion | completion | render: ->
return unless @colorMarker? and @colorMarker.color? and @renderer?
{colorMarker, renderer, bufferElement} = this
return if bufferElement.editor.isDestroyed()
@innerHTML = ''
{style, regions, class: cls} = renderer.render(colorMarker)
regions = (regions or []).filter (r) -> r?
... | @lastMarkerScreenRange = colorMarker.getScreenRange()
checkScreenRange: ->
return unless @colorMarker? and @lastMarkerScreenRange?
unless @lastMarkerScreenRange.isEqual(@colorMarker.getScreenRange())
@render()
isReleased: -> @released
release: (dispatchEvent=true) ->
return if @released
@... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-marker-element.coffee | MIT | 5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8 | 518 | https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/color-marker-element.coffee | 63 | 111 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.