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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
kahmali/meteor-restivus:lib/restivus.coffee:4:raw_corpus | raw_corpus | initAuth = ->
###
Add a login endpoint to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
user = {}
if ... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 1ae43df2883fa1b32b2e483e8012f9267f87d236 | 541 | https://github.com/kahmali/meteor-restivus/blob/1ae43df2883fa1b32b2e483e8012f9267f87d236/lib/restivus.coffee | 60 | 109 | ||
kahmali/meteor-restivus:lib/restivus.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
initAuth = ->
###
Add a login endpoint to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email t... | var initAuth;
initAuth = function() {
/*
Add a login endpoint to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
*/
Restivus.add('login', {
authRequired: false
}, {
post: function() {
var auth, context, e, user;
// Grab th... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 1ae43df2883fa1b32b2e483e8012f9267f87d236 | 541 | https://github.com/kahmali/meteor-restivus/blob/1ae43df2883fa1b32b2e483e8012f9267f87d236/lib/restivus.coffee | 60 | 109 |
kahmali/meteor-restivus:lib/restivus.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var initAuth;
initAuth = function() {
/*
Add a login endpoint to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
*/
Restivus.add('login', {
authRequired: false
}, {
post: function... | initAuth = ->
###
Add a login endpoint to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
user = {}
if ... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 1ae43df2883fa1b32b2e483e8012f9267f87d236 | 541 | https://github.com/kahmali/meteor-restivus/blob/1ae43df2883fa1b32b2e483e8012f9267f87d236/lib/restivus.coffee | 60 | 109 |
kahmali/meteor-restivus:lib/restivus.coffee:4:completion | completion | initAuth = ->
###
Add a login endpoint to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
user = {}
if ... | context.user = Meteor.users.findOne
'_id': auth.userId
'services.resume.loginTokens.token': auth.authToken
# Call the login hook with the authenticated user attached
Restivus.config.onLoggedIn.call context
auth.success = true
auth
###
Add a logout endpoint to the API
... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 1ae43df2883fa1b32b2e483e8012f9267f87d236 | 541 | https://github.com/kahmali/meteor-restivus/blob/1ae43df2883fa1b32b2e483e8012f9267f87d236/lib/restivus.coffee | 60 | 109 |
kahmali/meteor-restivus:lib/restivus.coffee:1:raw_corpus | raw_corpus | @Restivus = ->
@routes = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1
prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given path
### | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 7a08fb13c0b8fc733535757a69c172c21e4239e8 | 541 | https://github.com/kahmali/meteor-restivus/blob/7a08fb13c0b8fc733535757a69c172c21e4239e8/lib/restivus.coffee | 1 | 15 | ||
kahmali/meteor-restivus:lib/restivus.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restivus = ->
@routes = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1
prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given path... | this.Restivus = function() {
this.routes = [];
this.config = {
paths: [],
useAuth: false,
apiPath: 'api/',
version: 1,
prettyJson: true,
onLoggedIn: function() {
return {};
},
onLoggedOut: function() {
return {};
}
};
return this.configured = false;
};
/*
Add e... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 7a08fb13c0b8fc733535757a69c172c21e4239e8 | 541 | https://github.com/kahmali/meteor-restivus/blob/7a08fb13c0b8fc733535757a69c172c21e4239e8/lib/restivus.coffee | 1 | 15 |
kahmali/meteor-restivus:lib/restivus.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restivus = function() {
this.routes = [];
this.config = {
paths: [],
useAuth: false,
apiPath: 'api/',
version: 1,
prettyJson: true,
onLoggedIn: function() {
return {};
},
onLoggedOut: function() {
return {};
... | @Restivus = ->
@routes = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1
prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given path
### | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 7a08fb13c0b8fc733535757a69c172c21e4239e8 | 541 | https://github.com/kahmali/meteor-restivus/blob/7a08fb13c0b8fc733535757a69c172c21e4239e8/lib/restivus.coffee | 1 | 15 |
kahmali/meteor-restivus:lib/restivus.coffee:1:completion | completion | @Restivus = ->
@routes = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1 | prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given path
### | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 7a08fb13c0b8fc733535757a69c172c21e4239e8 | 541 | https://github.com/kahmali/meteor-restivus/blob/7a08fb13c0b8fc733535757a69c172c21e4239e8/lib/restivus.coffee | 1 | 15 |
kahmali/meteor-restivus:lib/restivus.coffee:1:raw_corpus | raw_corpus | @Restivus = ->
@endpoints = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1
prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given path
### | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 07dd05317c512dc70cbca5c7080e4c9eadff986a | 541 | https://github.com/kahmali/meteor-restivus/blob/07dd05317c512dc70cbca5c7080e4c9eadff986a/lib/restivus.coffee | 1 | 15 | ||
kahmali/meteor-restivus:lib/restivus.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restivus = ->
@endpoints = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1
prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given p... | this.Restivus = function() {
this.endpoints = [];
this.config = {
paths: [],
useAuth: false,
apiPath: 'api/',
version: 1,
prettyJson: true,
onLoggedIn: function() {
return {};
},
onLoggedOut: function() {
return {};
}
};
return this.configured = false;
};
/*
Ad... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 07dd05317c512dc70cbca5c7080e4c9eadff986a | 541 | https://github.com/kahmali/meteor-restivus/blob/07dd05317c512dc70cbca5c7080e4c9eadff986a/lib/restivus.coffee | 1 | 15 |
kahmali/meteor-restivus:lib/restivus.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restivus = function() {
this.endpoints = [];
this.config = {
paths: [],
useAuth: false,
apiPath: 'api/',
version: 1,
prettyJson: true,
onLoggedIn: function() {
return {};
},
onLoggedOut: function() {
return {};
... | @Restivus = ->
@endpoints = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1
prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given path
### | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 07dd05317c512dc70cbca5c7080e4c9eadff986a | 541 | https://github.com/kahmali/meteor-restivus/blob/07dd05317c512dc70cbca5c7080e4c9eadff986a/lib/restivus.coffee | 1 | 15 |
kahmali/meteor-restivus:lib/restivus.coffee:1:completion | completion | @Restivus = ->
@endpoints = []
@config =
paths: []
useAuth: false
apiPath: 'api/'
version: 1 | prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given path
### | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 07dd05317c512dc70cbca5c7080e4c9eadff986a | 541 | https://github.com/kahmali/meteor-restivus/blob/07dd05317c512dc70cbca5c7080e4c9eadff986a/lib/restivus.coffee | 1 | 15 |
kahmali/meteor-restivus:lib/restivus.coffee:2:raw_corpus | raw_corpus | @Restivus.prototype.add = (path, options, methods) ->
# Create a new endpoint and add it to our list of existing endpoints
endpoint = new Endpoint(this, path, options, methods)
@endpoints.push(endpoint)
# Don't add the endpoint to the API until the API has been configured
endpoint.addToApi() if @configured
... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 07dd05317c512dc70cbca5c7080e4c9eadff986a | 541 | https://github.com/kahmali/meteor-restivus/blob/07dd05317c512dc70cbca5c7080e4c9eadff986a/lib/restivus.coffee | 16 | 29 | ||
kahmali/meteor-restivus:lib/restivus.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restivus.prototype.add = (path, options, methods) ->
# Create a new endpoint and add it to our list of existing endpoints
endpoint = new Endpoint(this, path, options, methods)
@endpoints.push(endpoint)
# Don't add the endpoint to the API until the API h... | this.Restivus.prototype.add = function(path, options, methods) {
var endpoint;
// Create a new endpoint and add it to our list of existing endpoints
endpoint = new Endpoint(this, path, options, methods);
this.endpoints.push(endpoint);
if (this.configured) {
// Don't add the endpoint to the API until the A... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 07dd05317c512dc70cbca5c7080e4c9eadff986a | 541 | https://github.com/kahmali/meteor-restivus/blob/07dd05317c512dc70cbca5c7080e4c9eadff986a/lib/restivus.coffee | 16 | 29 |
kahmali/meteor-restivus:lib/restivus.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restivus.prototype.add = function(path, options, methods) {
var endpoint;
// Create a new endpoint and add it to our list of existing endpoints
endpoint = new Endpoint(this, path, options, methods);
this.endpoints.push(endpoint);
if (this.configured)... | @Restivus.prototype.add = (path, options, methods) ->
# Create a new endpoint and add it to our list of existing endpoints
endpoint = new Endpoint(this, path, options, methods)
@endpoints.push(endpoint)
# Don't add the endpoint to the API until the API has been configured
endpoint.addToApi() if @configured
... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 07dd05317c512dc70cbca5c7080e4c9eadff986a | 541 | https://github.com/kahmali/meteor-restivus/blob/07dd05317c512dc70cbca5c7080e4c9eadff986a/lib/restivus.coffee | 16 | 29 |
kahmali/meteor-restivus:lib/restivus.coffee:2:completion | completion | @Restivus.prototype.add = (path, options, methods) ->
# Create a new endpoint and add it to our list of existing endpoints
endpoint = new Endpoint(this, path, options, methods)
@endpoints.push(endpoint)
# Don't add the endpoint to the API until the API has been configured
endpoint.addToApi() if @configured | ###
Configure the ReST API
Can only be called once.
### | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 07dd05317c512dc70cbca5c7080e4c9eadff986a | 541 | https://github.com/kahmali/meteor-restivus/blob/07dd05317c512dc70cbca5c7080e4c9eadff986a/lib/restivus.coffee | 16 | 29 |
kahmali/meteor-restivus:lib/restivus.coffee:3:raw_corpus | raw_corpus | @Restivus.prototype.configure = (config) ->
if @configured
throw new Error 'Restivus.configure() can only be called once'
@configured = true
# Normalize the API path
if config.apiPath[0] is '/'
config.apiPath = config.apiPath.slice 1
if config.apiPath[-1] isnt '/'
config.apiPath = config.apiPath... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 07dd05317c512dc70cbca5c7080e4c9eadff986a | 541 | https://github.com/kahmali/meteor-restivus/blob/07dd05317c512dc70cbca5c7080e4c9eadff986a/lib/restivus.coffee | 30 | 59 | ||
kahmali/meteor-restivus:lib/restivus.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restivus.prototype.configure = (config) ->
if @configured
throw new Error 'Restivus.configure() can only be called once'
@configured = true
# Normalize the API path
if config.apiPath[0] is '/'
config.apiPath = config.apiPath.slice 1
if config... | this.Restivus.prototype.configure = function(config) {
if (this.configured) {
throw new Error('Restivus.configure() can only be called once');
}
this.configured = true;
// Normalize the API path
if (config.apiPath[0] === '/') {
config.apiPath = config.apiPath.slice(1);
}
if (config.apiPath[-1] !==... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 07dd05317c512dc70cbca5c7080e4c9eadff986a | 541 | https://github.com/kahmali/meteor-restivus/blob/07dd05317c512dc70cbca5c7080e4c9eadff986a/lib/restivus.coffee | 30 | 59 |
kahmali/meteor-restivus:lib/restivus.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restivus.prototype.configure = function(config) {
if (this.configured) {
throw new Error('Restivus.configure() can only be called once');
}
this.configured = true;
// Normalize the API path
if (config.apiPath[0] === '/') {
config.apiPath = co... | @Restivus.prototype.configure = (config) ->
if @configured
throw new Error 'Restivus.configure() can only be called once'
@configured = true
# Normalize the API path
if config.apiPath[0] is '/'
config.apiPath = config.apiPath.slice 1
if config.apiPath[-1] isnt '/'
config.apiPath = config.apiPath... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 07dd05317c512dc70cbca5c7080e4c9eadff986a | 541 | https://github.com/kahmali/meteor-restivus/blob/07dd05317c512dc70cbca5c7080e4c9eadff986a/lib/restivus.coffee | 30 | 59 |
kahmali/meteor-restivus:lib/restivus.coffee:3:completion | completion | @Restivus.prototype.configure = (config) ->
if @configured
throw new Error 'Restivus.configure() can only be called once'
@configured = true
# Normalize the API path
if config.apiPath[0] is '/'
config.apiPath = config.apiPath.slice 1
if config.apiPath[-1] isnt '/'
config.apiPath = config.apiPath... | # Add any existing endpoints to the API now that it's configured
_.each @endpoints, (endpoint) -> endpoint.addToApi()
# Add default login and logout endpoints if auth is configured
if @config.useAuth
initAuth()
console.log "Restivus configured at #{@config.apiPath} with authentication"
else
console... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 07dd05317c512dc70cbca5c7080e4c9eadff986a | 541 | https://github.com/kahmali/meteor-restivus/blob/07dd05317c512dc70cbca5c7080e4c9eadff986a/lib/restivus.coffee | 30 | 59 |
kahmali/meteor-restivus:lib/restivus.coffee:4:raw_corpus | raw_corpus | initAuth = ->
###
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
user = {}
if @b... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 07dd05317c512dc70cbca5c7080e4c9eadff986a | 541 | https://github.com/kahmali/meteor-restivus/blob/07dd05317c512dc70cbca5c7080e4c9eadff986a/lib/restivus.coffee | 60 | 109 | ||
kahmali/meteor-restivus:lib/restivus.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
initAuth = ->
###
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email tha... | var initAuth;
initAuth = function() {
/*
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
*/
Restivus.add('login', {
authRequired: false
}, {
post: function() {
var auth, context, e, user;
// Grab the ... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 07dd05317c512dc70cbca5c7080e4c9eadff986a | 541 | https://github.com/kahmali/meteor-restivus/blob/07dd05317c512dc70cbca5c7080e4c9eadff986a/lib/restivus.coffee | 60 | 109 |
kahmali/meteor-restivus:lib/restivus.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var initAuth;
initAuth = function() {
/*
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
*/
Restivus.add('login', {
authRequired: false
}, {
post: function()... | initAuth = ->
###
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
user = {}
if @b... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 07dd05317c512dc70cbca5c7080e4c9eadff986a | 541 | https://github.com/kahmali/meteor-restivus/blob/07dd05317c512dc70cbca5c7080e4c9eadff986a/lib/restivus.coffee | 60 | 109 |
kahmali/meteor-restivus:lib/restivus.coffee:4:completion | completion | initAuth = ->
###
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
user = {}
if @b... | context.user = Meteor.users.findOne
'_id': auth.userId
'services.resume.loginTokens.token': auth.authToken
# Call the login hook with the authenticated user attached
Restivus.config.onLoggedIn.call context
auth.success = true
auth
###
Add a logout method to the API
... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 07dd05317c512dc70cbca5c7080e4c9eadff986a | 541 | https://github.com/kahmali/meteor-restivus/blob/07dd05317c512dc70cbca5c7080e4c9eadff986a/lib/restivus.coffee | 60 | 109 |
kahmali/meteor-restivus:lib/restivus.coffee:1:raw_corpus | raw_corpus | @Restivus = ->
@endpoints = []
@config =
paths: []
useAuth: false
apiPath: '/api'
version: 1
prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given path
### | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/restivus.coffee | 1 | 15 | ||
kahmali/meteor-restivus:lib/restivus.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restivus = ->
@endpoints = []
@config =
paths: []
useAuth: false
apiPath: '/api'
version: 1
prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given p... | this.Restivus = function() {
this.endpoints = [];
this.config = {
paths: [],
useAuth: false,
apiPath: '/api',
version: 1,
prettyJson: true,
onLoggedIn: function() {
return {};
},
onLoggedOut: function() {
return {};
}
};
return this.configured = false;
};
/*
Ad... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/restivus.coffee | 1 | 15 |
kahmali/meteor-restivus:lib/restivus.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restivus = function() {
this.endpoints = [];
this.config = {
paths: [],
useAuth: false,
apiPath: '/api',
version: 1,
prettyJson: true,
onLoggedIn: function() {
return {};
},
onLoggedOut: function() {
return {};
... | @Restivus = ->
@endpoints = []
@config =
paths: []
useAuth: false
apiPath: '/api'
version: 1
prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given path
### | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/restivus.coffee | 1 | 15 |
kahmali/meteor-restivus:lib/restivus.coffee:1:completion | completion | @Restivus = ->
@endpoints = []
@config =
paths: []
useAuth: false
apiPath: '/api'
version: 1 | prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
@configured = false
###
Add endpoints for the given HTTP methods at the given path
### | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/restivus.coffee | 1 | 15 |
kahmali/meteor-restivus:lib/restivus.coffee:3:raw_corpus | raw_corpus | @Restivus.prototype.configure = (config) ->
if @configured
throw new Error 'Restivus.configure() can only be called once'
@configured = true
if config.apiPath[-1] != '/'
config.apiPath = config.apiPath + '/'
# Configure API with the given options
_.extend @config, config
# Add any existing endpo... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/restivus.coffee | 30 | 52 | ||
kahmali/meteor-restivus:lib/restivus.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restivus.prototype.configure = (config) ->
if @configured
throw new Error 'Restivus.configure() can only be called once'
@configured = true
if config.apiPath[-1] != '/'
config.apiPath = config.apiPath + '/'
# Configure API with the given optio... | this.Restivus.prototype.configure = function(config) {
if (this.configured) {
throw new Error('Restivus.configure() can only be called once');
}
this.configured = true;
if (config.apiPath[-1] !== '/') {
config.apiPath = config.apiPath + '/';
}
// Configure API with the given options
_.extend(this.... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/restivus.coffee | 30 | 52 |
kahmali/meteor-restivus:lib/restivus.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restivus.prototype.configure = function(config) {
if (this.configured) {
throw new Error('Restivus.configure() can only be called once');
}
this.configured = true;
if (config.apiPath[-1] !== '/') {
config.apiPath = config.apiPath + '/';
}
/... | @Restivus.prototype.configure = (config) ->
if @configured
throw new Error 'Restivus.configure() can only be called once'
@configured = true
if config.apiPath[-1] != '/'
config.apiPath = config.apiPath + '/'
# Configure API with the given options
_.extend @config, config
# Add any existing endpo... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/restivus.coffee | 30 | 52 |
kahmali/meteor-restivus:lib/restivus.coffee:3:completion | completion | @Restivus.prototype.configure = (config) ->
if @configured
throw new Error 'Restivus.configure() can only be called once'
@configured = true
if config.apiPath[-1] != '/'
config.apiPath = config.apiPath + '/'
# Configure API with the given options
_.extend @config, config | # Add any existing endpoints to the API now that it's configured
_.each @endpoints, (endpoint) -> endpoint.addToApi()
# Add default login and logout endpoints if auth is configured
if @config.useAuth
initAuth()
###
Add /login and /logout endpoints to the API
### | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/restivus.coffee | 30 | 52 |
kahmali/meteor-restivus:lib/restivus.coffee:4:raw_corpus | raw_corpus | initAuth = ->
###
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
user = {}
if @p... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/restivus.coffee | 53 | 102 | ||
kahmali/meteor-restivus:lib/restivus.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
initAuth = ->
###
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email tha... | var initAuth;
initAuth = function() {
/*
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
*/
Restivus.add('login', {
authRequired: false
}, {
post: function() {
var auth, context, e, user;
// Grab the ... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/restivus.coffee | 53 | 102 |
kahmali/meteor-restivus:lib/restivus.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var initAuth;
initAuth = function() {
/*
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
*/
Restivus.add('login', {
authRequired: false
}, {
post: function()... | initAuth = ->
###
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
user = {}
if @p... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/restivus.coffee | 53 | 102 |
kahmali/meteor-restivus:lib/restivus.coffee:4:completion | completion | initAuth = ->
###
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
user = {}
if @p... | context.user = Meteor.users.findOne
'_id': auth.userId
'services.resume.loginTokens.token': auth.authToken
# Call the login hook with the authenticated user attached
Restivus.config.onLoggedIn.call context
auth.success = true
auth
###
Add a logout method to the API
... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/restivus.coffee | 53 | 102 |
kahmali/meteor-restivus:lib/restivus.coffee:4:raw_corpus | raw_corpus | initAuth = ->
###
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
user = {}
if @p... | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 52e3d9195a6d19afb4176cf82457b572ddd27951 | 541 | https://github.com/kahmali/meteor-restivus/blob/52e3d9195a6d19afb4176cf82457b572ddd27951/lib/restivus.coffee | 53 | 102 | ||
kahmali/meteor-restivus:lib/restivus.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
initAuth = ->
###
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email tha... | var initAuth;
initAuth = function() {
/*
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
*/
Restivus.add('login', {
authRequired: false
}, {
post: function() {
var auth, context, e, user;
// Grab the ... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 52e3d9195a6d19afb4176cf82457b572ddd27951 | 541 | https://github.com/kahmali/meteor-restivus/blob/52e3d9195a6d19afb4176cf82457b572ddd27951/lib/restivus.coffee | 53 | 102 |
kahmali/meteor-restivus:lib/restivus.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var initAuth;
initAuth = function() {
/*
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
*/
Restivus.add('login', {
authRequired: false
}, {
post: function()... | initAuth = ->
###
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
user = {}
if @p... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 52e3d9195a6d19afb4176cf82457b572ddd27951 | 541 | https://github.com/kahmali/meteor-restivus/blob/52e3d9195a6d19afb4176cf82457b572ddd27951/lib/restivus.coffee | 53 | 102 |
kahmali/meteor-restivus:lib/restivus.coffee:4:completion | completion | initAuth = ->
###
Add a login method to the API
After the user is logged in, the onLoggedIn hook is called (see Restfully.configure() for adding hook).
###
Restivus.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
user = {}
if @p... | context.user = Meteor.users.findOne
'_id': auth.userId
'services.resume.loginTokens.token': auth.loginToken
# Call the login hook with the authenticated user attached
Restivus.config.onLoggedIn.call context
auth.success = true
auth
###
Add a logout method to the API
... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/restivus.coffee | MIT | 52e3d9195a6d19afb4176cf82457b572ddd27951 | 541 | https://github.com/kahmali/meteor-restivus/blob/52e3d9195a6d19afb4176cf82457b572ddd27951/lib/restivus.coffee | 53 | 102 |
jianliaoim/talk-os:talk-api2x/server/controllers/guest/message.coffee:1:raw_corpus | raw_corpus | async = require 'async'
limbo = require 'limbo'
Err = require 'err1st'
util = require '../../util'
app = require '../../server'
{
MessageModel
RoomModel
MemberModel
} = limbo.use 'talk'
module.exports = messageController = app.controller 'guest/message', ->
@ensure '_roomId', only: 'read'
###*
* Read ... | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/controllers/guest/message.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/guest/message.coffee | 1 | 43 | ||
jianliaoim/talk-os:talk-api2x/server/controllers/guest/message.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
async = require 'async'
limbo = require 'limbo'
Err = require 'err1st'
util = require '../../util'
app = require '../../server'
{
MessageModel
RoomModel
MemberModel
} = limbo.use 'talk'
module.exports = messageController = app.controller 'guest/message',... | var Err, MemberModel, MessageModel, RoomModel, app, async, limbo, messageController, util;
async = require('async');
limbo = require('limbo');
Err = require('err1st');
util = require('../../util');
app = require('../../server');
({MessageModel, RoomModel, MemberModel} = limbo.use('talk'));
module.exports = messa... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/server/controllers/guest/message.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/guest/message.coffee | 1 | 43 |
jianliaoim/talk-os:talk-api2x/server/controllers/guest/message.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Err, MemberModel, MessageModel, RoomModel, app, async, limbo, messageController, util;
async = require('async');
limbo = require('limbo');
Err = require('err1st');
util = require('../../util');
app = require('../../server');
({MessageModel, RoomModel, Mem... | async = require 'async'
limbo = require 'limbo'
Err = require 'err1st'
util = require '../../util'
app = require '../../server'
{
MessageModel
RoomModel
MemberModel
} = limbo.use 'talk'
module.exports = messageController = app.controller 'guest/message', ->
@ensure '_roomId', only: 'read'
###*
* Read ... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/controllers/guest/message.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/guest/message.coffee | 1 | 43 |
jianliaoim/talk-os:talk-api2x/server/controllers/guest/message.coffee:1:completion | completion | async = require 'async'
limbo = require 'limbo'
Err = require 'err1st'
util = require '../../util'
app = require '../../server'
{
MessageModel
RoomModel
MemberModel
} = limbo.use 'talk'
module.exports = messageController = app.controller 'guest/message', ->
@ensure '_roomId', only: 'read'
###*
* Read ... | @action 'read', (req, res, callback) ->
{_roomId, _sessionUserId} = req.get()
async.waterfall [
(next) ->
MemberModel.findOne
room: _roomId
user: _sessionUserId
isQuit: false
.populate 'room'
.exec next
(member, next) ->
return next(ne... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/controllers/guest/message.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/guest/message.coffee | 1 | 43 |
mojotech/pioneer:test/integration/widgets/myFrame.coffee:1:raw_corpus | raw_corpus | module.exports = ->
world = this
@widgets = @Widgets || {}
@Widgets.Myframe = @Widget.Iframe.extend
getParentText: (selector) ->
page = new world.Widget({root: 'html'})
page.read(selector) | CoffeeScript | mojotech/pioneer | test/integration/widgets/myFrame.coffee | MIT | 5a0c6a3758504e10469f9563c85db6460419bcfc | 523 | https://github.com/mojotech/pioneer/blob/5a0c6a3758504e10469f9563c85db6460419bcfc/test/integration/widgets/myFrame.coffee | 1 | 8 | ||
mojotech/pioneer:test/integration/widgets/myFrame.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = ->
world = this
@widgets = @Widgets || {}
@Widgets.Myframe = @Widget.Iframe.extend
getParentText: (selector) ->
page = new world.Widget({root: 'html'})
page.read(selector)
``` | module.exports = function() {
var world;
world = this;
this.widgets = this.Widgets || {};
return this.Widgets.Myframe = this.Widget.Iframe.extend({
getParentText: function(selector) {
var page;
page = new world.Widget({
root: 'html'
});
return page.read(selector);
}
});... | CoffeeScript | JavaScript | mojotech/pioneer | test/integration/widgets/myFrame.coffee | MIT | 5a0c6a3758504e10469f9563c85db6460419bcfc | 523 | https://github.com/mojotech/pioneer/blob/5a0c6a3758504e10469f9563c85db6460419bcfc/test/integration/widgets/myFrame.coffee | 1 | 8 |
mojotech/pioneer:test/integration/widgets/myFrame.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = function() {
var world;
world = this;
this.widgets = this.Widgets || {};
return this.Widgets.Myframe = this.Widget.Iframe.extend({
getParentText: function(selector) {
var page;
page = new world.Widget({
root: 'html'
... | module.exports = ->
world = this
@widgets = @Widgets || {}
@Widgets.Myframe = @Widget.Iframe.extend
getParentText: (selector) ->
page = new world.Widget({root: 'html'})
page.read(selector) | JavaScript | CoffeeScript | mojotech/pioneer | test/integration/widgets/myFrame.coffee | MIT | 5a0c6a3758504e10469f9563c85db6460419bcfc | 523 | https://github.com/mojotech/pioneer/blob/5a0c6a3758504e10469f9563c85db6460419bcfc/test/integration/widgets/myFrame.coffee | 1 | 8 |
mojotech/pioneer:test/integration/widgets/myFrame.coffee:1:completion | completion | module.exports = ->
world = this
@widgets = @Widgets || {} | @Widgets.Myframe = @Widget.Iframe.extend
getParentText: (selector) ->
page = new world.Widget({root: 'html'})
page.read(selector) | CoffeeScript | CoffeeScript | mojotech/pioneer | test/integration/widgets/myFrame.coffee | MIT | 5a0c6a3758504e10469f9563c85db6460419bcfc | 523 | https://github.com/mojotech/pioneer/blob/5a0c6a3758504e10469f9563c85db6460419bcfc/test/integration/widgets/myFrame.coffee | 1 | 8 |
Pagedraw/pagedraw:test/unit/doc_tests.coffee:1:raw_corpus | raw_corpus | assert = (condition) ->
chai.assert(condition(), condition.toString())
##
{isEqual} = require('../../src/model')
{Doc} = require '../../src/doc'
TextBlock = require '../../src/blocks/text-block'
LayoutBlock = require '../../src/blocks/layout-block'
{Dynamicable} = require '../../src/dynamicable'
# load blocks
r... | CoffeeScript | Pagedraw/pagedraw | test/unit/doc_tests.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/test/unit/doc_tests.coffee | 10 | 59 | ||
Pagedraw/pagedraw:test/unit/doc_tests.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
assert = (condition) ->
chai.assert(condition(), condition.toString())
##
{isEqual} = require('../../src/model')
{Doc} = require '../../src/doc'
TextBlock = require '../../src/blocks/text-block'
LayoutBlock = require '../../src/blocks/layout-block'
{Dynami... | var Doc, Dynamicable, LayoutBlock, TextBlock, assert, isEqual;
assert = function(condition) {
return chai.assert(condition(), condition.toString());
};
//#
({isEqual} = require('../../src/model'));
({Doc} = require('../../src/doc'));
TextBlock = require('../../src/blocks/text-block');
LayoutBlock = require('../.... | CoffeeScript | JavaScript | Pagedraw/pagedraw | test/unit/doc_tests.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/test/unit/doc_tests.coffee | 10 | 59 |
Pagedraw/pagedraw:test/unit/doc_tests.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Doc, Dynamicable, LayoutBlock, TextBlock, assert, isEqual;
assert = function(condition) {
return chai.assert(condition(), condition.toString());
};
//#
({isEqual} = require('../../src/model'));
({Doc} = require('../../src/doc'));
TextBlock = require('../.... | assert = (condition) ->
chai.assert(condition(), condition.toString())
##
{isEqual} = require('../../src/model')
{Doc} = require '../../src/doc'
TextBlock = require '../../src/blocks/text-block'
LayoutBlock = require '../../src/blocks/layout-block'
{Dynamicable} = require '../../src/dynamicable'
# load blocks
r... | JavaScript | CoffeeScript | Pagedraw/pagedraw | test/unit/doc_tests.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/test/unit/doc_tests.coffee | 10 | 59 |
Pagedraw/pagedraw:test/unit/doc_tests.coffee:1:completion | completion | assert = (condition) ->
chai.assert(condition(), condition.toString())
##
{isEqual} = require('../../src/model')
{Doc} = require '../../src/doc'
TextBlock = require '../../src/blocks/text-block'
LayoutBlock = require '../../src/blocks/layout-block'
{Dynamicable} = require '../../src/dynamicable'
# load blocks
r... | [name, JSON.parse(contents)]
).then (docset_pairs) ->
docset = _l.fromPairs(docset_pairs)
it "deserializes docs", ->
_l.mapValues docset, (doc_json) ->
chai.assert.doesNotThrow -> Doc.deserialize doc_json
it "deserialized docs have blocks", ->
_l.mapValu... | CoffeeScript | CoffeeScript | Pagedraw/pagedraw | test/unit/doc_tests.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/test/unit/doc_tests.coffee | 10 | 59 |
Pagedraw/pagedraw:test/unit/doc_tests.coffee:2:raw_corpus | raw_corpus | it "rebases with single block", ->
base = new Doc()
base.addBlock(new TextBlock(top: 10, left: 10, width: 40, height: 50, textContent: (Dynamicable String).from 'Hello'))
left = Doc.deserialize base.serialize()
right = Doc.deserialize base.serialize()
# changes content
l... | CoffeeScript | Pagedraw/pagedraw | test/unit/doc_tests.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/test/unit/doc_tests.coffee | 60 | 109 | ||
Pagedraw/pagedraw:test/unit/doc_tests.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it "rebases with single block", ->
base = new Doc()
base.addBlock(new TextBlock(top: 10, left: 10, width: 40, height: 50, textContent: (Dynamicable String).from 'Hello'))
left = Doc.deserialize base.serialize()
right = Doc.deserial... | it("rebases with single block", function() {
var base, expected, left, rebased, right;
base = new Doc();
base.addBlock(new TextBlock({
top: 10,
left: 10,
width: 40,
height: 50,
textContent: (Dynamicable(String)).from('Hello')
}));
left = Doc.deserialize(base.serialize());
right = Doc.des... | CoffeeScript | JavaScript | Pagedraw/pagedraw | test/unit/doc_tests.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/test/unit/doc_tests.coffee | 60 | 109 |
Pagedraw/pagedraw:test/unit/doc_tests.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it("rebases with single block", function() {
var base, expected, left, rebased, right;
base = new Doc();
base.addBlock(new TextBlock({
top: 10,
left: 10,
width: 40,
height: 50,
textContent: (Dynamicable(String)).from('Hello')
}));
left... | it "rebases with single block", ->
base = new Doc()
base.addBlock(new TextBlock(top: 10, left: 10, width: 40, height: 50, textContent: (Dynamicable String).from 'Hello'))
left = Doc.deserialize base.serialize()
right = Doc.deserialize base.serialize()
# changes content
l... | JavaScript | CoffeeScript | Pagedraw/pagedraw | test/unit/doc_tests.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/test/unit/doc_tests.coffee | 60 | 109 |
Pagedraw/pagedraw:test/unit/doc_tests.coffee:2:completion | completion | it "rebases with single block", ->
base = new Doc()
base.addBlock(new TextBlock(top: 10, left: 10, width: 40, height: 50, textContent: (Dynamicable String).from 'Hello'))
left = Doc.deserialize base.serialize()
right = Doc.deserialize base.serialize()
# changes content
l... | it "rebases with multiple blocks", ->
base = new Doc()
text_block = new TextBlock(top: 10, left: 20, height: 40, width: 50, textContent: (Dynamicable String).from('Hello'))
layout_block = new LayoutBlock(top: 100, left: 100, height: 100, width: 100)
base.addBlock(block) for block in [tex... | CoffeeScript | CoffeeScript | Pagedraw/pagedraw | test/unit/doc_tests.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/test/unit/doc_tests.coffee | 60 | 109 |
Pagedraw/pagedraw:test/unit/doc_tests.coffee:3:raw_corpus | raw_corpus | it "rebases where left deletes a block changed by right", ->
base = new Doc()
text_block = new TextBlock(top: 10, left: 20, height: 40, width: 50, textContent: (Dynamicable String).from('Hello'))
layout_block = new LayoutBlock(top: 100, left: 100, height: 100, width: 100)
base.addBlock(b... | CoffeeScript | Pagedraw/pagedraw | test/unit/doc_tests.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/test/unit/doc_tests.coffee | 110 | 157 | ||
Pagedraw/pagedraw:test/unit/doc_tests.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it "rebases where left deletes a block changed by right", ->
base = new Doc()
text_block = new TextBlock(top: 10, left: 20, height: 40, width: 50, textContent: (Dynamicable String).from('Hello'))
layout_block = new LayoutBlock(top: 100, le... | it("rebases where left deletes a block changed by right", function() {
var base, block, expected, i, layout_block, left, len, rebased, ref, right, text_block;
base = new Doc();
text_block = new TextBlock({
top: 10,
left: 20,
height: 40,
width: 50,
textContent: (Dynamicable(String)).from('Hello... | CoffeeScript | JavaScript | Pagedraw/pagedraw | test/unit/doc_tests.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/test/unit/doc_tests.coffee | 110 | 157 |
Pagedraw/pagedraw:test/unit/doc_tests.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it("rebases where left deletes a block changed by right", function() {
var base, block, expected, i, layout_block, left, len, rebased, ref, right, text_block;
base = new Doc();
text_block = new TextBlock({
top: 10,
left: 20,
height: 40,
width:... | it "rebases where left deletes a block changed by right", ->
base = new Doc()
text_block = new TextBlock(top: 10, left: 20, height: 40, width: 50, textContent: (Dynamicable String).from('Hello'))
layout_block = new LayoutBlock(top: 100, left: 100, height: 100, width: 100)
base.addBlock(b... | JavaScript | CoffeeScript | Pagedraw/pagedraw | test/unit/doc_tests.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/test/unit/doc_tests.coffee | 110 | 157 |
Pagedraw/pagedraw:test/unit/doc_tests.coffee:3:completion | completion | it "rebases where left deletes a block changed by right", ->
base = new Doc()
text_block = new TextBlock(top: 10, left: 20, height: 40, width: 50, textContent: (Dynamicable String).from('Hello'))
layout_block = new LayoutBlock(top: 100, left: 100, height: 100, width: 100)
base.addBlock(b... | it "rebases where right deletes a block changed by left", ->
base = new Doc()
text_block = new TextBlock(top: 10, left: 20, height: 40, width: 50, textContent: (Dynamicable String).from('Hello'))
layout_block = new LayoutBlock(top: 100, left: 100, height: 100, width: 100)
base.addBlock(b... | CoffeeScript | CoffeeScript | Pagedraw/pagedraw | test/unit/doc_tests.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/test/unit/doc_tests.coffee | 110 | 157 |
gss/engine:src/properties/Styles.coffee:4:raw_corpus | raw_corpus | style: ['none', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset', 'none']
color: ['Color']
]]
for type in ['width', 'color', 'style']
(Styles::['border-' + type] ||= [[{'pad'}]])[0][+
0]['border-' + side + '-' + type] =
Styles::border[0][side][0][0][type]... | CoffeeScript | gss/engine | src/properties/Styles.coffee | MIT | e0d31eda3ebf8554204221731fbcfaa35d711a39 | 2,854 | https://github.com/gss/engine/blob/e0d31eda3ebf8554204221731fbcfaa35d711a39/src/properties/Styles.coffee | 151 | 165 | ||
gss/engine:src/properties/Styles.coffee:4:completion | completion | style: ['none', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset', 'none']
color: ['Color']
]]
for type in ['width', 'color', 'style']
(Styles::['border-' + type] ||= [[{'pad'}]])[0][+
0]['border-' + side + '-' + type] =
Styles::border[0][side][0][0][type] | unless index % 2
for i in [3 ... 0] by -2
prop = 'border-' + side + '-' + (sides[i]) + '-radius'
Styles::[prop] = ['Length', 'none']
(Styles::['border-radius'] ||= [{'pad'}])[0][prop] = ['Length', 'none']
Command = require('../Command') | CoffeeScript | CoffeeScript | gss/engine | src/properties/Styles.coffee | MIT | e0d31eda3ebf8554204221731fbcfaa35d711a39 | 2,854 | https://github.com/gss/engine/blob/e0d31eda3ebf8554204221731fbcfaa35d711a39/src/properties/Styles.coffee | 151 | 165 |
gss/engine:src/properties/Styles.coffee:1:raw_corpus | raw_corpus | class Styles
transform: [[
-> mat4.create(),
'Matrix'
]]
animation: [[[
name: ['none', 'String']
duration: ['time']
delay: ['time']
direction: ['normal', 'reverse', 'alternate']
'timing-function': ['timing'],
'iteration-count': [1, 'infin... | CoffeeScript | gss/engine | src/properties/Styles.coffee | MIT | d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0 | 2,854 | https://github.com/gss/engine/blob/d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0/src/properties/Styles.coffee | 1 | 50 | ||
gss/engine:src/properties/Styles.coffee:3:raw_corpus | raw_corpus | list:
style: [
type: ['disc', 'circle', 'square', 'decimal', 'decimal-leading-zero', 'lower-roman', 'upper-roman',
'lower-greek', 'lower-latin', 'upper-latin', 'armenian', 'georgian', 'lower-alpha', 'none',
'upper-alpha'],
image: ['none'... | CoffeeScript | gss/engine | src/properties/Styles.coffee | MIT | d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0 | 2,854 | https://github.com/gss/engine/blob/d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0/src/properties/Styles.coffee | 101 | 150 | ||
gss/engine:src/properties/Styles.coffee:3:completion | completion | list:
style: [
type: ['disc', 'circle', 'square', 'decimal', 'decimal-leading-zero', 'lower-roman', 'upper-roman',
'lower-greek', 'lower-latin', 'upper-latin', 'armenian', 'georgian', 'lower-alpha', 'none',
'upper-alpha'],
image: ['none'... | 'overflow-x': ['visible', 'hidden', 'scroll', 'auto']
'overflow-y': ['visible', 'hidden', 'scroll', 'auto']
position: ['static', 'relative', 'absolute', 'fixed', 'sticky']
top: ['Length', 'Percentage', 'auto']
left: ['Length', 'Percentage', 'auto']... | CoffeeScript | CoffeeScript | gss/engine | src/properties/Styles.coffee | MIT | d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0 | 2,854 | https://github.com/gss/engine/blob/d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0/src/properties/Styles.coffee | 101 | 150 |
gss/engine:src/properties/Styles.coffee:1:raw_corpus | raw_corpus | class Styles
transform: [[
-> mat4.create(),
'matrix'
]]
animation: [[[
name: ['none', 'String']
duration: ['time']
delay: ['time']
direction: ['normal', 'reverse', 'alternate']
'timing-function': ['timing'],
'iteration-count': [1, 'infin... | CoffeeScript | gss/engine | src/properties/Styles.coffee | MIT | 9bc92c72147758363e34d02c9ed4fbfe84e5afd6 | 2,854 | https://github.com/gss/engine/blob/9bc92c72147758363e34d02c9ed4fbfe84e5afd6/src/properties/Styles.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-account/test/apis/unions/teambition.coffee:1:raw_corpus | raw_corpus | should = require 'should'
request = require 'supertest'
jwt = require 'jsonwebtoken'
app = require '../../../server/server'
util = require '../../util'
describe 'Union#Teambition', ->
before util.prepare
it 'should redirect to teambition account page when visit redirect url', (done) ->
request(app).get '/uni... | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/teambition.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/teambition.coffee | 1 | 46 | ||
jianliaoim/talk-os:talk-account/test/apis/unions/teambition.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
should = require 'should'
request = require 'supertest'
jwt = require 'jsonwebtoken'
app = require '../../../server/server'
util = require '../../util'
describe 'Union#Teambition', ->
before util.prepare
it 'should redirect to teambition account page when ... | var app, jwt, request, should, util;
should = require('should');
request = require('supertest');
jwt = require('jsonwebtoken');
app = require('../../../server/server');
util = require('../../util');
describe('Union#Teambition', function() {
before(util.prepare);
it('should redirect to teambition account page ... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/test/apis/unions/teambition.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/teambition.coffee | 1 | 46 |
jianliaoim/talk-os:talk-account/test/apis/unions/teambition.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var app, jwt, request, should, util;
should = require('should');
request = require('supertest');
jwt = require('jsonwebtoken');
app = require('../../../server/server');
util = require('../../util');
describe('Union#Teambition', function() {
before(util.prep... | should = require 'should'
request = require 'supertest'
jwt = require 'jsonwebtoken'
app = require '../../../server/server'
util = require '../../util'
describe 'Union#Teambition', ->
before util.prepare
it 'should redirect to teambition account page when visit redirect url', (done) ->
request(app).get '/uni... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/teambition.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/teambition.coffee | 1 | 46 |
jianliaoim/talk-os:talk-account/test/apis/unions/teambition.coffee:1:completion | completion | should = require 'should'
request = require 'supertest'
jwt = require 'jsonwebtoken'
app = require '../../../server/server'
util = require '../../util'
describe 'Union#Teambition', ->
before util.prepare
it 'should redirect to teambition account page when visit redirect url', (done) ->
request(app).get '/uni... | util.request options, (err, res, user) ->
user.should.have.properties 'name', 'refer', 'openId', 'accountToken', 'wasNew', 'showname'
user.wasNew.should.eql true
user.name.should.eql 'teambition 用户'
user.showname.should.eql 'jianliao@teambition.com'
user.openId.should.eql '55ed1e3aaa6373be... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/teambition.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/teambition.coffee | 1 | 46 |
jianliaoim/talk-os:talk-account/test/apis/unions/teambition.coffee:2:raw_corpus | raw_corpus | it 'should bind to an exist teambition account by bindCode', (done) ->
options =
method: 'POST'
url: '/union/forcebind/teambition'
body:
accountToken: util.user.accountToken
bindCode: util.bindCode
util.request options, (err, res, user) ->
user.should.have.properties 'acc... | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/teambition.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/teambition.coffee | 48 | 89 | ||
jianliaoim/talk-os:talk-account/test/apis/unions/teambition.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should bind to an exist teambition account by bindCode', (done) ->
options =
method: 'POST'
url: '/union/forcebind/teambition'
body:
accountToken: util.user.accountToken
bindCode: util.bindCode
util.request options, (... | it('should bind to an exist teambition account by bindCode', function(done) {
var options;
options = {
method: 'POST',
url: '/union/forcebind/teambition',
body: {
accountToken: util.user.accountToken,
bindCode: util.bindCode
}
};
return util.request(options, function(err, res, user) ... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/test/apis/unions/teambition.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/teambition.coffee | 48 | 89 |
jianliaoim/talk-os:talk-account/test/apis/unions/teambition.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should bind to an exist teambition account by bindCode', function(done) {
var options;
options = {
method: 'POST',
url: '/union/forcebind/teambition',
body: {
accountToken: util.user.accountToken,
bindCode: util.bindCode
}
};
... | it 'should bind to an exist teambition account by bindCode', (done) ->
options =
method: 'POST'
url: '/union/forcebind/teambition'
body:
accountToken: util.user.accountToken
bindCode: util.bindCode
util.request options, (err, res, user) ->
user.should.have.properties 'acc... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/teambition.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/teambition.coffee | 48 | 89 |
jianliaoim/talk-os:talk-account/test/apis/unions/teambition.coffee:2:completion | completion | it 'should bind to an exist teambition account by bindCode', (done) ->
options =
method: 'POST'
url: '/union/forcebind/teambition'
body:
accountToken: util.user.accountToken
bindCode: util.bindCode
util.request options, (err, res, user) ->
user.should.have.properties 'acc... | it 'should bind teambition account again', (done) ->
options =
method: 'POST'
url: '/union/bind/teambition'
body:
accountToken: util.user.accountToken
code: 'xxx'
util.request options, (err, res, user) ->
user.should.have.properties 'refer', 'openId'
done err
it ... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/teambition.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/teambition.coffee | 48 | 89 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/scope.coffee:1:raw_corpus | raw_corpus | num: 1
change_numbers: ->
new_num: -1
num: 10
new_num: change_numbers() | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/documentation/coffee/scope.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/scope.coffee | 1 | 5 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/scope.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
num: 1
change_numbers: ->
new_num: -1
num: 10
new_num: change_numbers()
``` | ({
num: 1,
change_numbers: function() {
return {
new_num: -1,
num: 10
};
},
new_num: change_numbers()
}); | CoffeeScript | JavaScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/documentation/coffee/scope.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/scope.coffee | 1 | 5 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/scope.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
num: 1,
change_numbers: function() {
return {
new_num: -1,
num: 10
};
},
new_num: change_numbers()
});
``` | num: 1
change_numbers: ->
new_num: -1
num: 10
new_num: change_numbers() | JavaScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/documentation/coffee/scope.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/scope.coffee | 1 | 5 |
CaryLandholt/AngularFun:test/scripts/filters/twitterfySpec.coffee:1:raw_corpus | raw_corpus | describe 'twitterfy', ->
beforeEach module 'app'
it 'username should be prepended with the @ sign', inject ['twitterfyFilter', (twitterfy) ->
twitterHandle = 'CaryLandholt'
twitterfied = twitterfy twitterHandle
expect(twitterfied).toEqual("@#{twitterHandle}")
expect(twitterfied).not.toEqual(twitterHandle)
... | CoffeeScript | CaryLandholt/AngularFun | test/scripts/filters/twitterfySpec.coffee | MIT | df2ae65cf72b2e625fb5eae80cbde4d76f047616 | 672 | https://github.com/CaryLandholt/AngularFun/blob/df2ae65cf72b2e625fb5eae80cbde4d76f047616/test/scripts/filters/twitterfySpec.coffee | 1 | 10 | ||
CaryLandholt/AngularFun:test/scripts/filters/twitterfySpec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'twitterfy', ->
beforeEach module 'app'
it 'username should be prepended with the @ sign', inject ['twitterfyFilter', (twitterfy) ->
twitterHandle = 'CaryLandholt'
twitterfied = twitterfy twitterHandle
expect(twitterfied).toEqual("@#{twitterHan... | describe('twitterfy', function() {
beforeEach(module('app'));
return it('username should be prepended with the @ sign', inject([
'twitterfyFilter',
function(twitterfy) {
var twitterHandle,
twitterfied;
twitterHandle = 'CaryLandholt';
twitterfied = twitterfy(twitterHandle);
expect... | CoffeeScript | JavaScript | CaryLandholt/AngularFun | test/scripts/filters/twitterfySpec.coffee | MIT | df2ae65cf72b2e625fb5eae80cbde4d76f047616 | 672 | https://github.com/CaryLandholt/AngularFun/blob/df2ae65cf72b2e625fb5eae80cbde4d76f047616/test/scripts/filters/twitterfySpec.coffee | 1 | 10 |
CaryLandholt/AngularFun:test/scripts/filters/twitterfySpec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('twitterfy', function() {
beforeEach(module('app'));
return it('username should be prepended with the @ sign', inject([
'twitterfyFilter',
function(twitterfy) {
var twitterHandle,
twitterfied;
twitterHandle = 'CaryLandholt';
... | describe 'twitterfy', ->
beforeEach module 'app'
it 'username should be prepended with the @ sign', inject ['twitterfyFilter', (twitterfy) ->
twitterHandle = 'CaryLandholt'
twitterfied = twitterfy twitterHandle
expect(twitterfied).toEqual("@#{twitterHandle}")
expect(twitterfied).not.toEqual(twitterHandle)
... | JavaScript | CoffeeScript | CaryLandholt/AngularFun | test/scripts/filters/twitterfySpec.coffee | MIT | df2ae65cf72b2e625fb5eae80cbde4d76f047616 | 672 | https://github.com/CaryLandholt/AngularFun/blob/df2ae65cf72b2e625fb5eae80cbde4d76f047616/test/scripts/filters/twitterfySpec.coffee | 1 | 10 |
CaryLandholt/AngularFun:test/scripts/filters/twitterfySpec.coffee:1:completion | completion | describe 'twitterfy', ->
beforeEach module 'app'
it 'username should be prepended with the @ sign', inject ['twitterfyFilter', (twitterfy) ->
twitterHandle = 'CaryLandholt' | twitterfied = twitterfy twitterHandle
expect(twitterfied).toEqual("@#{twitterHandle}")
expect(twitterfied).not.toEqual(twitterHandle)
] | CoffeeScript | CoffeeScript | CaryLandholt/AngularFun | test/scripts/filters/twitterfySpec.coffee | MIT | df2ae65cf72b2e625fb5eae80cbde4d76f047616 | 672 | https://github.com/CaryLandholt/AngularFun/blob/df2ae65cf72b2e625fb5eae80cbde4d76f047616/test/scripts/filters/twitterfySpec.coffee | 1 | 10 |
CaryLandholt/AngularFun:test/scripts/filters/twitterfySpec.coffee:1:raw_corpus | raw_corpus | describe 'twitterfy filter', ->
beforeEach module 'app'
it 'Twitter username should be prepended with the @ sign', inject ['twitterfyFilter', (twitterfy) ->
twitterHandle = 'CaryLandholt'
twitterfied = twitterfy twitterHandle
expect(twitterfied).not.toEqual(twitterHandle)
expect(twitterfied).toEqual("@#{twi... | CoffeeScript | CaryLandholt/AngularFun | test/scripts/filters/twitterfySpec.coffee | MIT | 89bf01eb6c5efc65ff402ee52e7648dfade9805d | 672 | https://github.com/CaryLandholt/AngularFun/blob/89bf01eb6c5efc65ff402ee52e7648dfade9805d/test/scripts/filters/twitterfySpec.coffee | 1 | 10 | ||
CaryLandholt/AngularFun:test/scripts/filters/twitterfySpec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'twitterfy filter', ->
beforeEach module 'app'
it 'Twitter username should be prepended with the @ sign', inject ['twitterfyFilter', (twitterfy) ->
twitterHandle = 'CaryLandholt'
twitterfied = twitterfy twitterHandle
expect(twitterfied).not.toE... | describe('twitterfy filter', function() {
beforeEach(module('app'));
return it('Twitter username should be prepended with the @ sign', inject([
'twitterfyFilter',
function(twitterfy) {
var twitterHandle,
twitterfied;
twitterHandle = 'CaryLandholt';
twitterfied = twitterfy(twitterHandle... | CoffeeScript | JavaScript | CaryLandholt/AngularFun | test/scripts/filters/twitterfySpec.coffee | MIT | 89bf01eb6c5efc65ff402ee52e7648dfade9805d | 672 | https://github.com/CaryLandholt/AngularFun/blob/89bf01eb6c5efc65ff402ee52e7648dfade9805d/test/scripts/filters/twitterfySpec.coffee | 1 | 10 |
CaryLandholt/AngularFun:test/scripts/filters/twitterfySpec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('twitterfy filter', function() {
beforeEach(module('app'));
return it('Twitter username should be prepended with the @ sign', inject([
'twitterfyFilter',
function(twitterfy) {
var twitterHandle,
twitterfied;
twitterHandle = 'Car... | describe 'twitterfy filter', ->
beforeEach module 'app'
it 'Twitter username should be prepended with the @ sign', inject ['twitterfyFilter', (twitterfy) ->
twitterHandle = 'CaryLandholt'
twitterfied = twitterfy twitterHandle
expect(twitterfied).not.toEqual(twitterHandle)
expect(twitterfied).toEqual("@#{twi... | JavaScript | CoffeeScript | CaryLandholt/AngularFun | test/scripts/filters/twitterfySpec.coffee | MIT | 89bf01eb6c5efc65ff402ee52e7648dfade9805d | 672 | https://github.com/CaryLandholt/AngularFun/blob/89bf01eb6c5efc65ff402ee52e7648dfade9805d/test/scripts/filters/twitterfySpec.coffee | 1 | 10 |
CaryLandholt/AngularFun:test/scripts/filters/twitterfySpec.coffee:1:completion | completion | describe 'twitterfy filter', ->
beforeEach module 'app'
it 'Twitter username should be prepended with the @ sign', inject ['twitterfyFilter', (twitterfy) ->
twitterHandle = 'CaryLandholt' | twitterfied = twitterfy twitterHandle
expect(twitterfied).not.toEqual(twitterHandle)
expect(twitterfied).toEqual("@#{twitterHandle}")
] | CoffeeScript | CoffeeScript | CaryLandholt/AngularFun | test/scripts/filters/twitterfySpec.coffee | MIT | 89bf01eb6c5efc65ff402ee52e7648dfade9805d | 672 | https://github.com/CaryLandholt/AngularFun/blob/89bf01eb6c5efc65ff402ee52e7648dfade9805d/test/scripts/filters/twitterfySpec.coffee | 1 | 10 |
yakyak/yakyak:test/global.coffee:1:raw_corpus | raw_corpus | # just so that fnuc loads before we redefine eql
require 'hangupsjs'
global.chai = require 'chai'
chai.use require 'sinon-chai'
sinon = require 'sinon'
global.stub = sinon.stub
global.spy = sinon.spy
global.assert = chai.assert
global.eql = chai.assert.deepEqual
# trifl globals
global.updated = ->
global... | CoffeeScript | yakyak/yakyak | test/global.coffee | MIT | 8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd | 3,762 | https://github.com/yakyak/yakyak/blob/8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd/test/global.coffee | 1 | 19 | ||
yakyak/yakyak:test/global.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# just so that fnuc loads before we redefine eql
require 'hangupsjs'
global.chai = require 'chai'
chai.use require 'sinon-chai'
sinon = require 'sinon'
global.stub = sinon.stub
global.spy = sinon.spy
global.assert = chai.assert
global.eql = chai.ass... | // just so that fnuc loads before we redefine eql
var sinon;
require('hangupsjs');
global.chai = require('chai');
chai.use(require('sinon-chai'));
sinon = require('sinon');
global.stub = sinon.stub;
global.spy = sinon.spy;
global.assert = chai.assert;
global.eql = chai.assert.deepEqual;
// trifl globals
global... | CoffeeScript | JavaScript | yakyak/yakyak | test/global.coffee | MIT | 8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd | 3,762 | https://github.com/yakyak/yakyak/blob/8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd/test/global.coffee | 1 | 19 |
yakyak/yakyak:test/global.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// just so that fnuc loads before we redefine eql
var sinon;
require('hangupsjs');
global.chai = require('chai');
chai.use(require('sinon-chai'));
sinon = require('sinon');
global.stub = sinon.stub;
global.spy = sinon.spy;
global.assert = chai.assert;
globa... | # just so that fnuc loads before we redefine eql
require 'hangupsjs'
global.chai = require 'chai'
chai.use require 'sinon-chai'
sinon = require 'sinon'
global.stub = sinon.stub
global.spy = sinon.spy
global.assert = chai.assert
global.eql = chai.assert.deepEqual
# trifl globals
global.updated = ->
global... | JavaScript | CoffeeScript | yakyak/yakyak | test/global.coffee | MIT | 8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd | 3,762 | https://github.com/yakyak/yakyak/blob/8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd/test/global.coffee | 1 | 19 |
yakyak/yakyak:test/global.coffee:1:completion | completion | # just so that fnuc loads before we redefine eql
require 'hangupsjs'
global.chai = require 'chai'
chai.use require 'sinon-chai'
sinon = require 'sinon'
global.stub = sinon.stub | global.spy = sinon.spy
global.assert = chai.assert
global.eql = chai.assert.deepEqual
# trifl globals
global.updated = ->
global.action = ->
# dummy localStorage
global.localStorage = {} | CoffeeScript | CoffeeScript | yakyak/yakyak | test/global.coffee | MIT | 8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd | 3,762 | https://github.com/yakyak/yakyak/blob/8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd/test/global.coffee | 1 | 19 |
soulwire/Coffee-Physics:source/engine/Particle.coffee:1:raw_corpus | raw_corpus | ### Particle ###
class Particle
@GUID = 0
constructor: (@mass = 1.0) ->
# Set a unique id.
@id = 'p' + Particle.GUID++
# Set initial mass.
@setMass @mass
# Set initial radius.
@setRadius 1.0
# Apply forces.
@fixed = false
# Behaviours to be applied.
@behaviours = []
# Current position.
... | CoffeeScript | soulwire/Coffee-Physics | source/engine/Particle.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/engine/Particle.coffee | 1 | 50 | ||
soulwire/Coffee-Physics:source/engine/Particle.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
### Particle ###
class Particle
@GUID = 0
constructor: (@mass = 1.0) ->
# Set a unique id.
@id = 'p' + Particle.GUID++
# Set initial mass.
@setMass @mass
# Set initial radius.
@setRadius 1.0
# Apply forces.
@fixed = false
# Behaviours t... | /* Particle */
var Particle;
Particle = (function() {
class Particle {
constructor(mass = 1.0) {
this.mass = mass;
// Set a unique id.
this.id = 'p' + Particle.GUID++;
// Set initial mass.
this.setMass(this.mass);
// Set initial radius.
this.setRadius(1.0);
// Appl... | CoffeeScript | JavaScript | soulwire/Coffee-Physics | source/engine/Particle.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/engine/Particle.coffee | 1 | 50 |
soulwire/Coffee-Physics:source/engine/Particle.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/* Particle */
var Particle;
Particle = (function() {
class Particle {
constructor(mass = 1.0) {
this.mass = mass;
// Set a unique id.
this.id = 'p' + Particle.GUID++;
// Set initial mass.
this.setMass(this.mass);
// Set i... | ### Particle ###
class Particle
@GUID = 0
constructor: (@mass = 1.0) ->
# Set a unique id.
@id = 'p' + Particle.GUID++
# Set initial mass.
@setMass @mass
# Set initial radius.
@setRadius 1.0
# Apply forces.
@fixed = false
# Behaviours to be applied.
@behaviours = []
# Current position.
... | JavaScript | CoffeeScript | soulwire/Coffee-Physics | source/engine/Particle.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/engine/Particle.coffee | 1 | 50 |
soulwire/Coffee-Physics:source/engine/Particle.coffee:1:completion | completion | ### Particle ###
class Particle
@GUID = 0
constructor: (@mass = 1.0) ->
# Set a unique id.
@id = 'p' + Particle.GUID++
# Set initial mass.
@setMass @mass
# Set initial radius.
@setRadius 1.0
# Apply forces.
@fixed = false
# Behaviours to be applied.
@behaviours = []
# Current position.
... | # Current velocity.
@vel = new Vector()
# Current force.
@acc = new Vector()
# Previous state.
@old =
pos: new Vector()
vel: new Vector()
acc: new Vector()
### Moves the particle to a given location vector. ###
moveTo: (pos) ->
@pos.copy pos
@old.pos.copy pos
### Sets the mass of the part... | CoffeeScript | CoffeeScript | soulwire/Coffee-Physics | source/engine/Particle.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/engine/Particle.coffee | 1 | 50 |
soulwire/Coffee-Physics:source/engine/Particle.coffee:2:raw_corpus | raw_corpus | setRadius: (@radius = 1.0) ->
@radiusSq = @radius * @radius
### Applies all behaviours to derive new force. ###
update: (dt, index) ->
# Apply all behaviours.
if not @fixed
for behaviour in @behaviours
behaviour.apply @, dt, index | CoffeeScript | soulwire/Coffee-Physics | source/engine/Particle.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/engine/Particle.coffee | 51 | 64 | ||
soulwire/Coffee-Physics:source/engine/Particle.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
setRadius: (@radius = 1.0) ->
@radiusSq = @radius * @radius
### Applies all behaviours to derive new force. ###
update: (dt, index) ->
# Apply all behaviours.
if not @fixed
for behaviour in @behaviours
behaviour.apply @, dt, index
``` | ({
setRadius: function(radius = 1.0) {
this.radius = radius;
return this.radiusSq = this.radius * this.radius;
},
/* Applies all behaviours to derive new force. */
update: function(dt, index) {
var behaviour, i, len, ref, results;
// Apply all behaviours.
if (!this.fixed) {
ref = this.... | CoffeeScript | JavaScript | soulwire/Coffee-Physics | source/engine/Particle.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/engine/Particle.coffee | 51 | 64 |
soulwire/Coffee-Physics:source/engine/Particle.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
setRadius: function(radius = 1.0) {
this.radius = radius;
return this.radiusSq = this.radius * this.radius;
},
/* Applies all behaviours to derive new force. */
update: function(dt, index) {
var behaviour, i, len, ref, results;
// Apply a... | setRadius: (@radius = 1.0) ->
@radiusSq = @radius * @radius
### Applies all behaviours to derive new force. ###
update: (dt, index) ->
# Apply all behaviours.
if not @fixed
for behaviour in @behaviours
behaviour.apply @, dt, index | JavaScript | CoffeeScript | soulwire/Coffee-Physics | source/engine/Particle.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/engine/Particle.coffee | 51 | 64 |
soulwire/Coffee-Physics:source/engine/Particle.coffee:2:completion | completion | setRadius: (@radius = 1.0) ->
@radiusSq = @radius * @radius
### Applies all behaviours to derive new force. ###
update: (dt, index) -> | # Apply all behaviours.
if not @fixed
for behaviour in @behaviours
behaviour.apply @, dt, index | CoffeeScript | CoffeeScript | soulwire/Coffee-Physics | source/engine/Particle.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/engine/Particle.coffee | 51 | 64 |
soulwire/Coffee-Physics:source/engine/Particle.coffee:1:raw_corpus | raw_corpus | ### Particle ###
class Particle
@GUID = 0
constructor: (@mass = 1.0) ->
# Set a unique id.
@id = 'p' + Particle.GUID++
# Set initial mass.
@setMass @mass
# Set initial radius.
@setRadius 1.0
# Apply forces.
@fixed = false;
# Behaviours to be applied.
@behaviours = []
# Current position.
... | CoffeeScript | soulwire/Coffee-Physics | source/engine/Particle.coffee | MIT | f361da870a787374bbb2e1ead4be4476c6125eab | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/f361da870a787374bbb2e1ead4be4476c6125eab/source/engine/Particle.coffee | 1 | 50 | ||
soulwire/Coffee-Physics:source/engine/Particle.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
### Particle ###
class Particle
@GUID = 0
constructor: (@mass = 1.0) ->
# Set a unique id.
@id = 'p' + Particle.GUID++
# Set initial mass.
@setMass @mass
# Set initial radius.
@setRadius 1.0
# Apply forces.
@fixed = false;
# Behaviours ... | /* Particle */
var Particle;
Particle = (function() {
class Particle {
constructor(mass = 1.0) {
this.mass = mass;
// Set a unique id.
this.id = 'p' + Particle.GUID++;
// Set initial mass.
this.setMass(this.mass);
// Set initial radius.
this.setRadius(1.0);
// Appl... | CoffeeScript | JavaScript | soulwire/Coffee-Physics | source/engine/Particle.coffee | MIT | f361da870a787374bbb2e1ead4be4476c6125eab | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/f361da870a787374bbb2e1ead4be4476c6125eab/source/engine/Particle.coffee | 1 | 50 |
soulwire/Coffee-Physics:source/engine/Particle.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/* Particle */
var Particle;
Particle = (function() {
class Particle {
constructor(mass = 1.0) {
this.mass = mass;
// Set a unique id.
this.id = 'p' + Particle.GUID++;
// Set initial mass.
this.setMass(this.mass);
// Set i... | ### Particle ###
class Particle
@GUID = 0
constructor: (@mass = 1.0) ->
# Set a unique id.
@id = 'p' + Particle.GUID++
# Set initial mass.
@setMass @mass
# Set initial radius.
@setRadius 1.0
# Apply forces.
@fixed = false;
# Behaviours to be applied.
@behaviours = []
# Current position.
... | JavaScript | CoffeeScript | soulwire/Coffee-Physics | source/engine/Particle.coffee | MIT | f361da870a787374bbb2e1ead4be4476c6125eab | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/f361da870a787374bbb2e1ead4be4476c6125eab/source/engine/Particle.coffee | 1 | 50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.