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:test/users_test.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
cleanDB = (done) ->
User.remove {}, ->
done()
describe 'User', ->
before cleanDB
user_id = null
it "should be created", (done) ->
request(app)
.post("/users/create")
.send(INITIAL_DATA)
.expect 201, (err, res) ->
res.b... | var cleanDB;
cleanDB = function(done) {
return User.remove({}, function() {
return done();
});
};
describe('User', function() {
var user_id;
before(cleanDB);
user_id = null;
it("should be created", function(done) {
return request(app).post("/users/create").send(INITIAL_DATA).expect(201, function(e... | CoffeeScript | JavaScript | twilson63/express-coffee | test/users_test.coffee | MIT | baedde8ee076605eeaf56dd50eb72fe6d5621f8e | 622 | https://github.com/twilson63/express-coffee/blob/baedde8ee076605eeaf56dd50eb72fe6d5621f8e/test/users_test.coffee | 15 | 64 |
twilson63/express-coffee:test/users_test.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var cleanDB;
cleanDB = function(done) {
return User.remove({}, function() {
return done();
});
};
describe('User', function() {
var user_id;
before(cleanDB);
user_id = null;
it("should be created", function(done) {
return request(app).post("/u... | cleanDB = (done) ->
User.remove {}, ->
done()
describe 'User', ->
before cleanDB
user_id = null
it "should be created", (done) ->
request(app)
.post("/users/create")
.send(INITIAL_DATA)
.expect 201, (err, res) ->
res.body.should.containEql(INITIAL_DATA)
res.body.shou... | JavaScript | CoffeeScript | twilson63/express-coffee | test/users_test.coffee | MIT | baedde8ee076605eeaf56dd50eb72fe6d5621f8e | 622 | https://github.com/twilson63/express-coffee/blob/baedde8ee076605eeaf56dd50eb72fe6d5621f8e/test/users_test.coffee | 15 | 64 |
twilson63/express-coffee:test/users_test.coffee:1:completion | completion | cleanDB = (done) ->
User.remove {}, ->
done()
describe 'User', ->
before cleanDB
user_id = null
it "should be created", (done) ->
request(app)
.post("/users/create")
.send(INITIAL_DATA)
.expect 201, (err, res) ->
res.body.should.containEql(INITIAL_DATA)
res.body.shou... | res.body.should.have.property "_id"
res.body["_id"].should.be.eql user_id
done()
it "should be listed in list", (done) ->
request(app)
.get("/users")
.expect 200, (err, res) ->
res.body.should.be.an.instanceof Array
res.body.should.have.length 1
# r.body[0].sho... | CoffeeScript | CoffeeScript | twilson63/express-coffee | test/users_test.coffee | MIT | baedde8ee076605eeaf56dd50eb72fe6d5621f8e | 622 | https://github.com/twilson63/express-coffee/blob/baedde8ee076605eeaf56dd50eb72fe6d5621f8e/test/users_test.coffee | 15 | 64 |
twilson63/express-coffee:test/users_test.coffee:2:raw_corpus | raw_corpus | res.body.should.containEql(UPDATED_DATA)
res.body.should.have.property "_id"
res.body["_id"].should.be.eql user_id
done()
it "should be removed", (done) ->
request(app)
.del("/users/delete/#{user_id}")
.expect 200, (err, res) ->
done()
it "should not be listed after... | CoffeeScript | twilson63/express-coffee | test/users_test.coffee | MIT | baedde8ee076605eeaf56dd50eb72fe6d5621f8e | 622 | https://github.com/twilson63/express-coffee/blob/baedde8ee076605eeaf56dd50eb72fe6d5621f8e/test/users_test.coffee | 65 | 84 | ||
twilson63/express-coffee:test/users_test.coffee:2:completion | completion | res.body.should.containEql(UPDATED_DATA)
res.body.should.have.property "_id"
res.body["_id"].should.be.eql user_id
done()
it "should be removed", (done) ->
request(app)
.del("/users/delete/#{user_id}")
.expect 200, (err, res) ->
done() | it "should not be listed after remove", (done) ->
request(app)
.get("/users")
.expect 200, (err, res) ->
res.body.should.be.an.instanceof Array
res.body.should.have.length 0
done()
after cleanDB | CoffeeScript | CoffeeScript | twilson63/express-coffee | test/users_test.coffee | MIT | baedde8ee076605eeaf56dd50eb72fe6d5621f8e | 622 | https://github.com/twilson63/express-coffee/blob/baedde8ee076605eeaf56dd50eb72fe6d5621f8e/test/users_test.coffee | 65 | 84 |
twilson63/express-coffee:test/users_test.coffee:1:raw_corpus | raw_corpus | cleanDB = (done) ->
User.remove {}, ->
done()
describe 'User', ->
before cleanDB
user_id = null
it "should be created", (done) ->
request(app)
.post("/users/create")
.send(INITIAL_DATA)
.expect 201, (err, res) ->
res.body.should.include(INITIAL_DATA)
res.body.should.... | CoffeeScript | twilson63/express-coffee | test/users_test.coffee | MIT | e417245efd2e1bb78ca72d126ea365e67f6174e8 | 622 | https://github.com/twilson63/express-coffee/blob/e417245efd2e1bb78ca72d126ea365e67f6174e8/test/users_test.coffee | 15 | 64 | ||
twilson63/express-coffee:test/users_test.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
cleanDB = (done) ->
User.remove {}, ->
done()
describe 'User', ->
before cleanDB
user_id = null
it "should be created", (done) ->
request(app)
.post("/users/create")
.send(INITIAL_DATA)
.expect 201, (err, res) ->
res.b... | var cleanDB;
cleanDB = function(done) {
return User.remove({}, function() {
return done();
});
};
describe('User', function() {
var user_id;
before(cleanDB);
user_id = null;
it("should be created", function(done) {
return request(app).post("/users/create").send(INITIAL_DATA).expect(201, function(e... | CoffeeScript | JavaScript | twilson63/express-coffee | test/users_test.coffee | MIT | e417245efd2e1bb78ca72d126ea365e67f6174e8 | 622 | https://github.com/twilson63/express-coffee/blob/e417245efd2e1bb78ca72d126ea365e67f6174e8/test/users_test.coffee | 15 | 64 |
twilson63/express-coffee:test/users_test.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var cleanDB;
cleanDB = function(done) {
return User.remove({}, function() {
return done();
});
};
describe('User', function() {
var user_id;
before(cleanDB);
user_id = null;
it("should be created", function(done) {
return request(app).post("/u... | cleanDB = (done) ->
User.remove {}, ->
done()
describe 'User', ->
before cleanDB
user_id = null
it "should be created", (done) ->
request(app)
.post("/users/create")
.send(INITIAL_DATA)
.expect 201, (err, res) ->
res.body.should.include(INITIAL_DATA)
res.body.should.... | JavaScript | CoffeeScript | twilson63/express-coffee | test/users_test.coffee | MIT | e417245efd2e1bb78ca72d126ea365e67f6174e8 | 622 | https://github.com/twilson63/express-coffee/blob/e417245efd2e1bb78ca72d126ea365e67f6174e8/test/users_test.coffee | 15 | 64 |
twilson63/express-coffee:test/users_test.coffee:1:completion | completion | cleanDB = (done) ->
User.remove {}, ->
done()
describe 'User', ->
before cleanDB
user_id = null
it "should be created", (done) ->
request(app)
.post("/users/create")
.send(INITIAL_DATA)
.expect 201, (err, res) ->
res.body.should.include(INITIAL_DATA)
res.body.should.... | res.body.should.have.property "_id"
res.body["_id"].should.be.eql user_id
done()
it "should be listed in list", (done) ->
request(app)
.get("/users")
.expect 200, (err, res) ->
res.body.should.be.an.instanceof Array
res.body.should.have.length 1
res.body[0].sho... | CoffeeScript | CoffeeScript | twilson63/express-coffee | test/users_test.coffee | MIT | e417245efd2e1bb78ca72d126ea365e67f6174e8 | 622 | https://github.com/twilson63/express-coffee/blob/e417245efd2e1bb78ca72d126ea365e67f6174e8/test/users_test.coffee | 15 | 64 |
twilson63/express-coffee:test/users_test.coffee:2:raw_corpus | raw_corpus | res.body.should.include(UPDATED_DATA)
res.body.should.have.property "_id"
res.body["_id"].should.be.eql user_id
done()
it "should be removed", (done) ->
request(app)
.del("/users/delete/#{user_id}")
.expect 200, (err, res) ->
done()
it "should not be listed after re... | CoffeeScript | twilson63/express-coffee | test/users_test.coffee | MIT | e417245efd2e1bb78ca72d126ea365e67f6174e8 | 622 | https://github.com/twilson63/express-coffee/blob/e417245efd2e1bb78ca72d126ea365e67f6174e8/test/users_test.coffee | 65 | 84 | ||
twilson63/express-coffee:test/users_test.coffee:2:completion | completion | res.body.should.include(UPDATED_DATA)
res.body.should.have.property "_id"
res.body["_id"].should.be.eql user_id
done()
it "should be removed", (done) ->
request(app)
.del("/users/delete/#{user_id}")
.expect 200, (err, res) ->
done() | it "should not be listed after remove", (done) ->
request(app)
.get("/users")
.expect 200, (err, res) ->
res.body.should.be.an.instanceof Array
res.body.should.have.length 0
done()
after cleanDB | CoffeeScript | CoffeeScript | twilson63/express-coffee | test/users_test.coffee | MIT | e417245efd2e1bb78ca72d126ea365e67f6174e8 | 622 | https://github.com/twilson63/express-coffee/blob/e417245efd2e1bb78ca72d126ea365e67f6174e8/test/users_test.coffee | 65 | 84 |
octoblu/meshblu:src/controllers/authenticate-controller.coffee:1:raw_corpus | raw_corpus | redis = require '../../lib/redis'
Authenticator = require '../models/authenticator'
MeshbluAuthParser = require '../helpers/meshblu-auth-parser'
debug = require('debug')('meshblu-http-server:authenticate-controller')
class AuthenticateController
constructor: (options={}, dependencies={}) ->
{@aut... | CoffeeScript | octoblu/meshblu | src/controllers/authenticate-controller.coffee | MIT | 4d34474fedb799a67a1eb20112530062b69ac90b | 815 | https://github.com/octoblu/meshblu/blob/4d34474fedb799a67a1eb20112530062b69ac90b/src/controllers/authenticate-controller.coffee | 1 | 26 | ||
octoblu/meshblu:src/controllers/authenticate-controller.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
redis = require '../../lib/redis'
Authenticator = require '../models/authenticator'
MeshbluAuthParser = require '../helpers/meshblu-auth-parser'
debug = require('debug')('meshblu-http-server:authenticate-controller')
class AuthenticateController
... | var AuthenticateController, Authenticator, MeshbluAuthParser, debug, redis;
redis = require('../../lib/redis');
Authenticator = require('../models/authenticator');
MeshbluAuthParser = require('../helpers/meshblu-auth-parser');
debug = require('debug')('meshblu-http-server:authenticate-controller');
AuthenticateCon... | CoffeeScript | JavaScript | octoblu/meshblu | src/controllers/authenticate-controller.coffee | MIT | 4d34474fedb799a67a1eb20112530062b69ac90b | 815 | https://github.com/octoblu/meshblu/blob/4d34474fedb799a67a1eb20112530062b69ac90b/src/controllers/authenticate-controller.coffee | 1 | 26 |
octoblu/meshblu:src/controllers/authenticate-controller.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var AuthenticateController, Authenticator, MeshbluAuthParser, debug, redis;
redis = require('../../lib/redis');
Authenticator = require('../models/authenticator');
MeshbluAuthParser = require('../helpers/meshblu-auth-parser');
debug = require('debug')('meshblu-... | redis = require '../../lib/redis'
Authenticator = require '../models/authenticator'
MeshbluAuthParser = require '../helpers/meshblu-auth-parser'
debug = require('debug')('meshblu-http-server:authenticate-controller')
class AuthenticateController
constructor: (options={}, dependencies={}) ->
{@aut... | JavaScript | CoffeeScript | octoblu/meshblu | src/controllers/authenticate-controller.coffee | MIT | 4d34474fedb799a67a1eb20112530062b69ac90b | 815 | https://github.com/octoblu/meshblu/blob/4d34474fedb799a67a1eb20112530062b69ac90b/src/controllers/authenticate-controller.coffee | 1 | 26 |
octoblu/meshblu:src/controllers/authenticate-controller.coffee:1:completion | completion | redis = require '../../lib/redis'
Authenticator = require '../models/authenticator'
MeshbluAuthParser = require '../helpers/meshblu-auth-parser'
debug = require('debug')('meshblu-http-server:authenticate-controller')
class AuthenticateController
constructor: (options={}, dependencies={}) ->
{@aut... | authenticate: (request, response) =>
{uuid,token} = @authParser.parse request
return response.status(401).end() unless uuid?
@authenticator.authenticate uuid, token, (error, isAuthenticated) =>
debug '@authenticator.authenticate', error
return response.status(502).end() if error?
return ... | CoffeeScript | CoffeeScript | octoblu/meshblu | src/controllers/authenticate-controller.coffee | MIT | 4d34474fedb799a67a1eb20112530062b69ac90b | 815 | https://github.com/octoblu/meshblu/blob/4d34474fedb799a67a1eb20112530062b69ac90b/src/controllers/authenticate-controller.coffee | 1 | 26 |
octoblu/meshblu:src/controllers/authenticate-controller.coffee:1:raw_corpus | raw_corpus | redis = require 'redis'
Authenticator = require '../models/authenticator'
MeshbluAuthParser = require '../helpers/meshblu-auth-parser'
debug = require('debug')('meshblu-http-server:authenticate-controller')
class AuthenticateController
constructor: (options={}, dependencies={}) ->
{@authenticator... | CoffeeScript | octoblu/meshblu | src/controllers/authenticate-controller.coffee | MIT | 12672e10627e690e2e56bba865f71c38b8a90f25 | 815 | https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/src/controllers/authenticate-controller.coffee | 1 | 26 | ||
octoblu/meshblu:src/controllers/authenticate-controller.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
redis = require 'redis'
Authenticator = require '../models/authenticator'
MeshbluAuthParser = require '../helpers/meshblu-auth-parser'
debug = require('debug')('meshblu-http-server:authenticate-controller')
class AuthenticateController
construc... | var AuthenticateController, Authenticator, MeshbluAuthParser, debug, redis;
redis = require('redis');
Authenticator = require('../models/authenticator');
MeshbluAuthParser = require('../helpers/meshblu-auth-parser');
debug = require('debug')('meshblu-http-server:authenticate-controller');
AuthenticateController = ... | CoffeeScript | JavaScript | octoblu/meshblu | src/controllers/authenticate-controller.coffee | MIT | 12672e10627e690e2e56bba865f71c38b8a90f25 | 815 | https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/src/controllers/authenticate-controller.coffee | 1 | 26 |
octoblu/meshblu:src/controllers/authenticate-controller.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var AuthenticateController, Authenticator, MeshbluAuthParser, debug, redis;
redis = require('redis');
Authenticator = require('../models/authenticator');
MeshbluAuthParser = require('../helpers/meshblu-auth-parser');
debug = require('debug')('meshblu-http-serve... | redis = require 'redis'
Authenticator = require '../models/authenticator'
MeshbluAuthParser = require '../helpers/meshblu-auth-parser'
debug = require('debug')('meshblu-http-server:authenticate-controller')
class AuthenticateController
constructor: (options={}, dependencies={}) ->
{@authenticator... | JavaScript | CoffeeScript | octoblu/meshblu | src/controllers/authenticate-controller.coffee | MIT | 12672e10627e690e2e56bba865f71c38b8a90f25 | 815 | https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/src/controllers/authenticate-controller.coffee | 1 | 26 |
octoblu/meshblu:src/controllers/authenticate-controller.coffee:1:completion | completion | redis = require 'redis'
Authenticator = require '../models/authenticator'
MeshbluAuthParser = require '../helpers/meshblu-auth-parser'
debug = require('debug')('meshblu-http-server:authenticate-controller')
class AuthenticateController
constructor: (options={}, dependencies={}) ->
{@authenticator... | authenticate: (request, response) =>
{uuid,token} = @authParser.parse request
return response.status(401).end() unless uuid?
@authenticator.authenticate uuid, token, (error, isAuthenticated) =>
debug '@authenticator.authenticate', error
return response.status(502).end() if error?
return ... | CoffeeScript | CoffeeScript | octoblu/meshblu | src/controllers/authenticate-controller.coffee | MIT | 12672e10627e690e2e56bba865f71c38b8a90f25 | 815 | https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/src/controllers/authenticate-controller.coffee | 1 | 26 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.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/scripts/mgmt/directives/directives.editor.view.stringArray.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee | 1 | 44 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
# 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/licens... | /*
* 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 applica... | CoffeeScript | JavaScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee | 1 | 44 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
* 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/li... | ###
# 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 ... | JavaScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee | 1 | 44 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.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 ... | definition: '='
templateUrl: '/partials/editor/stringArray.html'
controller: ($scope) ->
$scope.addArrayValue = ->
$scope.model = [] unless $scope.model?
$scope.model.push ''
$scope.updateArrayValue = (index, value) ->
$scope.mo... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee | 1 | 44 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.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/scripts/mgmt/directives/directives.editor.view.stringArray.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee | 1 | 44 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
# 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/licens... | /*
* 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 applica... | CoffeeScript | JavaScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee | 1 | 44 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
* 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/li... | ###
# 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 ... | JavaScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee | 1 | 44 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.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 ... | definition: '='
templateUrl: '/partials/editor/stringArray.html'
controller: ($scope) ->
$scope.addArrayValue = ->
$scope.model = [] unless $scope.model?
$scope.model.push ''
$scope.updateArrayValue = (index, value) ->
$scope.mo... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/directives/directives.editor.view.stringArray.coffee | 1 | 44 |
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:raw_corpus | raw_corpus | suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { name: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('node', '3')
.end()
'<my:test7><my:nodes><my:node... | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/stringify.coffee | 1 | 12 | ||
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { name: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('node'... | suite('Stringify:', function() {
return test('Custom function', function() {
var addns;
addns = function(val) {
return 'my:' + val;
};
return eq(xml('test7', {
headless: true,
stringify: {
name: addns
}
}).ele('nodes').ele('node', '1').up().ele('node', '2').up().ele... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/stringify.coffee | 1 | 12 |
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
suite('Stringify:', function() {
return test('Custom function', function() {
var addns;
addns = function(val) {
return 'my:' + val;
};
return eq(xml('test7', {
headless: true,
stringify: {
name: addns
}
}).ele('... | suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { name: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('node', '3')
.end()
'<my:test7><my:nodes><my:node... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/stringify.coffee | 1 | 12 |
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:completion | completion | suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { name: addns } })
.ele('nodes') | .ele('node', '1').up()
.ele('node', '2').up()
.ele('node', '3')
.end()
'<my:test7><my:nodes><my:node>1</my:node><my:node>2</my:node><my:node>3</my:node></my:nodes></my:test7>'
) | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/stringify.coffee | 1 | 12 |
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:raw_corpus | raw_corpus | suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { name: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('node', '3')
.end()
'<my:test7><my:nodes><my:node... | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | b38e655b1c8b3f940de5f764029d4cb6c4bc5d9e | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b38e655b1c8b3f940de5f764029d4cb6c4bc5d9e/test/basic/stringify.coffee | 1 | 19 | ||
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { name: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('node'... | suite('Stringify:', function() {
test('Custom function', function() {
var addns;
addns = function(val) {
return 'my:' + val;
};
return eq(xml('test7', {
headless: true,
stringify: {
name: addns
}
}).ele('nodes').ele('node', '1').up().ele('node', '2').up().ele('node'... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | b38e655b1c8b3f940de5f764029d4cb6c4bc5d9e | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b38e655b1c8b3f940de5f764029d4cb6c4bc5d9e/test/basic/stringify.coffee | 1 | 19 |
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
suite('Stringify:', function() {
test('Custom function', function() {
var addns;
addns = function(val) {
return 'my:' + val;
};
return eq(xml('test7', {
headless: true,
stringify: {
name: addns
}
}).ele('nodes')... | suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { name: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('node', '3')
.end()
'<my:test7><my:nodes><my:node... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | b38e655b1c8b3f940de5f764029d4cb6c4bc5d9e | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b38e655b1c8b3f940de5f764029d4cb6c4bc5d9e/test/basic/stringify.coffee | 1 | 19 |
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:completion | completion | suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { name: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('node', '3') | .end()
'<my:test7><my:nodes><my:node>1</my:node><my:node>2</my:node><my:node>3</my:node></my:nodes></my:test7>'
)
test 'Invalid chars', ->
err () -> xml('test').node('node with invalid char \u{0000} in node name')
err () -> xml('test').node('node with invalid char \u{D800} in node name')
err ()... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | b38e655b1c8b3f940de5f764029d4cb6c4bc5d9e | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b38e655b1c8b3f940de5f764029d4cb6c4bc5d9e/test/basic/stringify.coffee | 1 | 19 |
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:raw_corpus | raw_corpus | suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { eleName: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('node', '3')
.end()
'<my:test7><my:nodes><my:n... | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | 37731d9b6f29e7a2e12cb45679e9241055cd9af1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/37731d9b6f29e7a2e12cb45679e9241055cd9af1/test/basic/stringify.coffee | 1 | 19 | ||
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { eleName: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('no... | suite('Stringify:', function() {
test('Custom function', function() {
var addns;
addns = function(val) {
return 'my:' + val;
};
return eq(xml('test7', {
headless: true,
stringify: {
eleName: addns
}
}).ele('nodes').ele('node', '1').up().ele('node', '2').up().ele('no... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | 37731d9b6f29e7a2e12cb45679e9241055cd9af1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/37731d9b6f29e7a2e12cb45679e9241055cd9af1/test/basic/stringify.coffee | 1 | 19 |
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
suite('Stringify:', function() {
test('Custom function', function() {
var addns;
addns = function(val) {
return 'my:' + val;
};
return eq(xml('test7', {
headless: true,
stringify: {
eleName: addns
}
}).ele('node... | suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { eleName: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('node', '3')
.end()
'<my:test7><my:nodes><my:n... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | 37731d9b6f29e7a2e12cb45679e9241055cd9af1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/37731d9b6f29e7a2e12cb45679e9241055cd9af1/test/basic/stringify.coffee | 1 | 19 |
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:completion | completion | suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { eleName: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('node', '3') | .end()
'<my:test7><my:nodes><my:node>1</my:node><my:node>2</my:node><my:node>3</my:node></my:nodes></my:test7>'
)
test 'Invalid chars', ->
err () -> xml('test').node('node with invalid char \u{0000} in node name')
err () -> xml('test').node('node with invalid char \u{D800} in node name')
err ()... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | 37731d9b6f29e7a2e12cb45679e9241055cd9af1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/37731d9b6f29e7a2e12cb45679e9241055cd9af1/test/basic/stringify.coffee | 1 | 19 |
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:raw_corpus | raw_corpus | suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { eleName: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('node', '3')
.end()
'<my:test7><my:nodes><my:n... | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | b7da010f43dc58e32f0264943ee55c3fcf3e56bd | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b7da010f43dc58e32f0264943ee55c3fcf3e56bd/test/basic/stringify.coffee | 1 | 12 | ||
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { eleName: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('no... | suite('Stringify:', function() {
return test('Custom function', function() {
var addns;
addns = function(val) {
return 'my:' + val;
};
return eq(xml('test7', {
headless: true,
stringify: {
eleName: addns
}
}).ele('nodes').ele('node', '1').up().ele('node', '2').up().... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | b7da010f43dc58e32f0264943ee55c3fcf3e56bd | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b7da010f43dc58e32f0264943ee55c3fcf3e56bd/test/basic/stringify.coffee | 1 | 12 |
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
suite('Stringify:', function() {
return test('Custom function', function() {
var addns;
addns = function(val) {
return 'my:' + val;
};
return eq(xml('test7', {
headless: true,
stringify: {
eleName: addns
}
}).el... | suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { eleName: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('node', '3')
.end()
'<my:test7><my:nodes><my:n... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | b7da010f43dc58e32f0264943ee55c3fcf3e56bd | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b7da010f43dc58e32f0264943ee55c3fcf3e56bd/test/basic/stringify.coffee | 1 | 12 |
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:completion | completion | suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { eleName: addns } })
.ele('nodes') | .ele('node', '1').up()
.ele('node', '2').up()
.ele('node', '3')
.end()
'<my:test7><my:nodes><my:node>1</my:node><my:node>2</my:node><my:node>3</my:node></my:nodes></my:test7>'
) | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | b7da010f43dc58e32f0264943ee55c3fcf3e56bd | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b7da010f43dc58e32f0264943ee55c3fcf3e56bd/test/basic/stringify.coffee | 1 | 12 |
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:raw_corpus | raw_corpus | suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { eleName: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('node', '3')
.end()
'<my:test7><my:nodes><my:n... | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | d8c2ad0658592b3fa6f04df1d21e24871ae156ea | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/test/basic/stringify.coffee | 1 | 39 | ||
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { eleName: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('no... | suite('Stringify:', function() {
test('Custom function', function() {
var addns;
addns = function(val) {
return 'my:' + val;
};
return eq(xml('test7', {
headless: true,
stringify: {
eleName: addns
}
}).ele('nodes').ele('node', '1').up().ele('node', '2').up().ele('no... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | d8c2ad0658592b3fa6f04df1d21e24871ae156ea | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/test/basic/stringify.coffee | 1 | 39 |
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
suite('Stringify:', function() {
test('Custom function', function() {
var addns;
addns = function(val) {
return 'my:' + val;
};
return eq(xml('test7', {
headless: true,
stringify: {
eleName: addns
}
}).ele('node... | suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { eleName: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('node', '3')
.end()
'<my:test7><my:nodes><my:n... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | d8c2ad0658592b3fa6f04df1d21e24871ae156ea | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/test/basic/stringify.coffee | 1 | 39 |
oozcitak/xmlbuilder-js:test/basic/stringify.coffee:1:completion | completion | suite 'Stringify:', ->
test 'Custom function', ->
addns = (val) -> 'my:' + val
eq(
xml('test7', { headless: true, stringify: { eleName: addns } })
.ele('nodes')
.ele('node', '1').up()
.ele('node', '2').up()
.ele('node', '3')
.end()
'<my:test7><my:nodes><my:n... | eq(
xml(obj, { headless: true, textCase: 'kebab' }).end()
'<ele-name att-name="val"/>'
)
eq(
xml(obj, { headless: true, textCase: 'lower' }).end()
'<ele-name att-name="val"/>'
)
eq(
xml(obj, { headless: true, textCase: 'upper' }).end()
'<ELE-NAME ATT-NAME="val"/>'
... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/stringify.coffee | MIT | d8c2ad0658592b3fa6f04df1d21e24871ae156ea | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/test/basic/stringify.coffee | 1 | 39 |
cdglabs/apparatus:src/View/Canvas.coffee:1:raw_corpus | raw_corpus | _ = require "underscore"
R = require "./R"
Model = require "../Model/Model"
Util = require "../Util/Util"
R.create "Canvas",
contextTypes:
project: Model.Project
hoverManager: R.HoverManager
dragManager: R.DragManager
render: ->
R.div {
className: "Canvas"
# style:
# cursor: @... | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/View/Canvas.coffee | 1 | 43 | ||
cdglabs/apparatus:src/View/Canvas.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require "underscore"
R = require "./R"
Model = require "../Model/Model"
Util = require "../Util/Util"
R.create "Canvas",
contextTypes:
project: Model.Project
hoverManager: R.HoverManager
dragManager: R.DragManager
render: ->
R.div {
... | var Model, R, Util, _;
_ = require("underscore");
R = require("./R");
Model = require("../Model/Model");
Util = require("../Util/Util");
R.create("Canvas", {
contextTypes: {
project: Model.Project,
hoverManager: R.HoverManager,
dragManager: R.DragManager
},
render: function() {
return R.div({... | CoffeeScript | JavaScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/View/Canvas.coffee | 1 | 43 |
cdglabs/apparatus:src/View/Canvas.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Model, R, Util, _;
_ = require("underscore");
R = require("./R");
Model = require("../Model/Model");
Util = require("../Util/Util");
R.create("Canvas", {
contextTypes: {
project: Model.Project,
hoverManager: R.HoverManager,
dragManager: R.Dra... | _ = require "underscore"
R = require "./R"
Model = require "../Model/Model"
Util = require "../Util/Util"
R.create "Canvas",
contextTypes:
project: Model.Project
hoverManager: R.HoverManager
dragManager: R.DragManager
render: ->
R.div {
className: "Canvas"
# style:
# cursor: @... | JavaScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/View/Canvas.coffee | 1 | 43 |
cdglabs/apparatus:src/View/Canvas.coffee:1:completion | completion | _ = require "underscore"
R = require "./R"
Model = require "../Model/Model"
Util = require "../Util/Util"
R.create "Canvas",
contextTypes:
project: Model.Project
hoverManager: R.HoverManager
dragManager: R.DragManager
render: ->
R.div {
className: "Canvas"
# style:
# cursor: @... | onWheel: @_onWheel
},
R.HTMLCanvas {
draw: @_draw
}
# ===========================================================================
# Drawing
# ===========================================================================
_draw: (ctx) ->
project = @context.project
hoverManager = @c... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/View/Canvas.coffee | 1 | 43 |
cdglabs/apparatus:src/View/Canvas.coffee:2:raw_corpus | raw_corpus | renderOpts = {ctx, viewMatrix, highlight}
# TODO: draw background grid
for graphic in element.allGraphics()
graphic.render(renderOpts)
# TODO: draw control points
# ===========================================================================
# Event Logic
# ==================================... | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/View/Canvas.coffee | 45 | 84 | ||
cdglabs/apparatus:src/View/Canvas.coffee:2:completion | completion | renderOpts = {ctx, viewMatrix, highlight}
# TODO: draw background grid
for graphic in element.allGraphics()
graphic.render(renderOpts)
# TODO: draw control points
# ===========================================================================
# Event Logic
# ==================================... | @_updateSelected(mouseEvent, false)
@_startDrag(mouseEvent)
_onMouseMove: (mouseEvent) ->
dragManager = @context.dragManager
if !dragManager.drag
@_updateHoverAndCursor(mouseEvent)
_onMouseEnter: (mouseEvent) ->
# TODO
_onMouseLeave: (mouseEvent) ->
# TODO
_onWheel: (wheelEvent) ->... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/View/Canvas.coffee | 45 | 84 |
cdglabs/apparatus:src/View/Canvas.coffee:3:raw_corpus | raw_corpus | _updateHoverAndCursor: (mouseEvent) ->
{hoverManager, project} = @context
hits = @_hitDetect(mouseEvent)
nextSelected = project.getNextSelected(hits, false)
hoverManager.hoveredParticularElement = nextSelected
# TODO: Deal with controlled elements, set cursor
_updateSelected: (mouseEvent, isSelec... | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/View/Canvas.coffee | 86 | 134 | ||
cdglabs/apparatus:src/View/Canvas.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_updateHoverAndCursor: (mouseEvent) ->
{hoverManager, project} = @context
hits = @_hitDetect(mouseEvent)
nextSelected = project.getNextSelected(hits, false)
hoverManager.hoveredParticularElement = nextSelected
# TODO: Deal with controlled elem... | ({
_updateHoverAndCursor: function(mouseEvent) {
var hits, hoverManager, nextSelected, project;
({hoverManager, project} = this.context);
hits = this._hitDetect(mouseEvent);
nextSelected = project.getNextSelected(hits, false);
return hoverManager.hoveredParticularElement = nextSelected;
},
// ... | CoffeeScript | JavaScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/View/Canvas.coffee | 86 | 134 |
cdglabs/apparatus:src/View/Canvas.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
_updateHoverAndCursor: function(mouseEvent) {
var hits, hoverManager, nextSelected, project;
({hoverManager, project} = this.context);
hits = this._hitDetect(mouseEvent);
nextSelected = project.getNextSelected(hits, false);
return hoverMana... | _updateHoverAndCursor: (mouseEvent) ->
{hoverManager, project} = @context
hits = @_hitDetect(mouseEvent)
nextSelected = project.getNextSelected(hits, false)
hoverManager.hoveredParticularElement = nextSelected
# TODO: Deal with controlled elements, set cursor
_updateSelected: (mouseEvent, isSelec... | JavaScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/View/Canvas.coffee | 86 | 134 |
cdglabs/apparatus:src/View/Canvas.coffee:3:completion | completion | _updateHoverAndCursor: (mouseEvent) ->
{hoverManager, project} = @context
hits = @_hitDetect(mouseEvent)
nextSelected = project.getNextSelected(hits, false)
hoverManager.hoveredParticularElement = nextSelected
# TODO: Deal with controlled elements, set cursor
_updateSelected: (mouseEvent, isSelec... | originalMouseLocal = viewMatrix.compose(accumulatedMatrix).toLocal(originalMousePixel)
dragManager.start mouseDownEvent,
onMove: (mouseMoveEvent) =>
return unless dragManager.drag.consummated
currentMousePixel = @_mousePosition(mouseMoveEvent)
initialValues = for attribute in attribut... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/View/Canvas.coffee | 86 | 134 |
cdglabs/apparatus:src/View/Canvas.coffee:4:raw_corpus | raw_corpus | solvedValues = Util.solve(objective, initialValues)
for attribute, index in attributesToChange
solvedValue = solvedValues[index]
precision = precisions[index]
solvedValue = Util.toPrecision(solvedValue, precision)
attribute.setExpression(solvedValue)
# ===============... | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/View/Canvas.coffee | 136 | 177 | ||
cdglabs/apparatus:src/View/Canvas.coffee:4:completion | completion | solvedValues = Util.solve(objective, initialValues)
for attribute, index in attributesToChange
solvedValue = solvedValues[index]
precision = precisions[index]
solvedValue = Util.toPrecision(solvedValue, precision)
attribute.setExpression(solvedValue)
# ===============... | for graphic in element.allGraphics()
hits = graphic.hitDetect(hitDetectOpts) ? hits
return hits
_mousePosition: (mouseEvent) ->
el = @getDOMNode()
rect = el.getBoundingClientRect()
x = mouseEvent.clientX - rect.left
y = mouseEvent.clientY - rect.top
return [x, y]
# ================... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/View/Canvas.coffee | 136 | 177 |
cdglabs/apparatus:src/View/Canvas.coffee:5:raw_corpus | raw_corpus | _viewMatrix: ->
el = @getDOMNode()
rect = el.getBoundingClientRect()
{width, height} = rect
return new Util.Matrix(100, 0, 0, -100, width / 2, height / 2) | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/View/Canvas.coffee | 179 | 183 | ||
cdglabs/apparatus:src/View/Canvas.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_viewMatrix: ->
el = @getDOMNode()
rect = el.getBoundingClientRect()
{width, height} = rect
return new Util.Matrix(100, 0, 0, -100, width / 2, height / 2)
``` | ({
_viewMatrix: function() {
var el, height, rect, width;
el = this.getDOMNode();
rect = el.getBoundingClientRect();
({width, height} = rect);
return new Util.Matrix(100, 0, 0, -100, width / 2, height / 2);
}
}); | CoffeeScript | JavaScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/View/Canvas.coffee | 179 | 183 |
cdglabs/apparatus:src/View/Canvas.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
_viewMatrix: function() {
var el, height, rect, width;
el = this.getDOMNode();
rect = el.getBoundingClientRect();
({width, height} = rect);
return new Util.Matrix(100, 0, 0, -100, width / 2, height / 2);
}
});
``` | _viewMatrix: ->
el = @getDOMNode()
rect = el.getBoundingClientRect()
{width, height} = rect
return new Util.Matrix(100, 0, 0, -100, width / 2, height / 2) | JavaScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/View/Canvas.coffee | 179 | 183 |
cdglabs/apparatus:src/View/Canvas.coffee:5:completion | completion | _viewMatrix: ->
el = @getDOMNode() | rect = el.getBoundingClientRect()
{width, height} = rect
return new Util.Matrix(100, 0, 0, -100, width / 2, height / 2) | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/View/Canvas.coffee | 179 | 183 |
cdglabs/apparatus:src/View/Canvas.coffee:2:raw_corpus | raw_corpus | renderOpts = {ctx, viewMatrix, highlight}
# TODO: draw background grid
for graphic in element.allGraphics()
graphic.render(renderOpts)
# TODO: draw control points
# ===========================================================================
# Event Logic
# ==================================... | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | e6bd2b9859b5c223ed589131247a02487b570769 | 1,052 | https://github.com/cdglabs/apparatus/blob/e6bd2b9859b5c223ed589131247a02487b570769/src/View/Canvas.coffee | 45 | 88 | ||
cdglabs/apparatus:src/View/Canvas.coffee:2:completion | completion | renderOpts = {ctx, viewMatrix, highlight}
# TODO: draw background grid
for graphic in element.allGraphics()
graphic.render(renderOpts)
# TODO: draw control points
# ===========================================================================
# Event Logic
# ==================================... | if !dragManager.drag
@_updateHoverAndCursor(mouseEvent)
_onMouseEnter: (mouseEvent) ->
# TODO
_onMouseLeave: (mouseEvent) ->
# TODO
_onWheel: (wheelEvent) ->
# TODO
# ===========================================================================
# Actions
# ===============================... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | e6bd2b9859b5c223ed589131247a02487b570769 | 1,052 | https://github.com/cdglabs/apparatus/blob/e6bd2b9859b5c223ed589131247a02487b570769/src/View/Canvas.coffee | 45 | 88 |
cdglabs/apparatus:src/View/Canvas.coffee:3:raw_corpus | raw_corpus | _updateSelected: (mouseEvent, isSelectThrough) ->
project = @context.project
hits = @_hitDetect(mouseEvent)
nextSelected = project.getNextSelected(hits, isSelectThrough)
project.select(nextSelected)
_startDrag: (mouseDownEvent) ->
{project, dragManager} = @context
# TODO: Deal with controlle... | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | e6bd2b9859b5c223ed589131247a02487b570769 | 1,052 | https://github.com/cdglabs/apparatus/blob/e6bd2b9859b5c223ed589131247a02487b570769/src/View/Canvas.coffee | 90 | 131 | ||
cdglabs/apparatus:src/View/Canvas.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_updateSelected: (mouseEvent, isSelectThrough) ->
project = @context.project
hits = @_hitDetect(mouseEvent)
nextSelected = project.getNextSelected(hits, isSelectThrough)
project.select(nextSelected)
_startDrag: (mouseDownEvent) ->
{project,... | ({
_updateSelected: function(mouseEvent, isSelectThrough) {
var hits, nextSelected, project;
project = this.context.project;
hits = this._hitDetect(mouseEvent);
nextSelected = project.getNextSelected(hits, isSelectThrough);
return project.select(nextSelected);
},
_startDrag: function(mouseDown... | CoffeeScript | JavaScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | e6bd2b9859b5c223ed589131247a02487b570769 | 1,052 | https://github.com/cdglabs/apparatus/blob/e6bd2b9859b5c223ed589131247a02487b570769/src/View/Canvas.coffee | 90 | 131 |
cdglabs/apparatus:src/View/Canvas.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
_updateSelected: function(mouseEvent, isSelectThrough) {
var hits, nextSelected, project;
project = this.context.project;
hits = this._hitDetect(mouseEvent);
nextSelected = project.getNextSelected(hits, isSelectThrough);
return project.sele... | _updateSelected: (mouseEvent, isSelectThrough) ->
project = @context.project
hits = @_hitDetect(mouseEvent)
nextSelected = project.getNextSelected(hits, isSelectThrough)
project.select(nextSelected)
_startDrag: (mouseDownEvent) ->
{project, dragManager} = @context
# TODO: Deal with controlle... | JavaScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | e6bd2b9859b5c223ed589131247a02487b570769 | 1,052 | https://github.com/cdglabs/apparatus/blob/e6bd2b9859b5c223ed589131247a02487b570769/src/View/Canvas.coffee | 90 | 131 |
cdglabs/apparatus:src/View/Canvas.coffee:3:completion | completion | _updateSelected: (mouseEvent, isSelectThrough) ->
project = @context.project
hits = @_hitDetect(mouseEvent)
nextSelected = project.getNextSelected(hits, isSelectThrough)
project.select(nextSelected)
_startDrag: (mouseDownEvent) ->
{project, dragManager} = @context
# TODO: Deal with controlle... | return unless dragManager.drag.consummated
currentMousePixel = @_mousePosition(mouseMoveEvent)
initialValues = for attribute in attributesToChange
attribute.value()
precisions = for attribute in attributesToChange
Util.precision(attribute.exprString)
objective = (tri... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | e6bd2b9859b5c223ed589131247a02487b570769 | 1,052 | https://github.com/cdglabs/apparatus/blob/e6bd2b9859b5c223ed589131247a02487b570769/src/View/Canvas.coffee | 90 | 131 |
cdglabs/apparatus:src/View/Canvas.coffee:2:raw_corpus | raw_corpus | renderOpts = {ctx, viewMatrix, highlight}
# TODO: draw background grid
for graphic in element.allGraphics()
graphic.render(renderOpts)
# TODO: draw control points
# ===========================================================================
# Event Logic
# ==================================... | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 9b12231089d0c65f70f43ff8ca48198cea24302e | 1,052 | https://github.com/cdglabs/apparatus/blob/9b12231089d0c65f70f43ff8ca48198cea24302e/src/View/Canvas.coffee | 45 | 87 | ||
cdglabs/apparatus:src/View/Canvas.coffee:2:completion | completion | renderOpts = {ctx, viewMatrix, highlight}
# TODO: draw background grid
for graphic in element.allGraphics()
graphic.render(renderOpts)
# TODO: draw control points
# ===========================================================================
# Event Logic
# ==================================... | if !dragManager.drag
@_updateHoverAndCursor(mouseEvent)
_onMouseEnter: (mouseEvent) ->
# TODO
_onMouseLeave: (mouseEvent) ->
# TODO
_onWheel: (wheelEvent) ->
# TODO
# ===========================================================================
# Actions
# ===============================... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 9b12231089d0c65f70f43ff8ca48198cea24302e | 1,052 | https://github.com/cdglabs/apparatus/blob/9b12231089d0c65f70f43ff8ca48198cea24302e/src/View/Canvas.coffee | 45 | 87 |
cdglabs/apparatus:src/View/Canvas.coffee:3:raw_corpus | raw_corpus | _updateSelected: (mouseEvent, isSelectThrough) ->
project = @context.project
hits = @_hitDetect(mouseEvent)
nextSelected = project.getNextSelected(hits, isSelectThrough)
project.select(nextSelected)
# ===========================================================================
# Hit Detection
# =... | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 9b12231089d0c65f70f43ff8ca48198cea24302e | 1,052 | https://github.com/cdglabs/apparatus/blob/9b12231089d0c65f70f43ff8ca48198cea24302e/src/View/Canvas.coffee | 89 | 129 | ||
cdglabs/apparatus:src/View/Canvas.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_updateSelected: (mouseEvent, isSelectThrough) ->
project = @context.project
hits = @_hitDetect(mouseEvent)
nextSelected = project.getNextSelected(hits, isSelectThrough)
project.select(nextSelected)
# ==========================================... | ({
_updateSelected: function(mouseEvent, isSelectThrough) {
var hits, nextSelected, project;
project = this.context.project;
hits = this._hitDetect(mouseEvent);
nextSelected = project.getNextSelected(hits, isSelectThrough);
return project.select(nextSelected);
},
// ===========================... | CoffeeScript | JavaScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 9b12231089d0c65f70f43ff8ca48198cea24302e | 1,052 | https://github.com/cdglabs/apparatus/blob/9b12231089d0c65f70f43ff8ca48198cea24302e/src/View/Canvas.coffee | 89 | 129 |
cdglabs/apparatus:src/View/Canvas.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
_updateSelected: function(mouseEvent, isSelectThrough) {
var hits, nextSelected, project;
project = this.context.project;
hits = this._hitDetect(mouseEvent);
nextSelected = project.getNextSelected(hits, isSelectThrough);
return project.sele... | _updateSelected: (mouseEvent, isSelectThrough) ->
project = @context.project
hits = @_hitDetect(mouseEvent)
nextSelected = project.getNextSelected(hits, isSelectThrough)
project.select(nextSelected)
# ===========================================================================
# Hit Detection
# =... | JavaScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 9b12231089d0c65f70f43ff8ca48198cea24302e | 1,052 | https://github.com/cdglabs/apparatus/blob/9b12231089d0c65f70f43ff8ca48198cea24302e/src/View/Canvas.coffee | 89 | 129 |
cdglabs/apparatus:src/View/Canvas.coffee:3:completion | completion | _updateSelected: (mouseEvent, isSelectThrough) ->
project = @context.project
hits = @_hitDetect(mouseEvent)
nextSelected = project.getNextSelected(hits, isSelectThrough)
project.select(nextSelected)
# ===========================================================================
# Hit Detection
# =... | for graphic in element.allGraphics()
hits = graphic.hitDetect(hitDetectOpts) ? hits
return hits
_mousePosition: (mouseEvent) ->
el = @getDOMNode()
rect = el.getBoundingClientRect()
x = mouseEvent.clientX - rect.left
y = mouseEvent.clientY - rect.top
return {x, y}
# ================... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | 9b12231089d0c65f70f43ff8ca48198cea24302e | 1,052 | https://github.com/cdglabs/apparatus/blob/9b12231089d0c65f70f43ff8ca48198cea24302e/src/View/Canvas.coffee | 89 | 129 |
cdglabs/apparatus:src/View/Canvas.coffee:2:raw_corpus | raw_corpus | renderOpts = {ctx, viewMatrix, highlight}
# TODO: draw background grid
for graphic in element.allGraphics()
graphic.render(renderOpts)
# TODO: draw control points
# ===========================================================================
# Event Logic
# ==================================... | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | cec6097d5a4450c7beabf798d927e42792f1a0fa | 1,052 | https://github.com/cdglabs/apparatus/blob/cec6097d5a4450c7beabf798d927e42792f1a0fa/src/View/Canvas.coffee | 45 | 83 | ||
cdglabs/apparatus:src/View/Canvas.coffee:2:completion | completion | renderOpts = {ctx, viewMatrix, highlight}
# TODO: draw background grid
for graphic in element.allGraphics()
graphic.render(renderOpts)
# TODO: draw control points
# ===========================================================================
# Event Logic
# ==================================... | _onMouseMove: (mouseEvent) ->
dragManager = @context.dragManager
if dragManager.drag
"TODO"
else
@_updateHoverAndCursor(mouseEvent)
_onMouseEnter: (mouseEvent) ->
# TODO
_onMouseLeave: (mouseEvent) ->
# TODO
_onWheel: (wheelEvent) ->
# TODO
# =============================... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | cec6097d5a4450c7beabf798d927e42792f1a0fa | 1,052 | https://github.com/cdglabs/apparatus/blob/cec6097d5a4450c7beabf798d927e42792f1a0fa/src/View/Canvas.coffee | 45 | 83 |
cdglabs/apparatus:src/View/Canvas.coffee:3:raw_corpus | raw_corpus | _updateHoverAndCursor: (mouseEvent) ->
{hoverManager, project} = @context
hits = @_hitDetect(mouseEvent)
nextSelected = project.getNextSelected(hits, false)
hoverManager.hoveredParticularElement = nextSelected
# ===========================================================================
# Hit Dete... | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | cec6097d5a4450c7beabf798d927e42792f1a0fa | 1,052 | https://github.com/cdglabs/apparatus/blob/cec6097d5a4450c7beabf798d927e42792f1a0fa/src/View/Canvas.coffee | 85 | 125 | ||
cdglabs/apparatus:src/View/Canvas.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_updateHoverAndCursor: (mouseEvent) ->
{hoverManager, project} = @context
hits = @_hitDetect(mouseEvent)
nextSelected = project.getNextSelected(hits, false)
hoverManager.hoveredParticularElement = nextSelected
# ===============================... | ({
_updateHoverAndCursor: function(mouseEvent) {
var hits, hoverManager, nextSelected, project;
({hoverManager, project} = this.context);
hits = this._hitDetect(mouseEvent);
nextSelected = project.getNextSelected(hits, false);
return hoverManager.hoveredParticularElement = nextSelected;
},
// ... | CoffeeScript | JavaScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | cec6097d5a4450c7beabf798d927e42792f1a0fa | 1,052 | https://github.com/cdglabs/apparatus/blob/cec6097d5a4450c7beabf798d927e42792f1a0fa/src/View/Canvas.coffee | 85 | 125 |
cdglabs/apparatus:src/View/Canvas.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
_updateHoverAndCursor: function(mouseEvent) {
var hits, hoverManager, nextSelected, project;
({hoverManager, project} = this.context);
hits = this._hitDetect(mouseEvent);
nextSelected = project.getNextSelected(hits, false);
return hoverMana... | _updateHoverAndCursor: (mouseEvent) ->
{hoverManager, project} = @context
hits = @_hitDetect(mouseEvent)
nextSelected = project.getNextSelected(hits, false)
hoverManager.hoveredParticularElement = nextSelected
# ===========================================================================
# Hit Dete... | JavaScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | cec6097d5a4450c7beabf798d927e42792f1a0fa | 1,052 | https://github.com/cdglabs/apparatus/blob/cec6097d5a4450c7beabf798d927e42792f1a0fa/src/View/Canvas.coffee | 85 | 125 |
cdglabs/apparatus:src/View/Canvas.coffee:3:completion | completion | _updateHoverAndCursor: (mouseEvent) ->
{hoverManager, project} = @context
hits = @_hitDetect(mouseEvent)
nextSelected = project.getNextSelected(hits, false)
hoverManager.hoveredParticularElement = nextSelected
# ===========================================================================
# Hit Dete... | for graphic in element.allGraphics()
hits = graphic.hitDetect(hitDetectOpts) ? hits
return hits
_mousePosition: (mouseEvent) ->
el = @getDOMNode()
rect = el.getBoundingClientRect()
x = mouseEvent.clientX - rect.left
y = mouseEvent.clientY - rect.top
return {x, y}
# ================... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | cec6097d5a4450c7beabf798d927e42792f1a0fa | 1,052 | https://github.com/cdglabs/apparatus/blob/cec6097d5a4450c7beabf798d927e42792f1a0fa/src/View/Canvas.coffee | 85 | 125 |
cdglabs/apparatus:src/View/Canvas.coffee:1:raw_corpus | raw_corpus | _ = require "underscore"
R = require "./R"
Model = require "../Model/Model"
Util = require "../Util/Util"
R.create "Canvas",
contextTypes:
project: Model.Project
hoverManager: R.HoverManager
render: ->
R.div {
className: "Canvas"
# style:
# cursor: @_cursor()
onMouseDown: @_... | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | b5e4f13c547e8b44ccb3756f928610369df52c34 | 1,052 | https://github.com/cdglabs/apparatus/blob/b5e4f13c547e8b44ccb3756f928610369df52c34/src/View/Canvas.coffee | 1 | 40 | ||
cdglabs/apparatus:src/View/Canvas.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require "underscore"
R = require "./R"
Model = require "../Model/Model"
Util = require "../Util/Util"
R.create "Canvas",
contextTypes:
project: Model.Project
hoverManager: R.HoverManager
render: ->
R.div {
className: "Canvas"
# ... | var Model, R, Util, _;
_ = require("underscore");
R = require("./R");
Model = require("../Model/Model");
Util = require("../Util/Util");
R.create("Canvas", {
contextTypes: {
project: Model.Project,
hoverManager: R.HoverManager
},
render: function() {
return R.div({
className: "Canvas",
... | CoffeeScript | JavaScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | b5e4f13c547e8b44ccb3756f928610369df52c34 | 1,052 | https://github.com/cdglabs/apparatus/blob/b5e4f13c547e8b44ccb3756f928610369df52c34/src/View/Canvas.coffee | 1 | 40 |
cdglabs/apparatus:src/View/Canvas.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Model, R, Util, _;
_ = require("underscore");
R = require("./R");
Model = require("../Model/Model");
Util = require("../Util/Util");
R.create("Canvas", {
contextTypes: {
project: Model.Project,
hoverManager: R.HoverManager
},
render: function... | _ = require "underscore"
R = require "./R"
Model = require "../Model/Model"
Util = require "../Util/Util"
R.create "Canvas",
contextTypes:
project: Model.Project
hoverManager: R.HoverManager
render: ->
R.div {
className: "Canvas"
# style:
# cursor: @_cursor()
onMouseDown: @_... | JavaScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | b5e4f13c547e8b44ccb3756f928610369df52c34 | 1,052 | https://github.com/cdglabs/apparatus/blob/b5e4f13c547e8b44ccb3756f928610369df52c34/src/View/Canvas.coffee | 1 | 40 |
cdglabs/apparatus:src/View/Canvas.coffee:1:completion | completion | _ = require "underscore"
R = require "./R"
Model = require "../Model/Model"
Util = require "../Util/Util"
R.create "Canvas",
contextTypes:
project: Model.Project
hoverManager: R.HoverManager
render: ->
R.div {
className: "Canvas"
# style:
# cursor: @_cursor()
onMouseDown: @_... | # onWheel: @_onWheel
},
R.HTMLCanvas {
draw: @_draw
}
_draw: (ctx) ->
project = @context.project
hoverManager = @context.hoverManager
element = @_editingElement()
viewMatrix = @_viewMatrix()
highlight = (graphic) ->
particularElement = graphic.particularElement
... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | b5e4f13c547e8b44ccb3756f928610369df52c34 | 1,052 | https://github.com/cdglabs/apparatus/blob/b5e4f13c547e8b44ccb3756f928610369df52c34/src/View/Canvas.coffee | 1 | 40 |
cdglabs/apparatus:src/View/Canvas.coffee:2:raw_corpus | raw_corpus | # TODO: draw background grid
for graphic in element.allGraphics()
graphic.render(renderOpts)
# TODO: draw control points
_onMouseDown: (mouseDownEvent) ->
el = @getDOMNode()
rect = el.getBoundingClientRect()
x = mouseDownEvent.clientX - rect.left
y = mouseDownEvent.clientY - rect.top... | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | b5e4f13c547e8b44ccb3756f928610369df52c34 | 1,052 | https://github.com/cdglabs/apparatus/blob/b5e4f13c547e8b44ccb3756f928610369df52c34/src/View/Canvas.coffee | 42 | 80 | ||
cdglabs/apparatus:src/View/Canvas.coffee:2:completion | completion | # TODO: draw background grid
for graphic in element.allGraphics()
graphic.render(renderOpts)
# TODO: draw control points
_onMouseDown: (mouseDownEvent) ->
el = @getDOMNode()
rect = el.getBoundingClientRect()
x = mouseDownEvent.clientX - rect.left
y = mouseDownEvent.clientY - rect.top... | hitDetectOpts = {viewMatrix, x, y}
hits = null
for graphic in element.allGraphics()
hits = graphic.hitDetect(hitDetectOpts) ? hits
nextSelected = project.getNextSelected(hits, false)
project.select(nextSelected)
_editingElement: ->
project = @context.project
element = project.editing... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/Canvas.coffee | MIT | b5e4f13c547e8b44ccb3756f928610369df52c34 | 1,052 | https://github.com/cdglabs/apparatus/blob/b5e4f13c547e8b44ccb3756f928610369df52c34/src/View/Canvas.coffee | 42 | 80 |
jianliaoim/talk-os:talk-web/client/app/msg-link.coffee:1:raw_corpus | raw_corpus | React = require 'react'
Immutable = require 'immutable'
PureRenderMixin = require 'react-addons-pure-render-mixin'
mixinMessageHandler = require '../mixin/message-handler'
T = React.PropTypes
div = React.createFactory 'div'
span = React.createFactory 'span'
module.exports = React.createClass
displayName: 'msg-lin... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/msg-link.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/msg-link.coffee | 1 | 42 | ||
jianliaoim/talk-os:talk-web/client/app/msg-link.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
React = require 'react'
Immutable = require 'immutable'
PureRenderMixin = require 'react-addons-pure-render-mixin'
mixinMessageHandler = require '../mixin/message-handler'
T = React.PropTypes
div = React.createFactory 'div'
span = React.createFactory 'span'
m... | var Immutable, PureRenderMixin, React, T, div, mixinMessageHandler, span;
React = require('react');
Immutable = require('immutable');
PureRenderMixin = require('react-addons-pure-render-mixin');
mixinMessageHandler = require('../mixin/message-handler');
T = React.PropTypes;
div = React.createFactory('div');
span... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/msg-link.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/msg-link.coffee | 1 | 42 |
jianliaoim/talk-os:talk-web/client/app/msg-link.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Immutable, PureRenderMixin, React, T, div, mixinMessageHandler, span;
React = require('react');
Immutable = require('immutable');
PureRenderMixin = require('react-addons-pure-render-mixin');
mixinMessageHandler = require('../mixin/message-handler');
T = Re... | React = require 'react'
Immutable = require 'immutable'
PureRenderMixin = require 'react-addons-pure-render-mixin'
mixinMessageHandler = require '../mixin/message-handler'
T = React.PropTypes
div = React.createFactory 'div'
span = React.createFactory 'span'
module.exports = React.createClass
displayName: 'msg-lin... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/msg-link.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/msg-link.coffee | 1 | 42 |
jianliaoim/talk-os:talk-web/client/app/msg-link.coffee:1:completion | completion | React = require 'react'
Immutable = require 'immutable'
PureRenderMixin = require 'react-addons-pure-render-mixin'
mixinMessageHandler = require '../mixin/message-handler'
T = React.PropTypes
div = React.createFactory 'div'
span = React.createFactory 'span'
module.exports = React.createClass
displayName: 'msg-lin... | onIconClick: (event) ->
event.stopPropagation()
window.open @props.message.get('attachments').get(0).getIn(['data', 'redirectUrl'])
render: ->
quote = @props.message.get('attachments').get(0).get('data')
imgStyle =
backgroundImage: if quote.get('faviconUrl') then "url(#{quote.get('faviconUrl')}... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/msg-link.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/msg-link.coffee | 1 | 42 |
buttercoin/buttercoin:lib/ews/websocket_initiator.coffee:1:raw_corpus | raw_corpus | stump = require('stump')
enkihelpers = require('enkihelpers')
EventEmitter = require('eemitterport').EventEmitter
Q = require('q')
Connection = require('./websocket_connection')
# Protocol = require('./protocol')
module.exports = class Initiator extends EventEmitter
constructor: (@options, @parent) ->
if not ... | CoffeeScript | buttercoin/buttercoin | lib/ews/websocket_initiator.coffee | MIT | f1c21018cf2c2241d93adbebde2d77f533877063 | 663 | https://github.com/buttercoin/buttercoin/blob/f1c21018cf2c2241d93adbebde2d77f533877063/lib/ews/websocket_initiator.coffee | 1 | 50 | ||
buttercoin/buttercoin:lib/ews/websocket_initiator.coffee:1:completion | completion | stump = require('stump')
enkihelpers = require('enkihelpers')
EventEmitter = require('eemitterport').EventEmitter
Q = require('q')
Connection = require('./websocket_connection')
# Protocol = require('./protocol')
module.exports = class Initiator extends EventEmitter
constructor: (@options, @parent) ->
if not ... | return @connect_deferred.promise
establish_protocol: (conn) =>
conn.on 'parsed_data', (data) =>
@info 'RESOLVING', data.operation.opid
deferred = @operation_tracker[data.operation.opid]
if deferred
delete @operation_tracker[data.operation.opid]
deferred.resolve(data)
@conne... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/ews/websocket_initiator.coffee | MIT | f1c21018cf2c2241d93adbebde2d77f533877063 | 663 | https://github.com/buttercoin/buttercoin/blob/f1c21018cf2c2241d93adbebde2d77f533877063/lib/ews/websocket_initiator.coffee | 1 | 50 |
buttercoin/buttercoin:lib/ews/websocket_initiator.coffee:1:raw_corpus | raw_corpus | stump = require('stump')
enkihelpers = require('enkihelpers')
EventEmitter = require('eemitterport').EventEmitter
Q = require('q')
Connection = require('./websocket_connection')
# Protocol = require('./protocol')
module.exports = class Initiator extends EventEmitter
constructor: (@options) ->
stump.stumpify(@... | CoffeeScript | buttercoin/buttercoin | lib/ews/websocket_initiator.coffee | MIT | e92571e3fd132351965c7bfd0b0bf8c2cf41fab2 | 663 | https://github.com/buttercoin/buttercoin/blob/e92571e3fd132351965c7bfd0b0bf8c2cf41fab2/lib/ews/websocket_initiator.coffee | 1 | 48 | ||
buttercoin/buttercoin:lib/ews/websocket_initiator.coffee:1:completion | completion | stump = require('stump')
enkihelpers = require('enkihelpers')
EventEmitter = require('eemitterport').EventEmitter
Q = require('q')
Connection = require('./websocket_connection')
# Protocol = require('./protocol')
module.exports = class Initiator extends EventEmitter
constructor: (@options) ->
stump.stumpify(@... | establish_protocol: (conn) =>
conn.on 'parsed_data', (data) =>
@info 'RESOLVING', data.operation.opid
deferred = @operation_tracker[data.operation.opid]
delete @operation_tracker[data.operation.opid]
deferred.resolve(data)
@connect_deferred.resolve(true)
execute_operation: (_operatio... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/ews/websocket_initiator.coffee | MIT | e92571e3fd132351965c7bfd0b0bf8c2cf41fab2 | 663 | https://github.com/buttercoin/buttercoin/blob/e92571e3fd132351965c7bfd0b0bf8c2cf41fab2/lib/ews/websocket_initiator.coffee | 1 | 48 |
buttercoin/buttercoin:lib/ews/websocket_initiator.coffee:1:raw_corpus | raw_corpus | stump = require('stump')
EventEmitter = require('eemitterport').EventEmitter
Q = require('q')
Connection = require('./websocket_connection')
# Protocol = require('./protocol')
module.exports = class Initiator extends EventEmitter
constructor: (@options) ->
stump.stumpify(@, @constructor.name)
@node = null... | CoffeeScript | buttercoin/buttercoin | lib/ews/websocket_initiator.coffee | MIT | 019bc642ea288b3821352e56928346fefe87c1f2 | 663 | https://github.com/buttercoin/buttercoin/blob/019bc642ea288b3821352e56928346fefe87c1f2/lib/ews/websocket_initiator.coffee | 1 | 38 | ||
buttercoin/buttercoin:lib/ews/websocket_initiator.coffee:1:completion | completion | stump = require('stump')
EventEmitter = require('eemitterport').EventEmitter
Q = require('q')
Connection = require('./websocket_connection')
# Protocol = require('./protocol')
module.exports = class Initiator extends EventEmitter
constructor: (@options) ->
stump.stumpify(@, @constructor.name)
@node = null... | @connection.connect( @options.wsconfig )
return @deferred.promise
establish_protocol: (conn) =>
conn.on 'parsed_data', (data) =>
conn.info 'GOT', data
@deferred.resolve(true)
# conn.send_obj( {
# kind: "ADD_DEPOSIT"
# account: "peter"
# amount: "5"
# currency: 'BTC'
... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/ews/websocket_initiator.coffee | MIT | 019bc642ea288b3821352e56928346fefe87c1f2 | 663 | https://github.com/buttercoin/buttercoin/blob/019bc642ea288b3821352e56928346fefe87c1f2/lib/ews/websocket_initiator.coffee | 1 | 38 |
buttercoin/buttercoin:lib/ews/websocket_initiator.coffee:1:raw_corpus | raw_corpus | stump = require('stump')
EventEmitter = require('eemitterport').EventEmitter
Q = require('q')
Connection = require('./websocket_connection')
# Protocol = require('./protocol')
module.exports = class Initiator extends EventEmitter
constructor: (@options) ->
stump.stumpify(@, @constructor.name)
@node = null... | CoffeeScript | buttercoin/buttercoin | lib/ews/websocket_initiator.coffee | MIT | 2cfab4dbadb5903bef1ddde04a89d1f5d3c37474 | 663 | https://github.com/buttercoin/buttercoin/blob/2cfab4dbadb5903bef1ddde04a89d1f5d3c37474/lib/ews/websocket_initiator.coffee | 1 | 37 | ||
buttercoin/buttercoin:lib/ews/websocket_initiator.coffee:1:completion | completion | stump = require('stump')
EventEmitter = require('eemitterport').EventEmitter
Q = require('q')
Connection = require('./websocket_connection')
# Protocol = require('./protocol')
module.exports = class Initiator extends EventEmitter
constructor: (@options) ->
stump.stumpify(@, @constructor.name)
@node = null... | @connection.once 'open', @establish_protocol
@connection.connect( @options.wsconfig )
return @deferred.promise
establish_protocol: (conn) =>
conn.on 'parsed_data', (data) =>
conn.info 'GOT', data
conn.send_obj( {
kind: "ADD_DEPOSIT"
account: "peter"
amount: "5"
currenc... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/ews/websocket_initiator.coffee | MIT | 2cfab4dbadb5903bef1ddde04a89d1f5d3c37474 | 663 | https://github.com/buttercoin/buttercoin/blob/2cfab4dbadb5903bef1ddde04a89d1f5d3c37474/lib/ews/websocket_initiator.coffee | 1 | 37 |
buttercoin/buttercoin:lib/ews/websocket_initiator.coffee:1:raw_corpus | raw_corpus | stump = require('stump')
EventEmitter = require('eemitterport').EventEmitter
Q = require('q')
Connection = require('./websocket_connection')
# Protocol = require('./protocol')
module.exports = class Initiator extends EventEmitter
constructor: (@options) ->
stump.stumpify(@, @constructor.name)
@node = null... | CoffeeScript | buttercoin/buttercoin | lib/ews/websocket_initiator.coffee | MIT | 1a064c0b2d83e4a5854f132c02066a1a436c9eea | 663 | https://github.com/buttercoin/buttercoin/blob/1a064c0b2d83e4a5854f132c02066a1a436c9eea/lib/ews/websocket_initiator.coffee | 1 | 37 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.