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/auth.coffee:1:raw_corpus | raw_corpus | @Auth or= {}
###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw ne... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb | 541 | https://github.com/kahmali/meteor-restivus/blob/b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb/lib/auth.coffee | 1 | 50 | ||
kahmali/meteor-restivus:lib/auth.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Auth or= {}
###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Option... | /*
Return a MongoDB query selector for finding the given user
*/
/*
A password can be either in plain text or hashed
*/
/*
A valid user will have exactly one of the following identification fields: id, username, or email
*/
var getUserQuerySelector, passwordValidator, userValidator;
this.Auth || (thi... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb | 541 | https://github.com/kahmali/meteor-restivus/blob/b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb/lib/auth.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/auth.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
Return a MongoDB query selector for finding the given user
*/
/*
A password can be either in plain text or hashed
*/
/*
A valid user will have exactly one of the following identification fields: id, username, or email
*/
var getUserQuerySelecto... | @Auth or= {}
###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw ne... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb | 541 | https://github.com/kahmali/meteor-restivus/blob/b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb/lib/auth.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/auth.coffee:1:completion | completion | @Auth or= {}
###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw ne... | ###
getUserQuerySelector = (user) ->
if user.id
return {'_id': user.id}
else if user.username
return {'username': user.username}
else if user.email
return {'emails.address': user.email}
# We shouldn't be here if the user object was properly validated
throw new Error 'Cannot create selector from i... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb | 541 | https://github.com/kahmali/meteor-restivus/blob/b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb/lib/auth.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/auth.coffee:2:raw_corpus | raw_corpus | authenticatingUser = Meteor.users.findOne(authenticatingUserSelector)
if not authenticatingUser
throw new Meteor.Error 401, 'Unauthorized'
if not authenticatingUser.services?.password
throw new Meteor.Error 401, 'Unauthorized'
# Authenticate the user's password
passwordVerification = Accounts._checkPa... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb | 541 | https://github.com/kahmali/meteor-restivus/blob/b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb/lib/auth.coffee | 51 | 68 | ||
kahmali/meteor-restivus:lib/auth.coffee:2:completion | completion | authenticatingUser = Meteor.users.findOne(authenticatingUserSelector)
if not authenticatingUser
throw new Meteor.Error 401, 'Unauthorized'
if not authenticatingUser.services?.password
throw new Meteor.Error 401, 'Unauthorized'
# Authenticate the user's password
passwordVerification = Accounts._checkPa... | if passwordVerification.error
throw new Meteor.Error 401, 'Unauthorized'
# Add a new auth token to the user's account
authToken = Accounts._generateStampedLoginToken()
hashedToken = Accounts._hashLoginToken authToken.token
Accounts._insertHashedLoginToken authenticatingUser._id, {hashedToken}
return {au... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb | 541 | https://github.com/kahmali/meteor-restivus/blob/b95f879c0ebc52e0a7cd85e91fbc8ba5118026eb/lib/auth.coffee | 51 | 68 |
kahmali/meteor-restivus:lib/auth.coffee:2:raw_corpus | raw_corpus | authenticatingUser = Meteor.users.findOne(authenticatingUserSelector)
if not authenticatingUser
throw new Meteor.Error 401, 'Unauthorized'
if not authenticatingUser.services?.password
throw new Meteor.Error 401, 'Unauthorized'
if @bodyParams.algorithm == 'sha-256'
password =
digest: @bodyParam... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 3e586e8eb3c8fb867e7b0ab2ef912cd71ef190aa | 541 | https://github.com/kahmali/meteor-restivus/blob/3e586e8eb3c8fb867e7b0ab2ef912cd71ef190aa/lib/auth.coffee | 51 | 75 | ||
kahmali/meteor-restivus:lib/auth.coffee:2:completion | completion | authenticatingUser = Meteor.users.findOne(authenticatingUserSelector)
if not authenticatingUser
throw new Meteor.Error 401, 'Unauthorized'
if not authenticatingUser.services?.password
throw new Meteor.Error 401, 'Unauthorized'
if @bodyParams.algorithm == 'sha-256'
password =
digest: @bodyParam... | password = @bodyParams.password
# Authenticate the user's password
passwordVerification = Accounts._checkPassword authenticatingUser, password
if passwordVerification.error
throw new Meteor.Error 401, 'Unauthorized'
# Add a new auth token to the user's account
authToken = Accounts._generateStampedLoginT... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 3e586e8eb3c8fb867e7b0ab2ef912cd71ef190aa | 541 | https://github.com/kahmali/meteor-restivus/blob/3e586e8eb3c8fb867e7b0ab2ef912cd71ef190aa/lib/auth.coffee | 51 | 75 |
kahmali/meteor-restivus:lib/auth.coffee:1:raw_corpus | raw_corpus | @Auth or= {}
###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw ne... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | fc451572ef5ca62cde4bc5edee1e557f0603e6b6 | 541 | https://github.com/kahmali/meteor-restivus/blob/fc451572ef5ca62cde4bc5edee1e557f0603e6b6/lib/auth.coffee | 1 | 50 | ||
kahmali/meteor-restivus:lib/auth.coffee:1:completion | completion | @Auth or= {}
###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw ne... | else if user.email
return {'emails.address': user.email}
# We shouldn't be here if the user object was properly validated
throw new Error 'Cannot create selector from invalid user'
###
Log a user in with their password
###
@Auth.loginWithPassword = (user, password) ->
if not user or not password
thro... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | fc451572ef5ca62cde4bc5edee1e557f0603e6b6 | 541 | https://github.com/kahmali/meteor-restivus/blob/fc451572ef5ca62cde4bc5edee1e557f0603e6b6/lib/auth.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/auth.coffee:2:raw_corpus | raw_corpus | throw new Meteor.Error 401, 'Unauthorized'
# Authenticate the user's password
passwordVerification = Accounts._checkPassword authenticatingUser, password
if passwordVerification.error
throw new Meteor.Error 401, 'Unauthorized'
# Add a new auth token to the user's account
authToken = Accounts._generateSt... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | fc451572ef5ca62cde4bc5edee1e557f0603e6b6 | 541 | https://github.com/kahmali/meteor-restivus/blob/fc451572ef5ca62cde4bc5edee1e557f0603e6b6/lib/auth.coffee | 51 | 63 | ||
kahmali/meteor-restivus:lib/auth.coffee:2:completion | completion | throw new Meteor.Error 401, 'Unauthorized'
# Authenticate the user's password
passwordVerification = Accounts._checkPassword authenticatingUser, password
if passwordVerification.error
throw new Meteor.Error 401, 'Unauthorized' | # Add a new auth token to the user's account
authToken = Accounts._generateStampedLoginToken()
hashedToken = Accounts._hashLoginToken authToken.token
Accounts._insertHashedLoginToken authenticatingUser._id, {hashedToken}
return {authToken: authToken.token, userId: authenticatingUser._id} | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | fc451572ef5ca62cde4bc5edee1e557f0603e6b6 | 541 | https://github.com/kahmali/meteor-restivus/blob/fc451572ef5ca62cde4bc5edee1e557f0603e6b6/lib/auth.coffee | 51 | 63 |
kahmali/meteor-restivus:lib/auth.coffee:1:raw_corpus | raw_corpus | @Auth or= {}
###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw ne... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 27f885b12b32f43da9499daaa4c3836138f0ab9e | 541 | https://github.com/kahmali/meteor-restivus/blob/27f885b12b32f43da9499daaa4c3836138f0ab9e/lib/auth.coffee | 1 | 50 | ||
kahmali/meteor-restivus:lib/auth.coffee:1:completion | completion | @Auth or= {}
###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw ne... | else if user.email
return {'emails.address': user.email}
# We shouldn't be here if the user object was properly validated
throw new Error 'Cannot create selector from invalid user'
###
Log a user in with their password
###
@Auth.loginWithPassword = (user, password) ->
if not user or not password
thro... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 27f885b12b32f43da9499daaa4c3836138f0ab9e | 541 | https://github.com/kahmali/meteor-restivus/blob/27f885b12b32f43da9499daaa4c3836138f0ab9e/lib/auth.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/auth.coffee:2:raw_corpus | raw_corpus | throw new Meteor.Error 403, 'Unauthorized'
# Authenticate the user's password
passwordVerification = Accounts._checkPassword authenticatingUser, password
if passwordVerification.error
throw new Meteor.Error 403, 'Unauthorized'
# Add a new auth token to the user's account
authToken = Accounts._generateSt... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 27f885b12b32f43da9499daaa4c3836138f0ab9e | 541 | https://github.com/kahmali/meteor-restivus/blob/27f885b12b32f43da9499daaa4c3836138f0ab9e/lib/auth.coffee | 51 | 63 | ||
kahmali/meteor-restivus:lib/auth.coffee:2:completion | completion | throw new Meteor.Error 403, 'Unauthorized'
# Authenticate the user's password
passwordVerification = Accounts._checkPassword authenticatingUser, password
if passwordVerification.error
throw new Meteor.Error 403, 'Unauthorized' | # Add a new auth token to the user's account
authToken = Accounts._generateStampedLoginToken()
hashedToken = Accounts._hashLoginToken authToken.token
Accounts._insertHashedLoginToken authenticatingUser._id, {hashedToken}
return {authToken: authToken.token, userId: authenticatingUser._id} | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 27f885b12b32f43da9499daaa4c3836138f0ab9e | 541 | https://github.com/kahmali/meteor-restivus/blob/27f885b12b32f43da9499daaa4c3836138f0ab9e/lib/auth.coffee | 51 | 63 |
kahmali/meteor-restivus:lib/auth.coffee:1:raw_corpus | raw_corpus | @Auth or= {}
###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw ne... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 2a398a200f485f6ec0d350f8f80eb12f7ca77e27 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a398a200f485f6ec0d350f8f80eb12f7ca77e27/lib/auth.coffee | 1 | 50 | ||
kahmali/meteor-restivus:lib/auth.coffee:1:completion | completion | @Auth or= {}
###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw ne... | else if user.email
return {'emails.address': user.email}
# We shouldn't be here if the user object was properly validated
throw new Error 'Cannot create selector from invalid user'
###
Log a user in with their password
###
@Auth.loginWithPassword = (user, password) ->
if not user or not password
retu... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 2a398a200f485f6ec0d350f8f80eb12f7ca77e27 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a398a200f485f6ec0d350f8f80eb12f7ca77e27/lib/auth.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/auth.coffee:2:raw_corpus | raw_corpus | throw new Meteor.Error 403, 'User has no password set'
# Authenticate the user's password
passwordVerification = Accounts._checkPassword authenticatingUser, password
if passwordVerification.error
throw new Meteor.Error 403, 'Incorrect password'
# Add a new auth token to the user's account
authToken = Ac... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 2a398a200f485f6ec0d350f8f80eb12f7ca77e27 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a398a200f485f6ec0d350f8f80eb12f7ca77e27/lib/auth.coffee | 51 | 62 | ||
kahmali/meteor-restivus:lib/auth.coffee:2:completion | completion | throw new Meteor.Error 403, 'User has no password set'
# Authenticate the user's password
passwordVerification = Accounts._checkPassword authenticatingUser, password
if passwordVerification.error
throw new Meteor.Error 403, 'Incorrect password' | # Add a new auth token to the user's account
authToken = Accounts._generateStampedLoginToken()
Meteor.users.update authenticatingUser._id, {$push: {'services.resume.loginTokens': authToken}}
return {authToken: authToken.token, userId: authenticatingUser._id} | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 2a398a200f485f6ec0d350f8f80eb12f7ca77e27 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a398a200f485f6ec0d350f8f80eb12f7ca77e27/lib/auth.coffee | 51 | 62 |
kahmali/meteor-restivus:lib/auth.coffee:1:raw_corpus | raw_corpus | @Auth or= {}
###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw ne... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/auth.coffee | 1 | 50 | ||
kahmali/meteor-restivus:lib/auth.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Auth or= {}
###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Option... | /*
Return a MongoDB query selector for finding the given user
TODO: Allow the user to configure a user field that they define as valid, and check that instead of this arbitrary 'username'
*/
/*
A valid user will have exactly one of the following identification fields: id, username, or email
*/
var getUserQu... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/auth.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/auth.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
Return a MongoDB query selector for finding the given user
TODO: Allow the user to configure a user field that they define as valid, and check that instead of this arbitrary 'username'
*/
/*
A valid user will have exactly one of the following identific... | @Auth or= {}
###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw ne... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/auth.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/auth.coffee:1:completion | completion | @Auth or= {}
###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw ne... | return {'username': user.username}
else if user.email
return {'emails.address': user.email}
# We shouldn't be here if the user object was properly validated
throw new Error 'Cannot create selector from invalid user'
###
Log a user in with their password
###
@Auth.loginWithPassword = (user, password) ->
... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/auth.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/auth.coffee:2:raw_corpus | raw_corpus | if not authenticatingUser.services?.password
throw new Meteor.Error 403, 'User has no password set'
# Authenticate the user's password
passwordVerification = Accounts._checkPassword authenticatingUser, password
if passwordVerification.error
throw new Meteor.Error 403, 'Incorrect password'
# Add a new ... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/auth.coffee | 51 | 63 | ||
kahmali/meteor-restivus:lib/auth.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if not authenticatingUser.services?.password
throw new Meteor.Error 403, 'User has no password set'
# Authenticate the user's password
passwordVerification = Accounts._checkPassword authenticatingUser, password
if passwordVerification.error
throw n... | var authToken, passwordVerification, ref;
if (!((ref = authenticatingUser.services) != null ? ref.password : void 0)) {
throw new Meteor.Error(403, 'User has no password set');
}
// Authenticate the user's password
passwordVerification = Accounts._checkPassword(authenticatingUser, password);
if (passwordVerificati... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/auth.coffee | 51 | 63 |
kahmali/meteor-restivus:lib/auth.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var authToken, passwordVerification, ref;
if (!((ref = authenticatingUser.services) != null ? ref.password : void 0)) {
throw new Meteor.Error(403, 'User has no password set');
}
// Authenticate the user's password
passwordVerification = Accounts._checkPassword... | if not authenticatingUser.services?.password
throw new Meteor.Error 403, 'User has no password set'
# Authenticate the user's password
passwordVerification = Accounts._checkPassword authenticatingUser, password
if passwordVerification.error
throw new Meteor.Error 403, 'Incorrect password'
# Add a new ... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/auth.coffee | 51 | 63 |
kahmali/meteor-restivus:lib/auth.coffee:2:completion | completion | if not authenticatingUser.services?.password
throw new Meteor.Error 403, 'User has no password set'
# Authenticate the user's password
passwordVerification = Accounts._checkPassword authenticatingUser, password
if passwordVerification.error | throw new Meteor.Error 403, 'Incorrect password'
# Add a new auth token to the user's account
authToken = Accounts._generateStampedLoginToken()
Meteor.users.update authenticatingUser._id, {$push: {'services.resume.loginTokens': authToken}}
return {authToken: authToken.token, userId: authenticatingUser._id} | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 9d959e0b9dd60398057724202c0e74e5785d7d3a | 541 | https://github.com/kahmali/meteor-restivus/blob/9d959e0b9dd60398057724202c0e74e5785d7d3a/lib/auth.coffee | 51 | 63 |
kahmali/meteor-restivus:lib/auth.coffee:2:raw_corpus | raw_corpus | if not authenticatingUser.services?.password
throw new Meteor.Error 403, 'User has no password set'
# Authenticate the user's password
passwordVerification = Accounts._checkPassword authenticatingUser, password
if passwordVerification.error
throw new Meteor.Error 403, 'Incorrect password'
# Add a new ... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 52e3d9195a6d19afb4176cf82457b572ddd27951 | 541 | https://github.com/kahmali/meteor-restivus/blob/52e3d9195a6d19afb4176cf82457b572ddd27951/lib/auth.coffee | 51 | 63 | ||
kahmali/meteor-restivus:lib/auth.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if not authenticatingUser.services?.password
throw new Meteor.Error 403, 'User has no password set'
# Authenticate the user's password
passwordVerification = Accounts._checkPassword authenticatingUser, password
if passwordVerification.error
throw n... | var authToken, passwordVerification, ref;
if (!((ref = authenticatingUser.services) != null ? ref.password : void 0)) {
throw new Meteor.Error(403, 'User has no password set');
}
// Authenticate the user's password
passwordVerification = Accounts._checkPassword(authenticatingUser, password);
if (passwordVerificati... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 52e3d9195a6d19afb4176cf82457b572ddd27951 | 541 | https://github.com/kahmali/meteor-restivus/blob/52e3d9195a6d19afb4176cf82457b572ddd27951/lib/auth.coffee | 51 | 63 |
kahmali/meteor-restivus:lib/auth.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var authToken, passwordVerification, ref;
if (!((ref = authenticatingUser.services) != null ? ref.password : void 0)) {
throw new Meteor.Error(403, 'User has no password set');
}
// Authenticate the user's password
passwordVerification = Accounts._checkPassword... | if not authenticatingUser.services?.password
throw new Meteor.Error 403, 'User has no password set'
# Authenticate the user's password
passwordVerification = Accounts._checkPassword authenticatingUser, password
if passwordVerification.error
throw new Meteor.Error 403, 'Incorrect password'
# Add a new ... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 52e3d9195a6d19afb4176cf82457b572ddd27951 | 541 | https://github.com/kahmali/meteor-restivus/blob/52e3d9195a6d19afb4176cf82457b572ddd27951/lib/auth.coffee | 51 | 63 |
kahmali/meteor-restivus:lib/auth.coffee:2:completion | completion | if not authenticatingUser.services?.password
throw new Meteor.Error 403, 'User has no password set'
# Authenticate the user's password
passwordVerification = Accounts._checkPassword authenticatingUser, password
if passwordVerification.error | throw new Meteor.Error 403, 'Incorrect password'
# Add a new auth token to the user's account
authToken = Accounts._generateStampedLoginToken()
Meteor.users.update authenticatingUser._id, {$push: {'services.resume.loginTokens': authToken}}
return {loginToken: authToken.token, userId: authenticatingUser._id} | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 52e3d9195a6d19afb4176cf82457b572ddd27951 | 541 | https://github.com/kahmali/meteor-restivus/blob/52e3d9195a6d19afb4176cf82457b572ddd27951/lib/auth.coffee | 51 | 63 |
kahmali/meteor-restivus:lib/auth.coffee:1:raw_corpus | raw_corpus | userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw new Match.Error 'User must have exactly one identifier field'
return true
###
Return a MongoDB query selector for fin... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/auth.coffee | 4 | 19 | ||
kahmali/meteor-restivus:lib/auth.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw new Match.Error 'User must have exactly one identifier field'
re... | var userValidator;
userValidator = Match.Where(function(user) {
check(user, {
id: Match.Optional(String),
username: Match.Optional(String),
email: Match.Optional(String)
});
if (_.keys(user).length === !1) {
throw new Match.Error('User must have exactly one identifier field');
}
return true;
... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/auth.coffee | 4 | 19 |
kahmali/meteor-restivus:lib/auth.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var userValidator;
userValidator = Match.Where(function(user) {
check(user, {
id: Match.Optional(String),
username: Match.Optional(String),
email: Match.Optional(String)
});
if (_.keys(user).length === !1) {
throw new Match.Error('User must h... | userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw new Match.Error 'User must have exactly one identifier field'
return true
###
Return a MongoDB query selector for fin... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/auth.coffee | 4 | 19 |
kahmali/meteor-restivus:lib/auth.coffee:1:completion | completion | userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw new Match.Error 'User must have exactly one identifier field' | return true
###
Return a MongoDB query selector for finding the given user
TODO: Allow the user to configure a user field that they define as valid, and check that instead of this arbitrary 'username'
### | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/auth.coffee | 4 | 19 |
kahmali/meteor-restivus:lib/auth.coffee:2:raw_corpus | raw_corpus | getUserQuerySelector = (user) ->
if user.id
return {'_id': user.id}
else if user.username
return {'username': user.username}
else if user.email
return {'emails.address': user.email}
# We shouldn't be here if the user object was properly validated
throw new Error 'Cannot create selector from inval... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/auth.coffee | 20 | 34 | ||
kahmali/meteor-restivus:lib/auth.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
getUserQuerySelector = (user) ->
if user.id
return {'_id': user.id}
else if user.username
return {'username': user.username}
else if user.email
return {'emails.address': user.email}
# We shouldn't be here if the user object was properly valid... | var getUserQuerySelector;
getUserQuerySelector = function(user) {
if (user.id) {
return {
'_id': user.id
};
} else if (user.username) {
return {
'username': user.username
};
} else if (user.email) {
return {
'emails.address': user.email
};
}
// We shouldn't be here i... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/auth.coffee | 20 | 34 |
kahmali/meteor-restivus:lib/auth.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var getUserQuerySelector;
getUserQuerySelector = function(user) {
if (user.id) {
return {
'_id': user.id
};
} else if (user.username) {
return {
'username': user.username
};
} else if (user.email) {
return {
'emails.addr... | getUserQuerySelector = (user) ->
if user.id
return {'_id': user.id}
else if user.username
return {'username': user.username}
else if user.email
return {'emails.address': user.email}
# We shouldn't be here if the user object was properly validated
throw new Error 'Cannot create selector from inval... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/auth.coffee | 20 | 34 |
kahmali/meteor-restivus:lib/auth.coffee:2:completion | completion | getUserQuerySelector = (user) ->
if user.id
return {'_id': user.id}
else if user.username
return {'username': user.username}
else if user.email
return {'emails.address': user.email} | # We shouldn't be here if the user object was properly validated
throw new Error 'Cannot create selector from invalid user'
###
Log a user in with their password
### | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/auth.coffee | 20 | 34 |
kahmali/meteor-restivus:lib/auth.coffee:3:raw_corpus | raw_corpus | loginWithPassword = (user, password) ->
if not user or not password
return undefined # TODO: Should we throw a more descriptive error here, or is that insecure?
# Validate the login input types
check user, userValidator
check password, String
# Retrieve the user from the database
authenticatingUserSel... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/auth.coffee | 35 | 61 | ||
kahmali/meteor-restivus:lib/auth.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
loginWithPassword = (user, password) ->
if not user or not password
return undefined # TODO: Should we throw a more descriptive error here, or is that insecure?
# Validate the login input types
check user, userValidator
check password, String
# Re... | var loginWithPassword;
loginWithPassword = function(user, password) {
var authToken, authenticatingUser, authenticatingUserSelector, passwordVerification, ref;
if (!user || !password) {
return void 0; // TODO: Should we throw a more descriptive error here, or is that insecure?
}
// Validate the login inpu... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/auth.coffee | 35 | 61 |
kahmali/meteor-restivus:lib/auth.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var loginWithPassword;
loginWithPassword = function(user, password) {
var authToken, authenticatingUser, authenticatingUserSelector, passwordVerification, ref;
if (!user || !password) {
return void 0; // TODO: Should we throw a more descriptive error here,... | loginWithPassword = (user, password) ->
if not user or not password
return undefined # TODO: Should we throw a more descriptive error here, or is that insecure?
# Validate the login input types
check user, userValidator
check password, String
# Retrieve the user from the database
authenticatingUserSel... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/auth.coffee | 35 | 61 |
kahmali/meteor-restivus:lib/auth.coffee:3:completion | completion | loginWithPassword = (user, password) ->
if not user or not password
return undefined # TODO: Should we throw a more descriptive error here, or is that insecure?
# Validate the login input types
check user, userValidator
check password, String
# Retrieve the user from the database
authenticatingUserSel... | throw new Meteor.Error 403, 'User not found'
if not authenticatingUser.services?.password
throw new Meteor.Error 403, 'User has no password set'
# Authenticate the user's password
passwordVerification = Accounts._checkPassword authenticatingUser, password
if passwordVerification.error
throw new Meteor.... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/auth.coffee | 35 | 61 |
kahmali/meteor-restivus:lib/auth.coffee:4:raw_corpus | raw_corpus | @Restivus.prototype.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
u... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/auth.coffee | 63 | 112 | ||
kahmali/meteor-restivus:lib/auth.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restivus.prototype.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 u... | this.Restivus.prototype.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;
// ... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/auth.coffee | 63 | 112 |
kahmali/meteor-restivus:lib/auth.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restivus.prototype.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: f... | @Restivus.prototype.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
u... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/auth.coffee | 63 | 112 |
kahmali/meteor-restivus:lib/auth.coffee:4:completion | completion | @Restivus.prototype.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
u... | 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/auth.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/auth.coffee | 63 | 112 |
kahmali/meteor-restivus:lib/auth.coffee:4:raw_corpus | raw_corpus | @Restfully.prototype.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).
###
Restfully.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/auth.coffee | 63 | 112 | ||
kahmali/meteor-restivus:lib/auth.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restfully.prototype.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).
###
Restfully.add 'login', {authRequired: false},
post: ->
# Grab the... | this.Restfully.prototype.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).
*/
Restfully.add('login', {
authRequired: false
}, {
post: function() {
var auth, context, e, user;
/... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/auth.coffee | 63 | 112 |
kahmali/meteor-restivus:lib/auth.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restfully.prototype.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).
*/
Restfully.add('login', {
authRequired: false
}, {
post:... | @Restfully.prototype.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).
###
Restfully.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/auth.coffee | 63 | 112 |
kahmali/meteor-restivus:lib/auth.coffee:4:completion | completion | @Restfully.prototype.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).
###
Restfully.add 'login', {authRequired: false},
post: ->
# Grab the username or email that the user is logging in with
... | context.user = Meteor.users.findOne
'_id': auth.userId
'services.resume.loginTokens.token': auth.loginToken
# Call the login hook with the authenticated user attached
Restfully.config.onLoggedIn.call context
auth.success = true
auth
###
Add a logout method to the API
... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/auth.coffee | 63 | 112 |
kahmali/meteor-restivus:lib/auth.coffee:1:raw_corpus | raw_corpus | ###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw new Match.Error ... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/lib/auth.coffee | 1 | 50 | ||
kahmali/meteor-restivus:lib/auth.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
i... | /*
A valid user will have exactly one of the following identification fields: id, username, or email
*/
/*
Return a MongoDB query selector for finding the given user
TODO: Allow the user to configure a user field that they define as valid, and check that instead of this arbitrary 'username'
*/
/*
Lo... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/lib/auth.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/auth.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
A valid user will have exactly one of the following identification fields: id, username, or email
*/
/*
Return a MongoDB query selector for finding the given user
TODO: Allow the user to configure a user field that they define as valid, and check tha... | ###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw new Match.Error ... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/lib/auth.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/auth.coffee:1:completion | completion | ###
A valid user will have exactly one of the following identification fields: id, username, or email
###
userValidator = Match.Where (user) ->
check user,
id: Match.Optional String
username: Match.Optional String
email: Match.Optional String
if _.keys(user).length is not 1
throw new Match.Error ... | return {'email.address': user.email}
# We shouldn't be here if the user object was properly validated
throw new Error 'Cannot create selector from invalid user'
###
Log a user in with their password
###
loginWithPassword = (userId, password) ->
if not userId or not password
return undefined # TODO: Shoul... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/lib/auth.coffee | 1 | 50 |
kahmali/meteor-restivus:lib/auth.coffee:2:raw_corpus | raw_corpus | # Verify the user's password
passwordVerification = Accounts._checkPassword user, password
if passwordVerification.error
throw new Meteor.Error 403, 'Incorrect password'
# Add a new auth token to the user's account
authToken = Accounts._generateStampedLoginToken()
Meteor.users.update user._id, {$push: {'... | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/lib/auth.coffee | 51 | 64 | ||
kahmali/meteor-restivus:lib/auth.coffee:2:completion | completion | # Verify the user's password
passwordVerification = Accounts._checkPassword user, password
if passwordVerification.error
throw new Meteor.Error 403, 'Incorrect password'
# Add a new auth token to the user's account | authToken = Accounts._generateStampedLoginToken()
Meteor.users.update user._id, {$push: {'services.resume.loginTokens': authToken}}
return {loginToken: authToken, userId: user._id}
@Restfully.prototype.initAuth = ->
# TODO: Add login and logout endpoints | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/auth.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/lib/auth.coffee | 51 | 64 |
jianliaoim/talk-os:talk-web/client/actions/contact.coffee:1:raw_corpus | raw_corpus | dispatcher = require '../dispatcher'
api = require '../network/api'
exports.contactRemove = (_teamId, user, success, fail) ->
config =
pathParams:
id: _teamId
data:
_userId: user.get('_id')
api.teams.removemember.post(config)
.then (resp) ->
dispatcher.handleViewAction type: 'contact... | CoffeeScript | jianliaoim/talk-os | talk-web/client/actions/contact.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/contact.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-web/client/actions/contact.coffee:1:completion | completion | dispatcher = require '../dispatcher'
api = require '../network/api'
exports.contactRemove = (_teamId, user, success, fail) ->
config =
pathParams:
id: _teamId
data:
_userId: user.get('_id')
api.teams.removemember.post(config)
.then (resp) ->
dispatcher.handleViewAction type: 'contact... | .then (resp) ->
dispatcher.handleViewAction type: 'contact/update', data: resp
success? resp
.catch (error) ->
fail? error
exports.fetchLeftContacts = (_teamId, success, fail) ->
config =
pathParams:
id: _teamId
queryParams:
isQuit: true
api.teams.members.get(config)
.... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/actions/contact.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/contact.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/actions/contact.coffee:2:raw_corpus | raw_corpus | pathParams:
id: _teamId
api.teams.members.get config
.then (resp) ->
dispatcher.handleViewAction
type: 'contact/read'
data:
_teamId: _teamId
data: resp
success? resp
.catch (error) ->
fail? error | CoffeeScript | jianliaoim/talk-os | talk-web/client/actions/contact.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/contact.coffee | 51 | 63 | ||
jianliaoim/talk-os:talk-web/client/actions/contact.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
pathParams:
id: _teamId
api.teams.members.get config
.then (resp) ->
dispatcher.handleViewAction
type: 'contact/read'
data:
_teamId: _teamId
data: resp
success? resp
.catch (error) ->
fail? error
``` | ({
pathParams: {
id: _teamId
}
});
api.teams.members.get(config).then(function(resp) {
dispatcher.handleViewAction({
type: 'contact/read',
data: {
_teamId: _teamId,
data: resp
}
});
return typeof success === "function" ? success(resp) : void 0;
}).catch(function(error) {
return ... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/actions/contact.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/contact.coffee | 51 | 63 |
jianliaoim/talk-os:talk-web/client/actions/contact.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
pathParams: {
id: _teamId
}
});
api.teams.members.get(config).then(function(resp) {
dispatcher.handleViewAction({
type: 'contact/read',
data: {
_teamId: _teamId,
data: resp
}
});
return typeof success === "function" ? succe... | pathParams:
id: _teamId
api.teams.members.get config
.then (resp) ->
dispatcher.handleViewAction
type: 'contact/read'
data:
_teamId: _teamId
data: resp
success? resp
.catch (error) ->
fail? error | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/actions/contact.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/contact.coffee | 51 | 63 |
jianliaoim/talk-os:talk-web/client/actions/contact.coffee:2:completion | completion | pathParams:
id: _teamId
api.teams.members.get config
.then (resp) ->
dispatcher.handleViewAction | type: 'contact/read'
data:
_teamId: _teamId
data: resp
success? resp
.catch (error) ->
fail? error | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/actions/contact.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/contact.coffee | 51 | 63 |
oozcitak/xmlbuilder-js:test/issues/96.coffee:1:raw_corpus | raw_corpus | suite 'Tests specific to issues:', ->
test 'Issue #96 (Seperate array items)', ->
obj =
data:
article_data: [
{ article: 'somedata' },
{ article: 'somedata' }
]
eq(
xml(obj, { separateArrayItems: true }).end()
'<?xml version="1.0"?>'... | CoffeeScript | oozcitak/xmlbuilder-js | test/issues/96.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/issues/96.coffee | 1 | 19 | ||
oozcitak/xmlbuilder-js:test/issues/96.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
suite 'Tests specific to issues:', ->
test 'Issue #96 (Seperate array items)', ->
obj =
data:
article_data: [
{ article: 'somedata' },
{ article: 'somedata' }
]
eq(
xml(obj, { separa... | suite('Tests specific to issues:', function() {
return test('Issue #96 (Seperate array items)', function() {
var obj;
obj = {
data: {
article_data: [
{
article: 'somedata'
},
{
article: 'somedata'
}
]
}
};
retu... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | test/issues/96.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/issues/96.coffee | 1 | 19 |
oozcitak/xmlbuilder-js:test/issues/96.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
suite('Tests specific to issues:', function() {
return test('Issue #96 (Seperate array items)', function() {
var obj;
obj = {
data: {
article_data: [
{
article: 'somedata'
},
{
article: '... | suite 'Tests specific to issues:', ->
test 'Issue #96 (Seperate array items)', ->
obj =
data:
article_data: [
{ article: 'somedata' },
{ article: 'somedata' }
]
eq(
xml(obj, { separateArrayItems: true }).end()
'<?xml version="1.0"?>'... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | test/issues/96.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/issues/96.coffee | 1 | 19 |
oozcitak/xmlbuilder-js:test/issues/96.coffee:1:completion | completion | suite 'Tests specific to issues:', ->
test 'Issue #96 (Seperate array items)', ->
obj =
data:
article_data: [
{ article: 'somedata' },
{ article: 'somedata' }
] | eq(
xml(obj, { separateArrayItems: true }).end()
'<?xml version="1.0"?>' +
'<data>' +
'<article_data>' +
'<article>somedata</article>' +
'<article>somedata</article>' +
'</article_data>' +
'</data>'
) | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | test/issues/96.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/issues/96.coffee | 1 | 19 |
nicolaskruchten/pivottable:locales/pivot.it.coffee:1:raw_corpus | raw_corpus | callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
callWithJQuery ($) ->
nf = $.piv... | CoffeeScript | nicolaskruchten/pivottable | locales/pivot.it.coffee | MIT | 838ec2fc38747749c28d2fd1cb6c4ace9e9cc520 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/838ec2fc38747749c28d2fd1cb6c4ace9e9cc520/locales/pivot.it.coffee | 1 | 50 | ||
nicolaskruchten/pivottable:locales/pivot.it.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
... | var callWithJQuery;
callWithJQuery = function(pivotModule) {
if (typeof exports === "object" && typeof module === "object") { // CommonJS
return pivotModule(require("jquery"));
} else if (typeof define === "function" && define.amd) { // AMD
return define(["jquery"], pivotModule);
} else {
// Plain br... | CoffeeScript | JavaScript | nicolaskruchten/pivottable | locales/pivot.it.coffee | MIT | 838ec2fc38747749c28d2fd1cb6c4ace9e9cc520 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/838ec2fc38747749c28d2fd1cb6c4ace9e9cc520/locales/pivot.it.coffee | 1 | 50 |
nicolaskruchten/pivottable:locales/pivot.it.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var callWithJQuery;
callWithJQuery = function(pivotModule) {
if (typeof exports === "object" && typeof module === "object") { // CommonJS
return pivotModule(require("jquery"));
} else if (typeof define === "function" && define.amd) { // AMD
return defi... | callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
callWithJQuery ($) ->
nf = $.piv... | JavaScript | CoffeeScript | nicolaskruchten/pivottable | locales/pivot.it.coffee | MIT | 838ec2fc38747749c28d2fd1cb6c4ace9e9cc520 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/838ec2fc38747749c28d2fd1cb6c4ace9e9cc520/locales/pivot.it.coffee | 1 | 50 |
nicolaskruchten/pivottable:locales/pivot.it.coffee:1:completion | completion | callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
callWithJQuery ($) ->
nf = $.piv... | filterResults: "Filtra i valori"
apply: "Applica"
cancel: "Annulla"
totals: "Totali"
vs: "su"
by: "da"
aggregators:
"Numero": tpl.count(frFmtInt)
"Numero di valori unici": tpl.countUnique(frFmtInt)
"Elenco di valori unici": ... | CoffeeScript | CoffeeScript | nicolaskruchten/pivottable | locales/pivot.it.coffee | MIT | 838ec2fc38747749c28d2fd1cb6c4ace9e9cc520 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/838ec2fc38747749c28d2fd1cb6c4ace9e9cc520/locales/pivot.it.coffee | 1 | 50 |
nicolaskruchten/pivottable:locales/pivot.it.coffee:1:raw_corpus | raw_corpus | callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
callWithJQuery ($) ->
nf = $.piv... | CoffeeScript | nicolaskruchten/pivottable | locales/pivot.it.coffee | MIT | 23ce70b0dcafc8c1c34596b79226584d074cbe04 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/23ce70b0dcafc8c1c34596b79226584d074cbe04/locales/pivot.it.coffee | 1 | 50 | ||
nicolaskruchten/pivottable:locales/pivot.it.coffee:1:completion | completion | callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
callWithJQuery ($) ->
nf = $.piv... | filterResults: "Filtra i valori"
totals: "Totali"
vs: "su"
by: "da"
aggregators:
"Numero": tpl.count(frFmtInt)
"Numero di valori unici": tpl.countUnique(frFmtInt)
"Elenco di valori unici": tpl.listUnique(", ")
"Somma": ... | CoffeeScript | CoffeeScript | nicolaskruchten/pivottable | locales/pivot.it.coffee | MIT | 23ce70b0dcafc8c1c34596b79226584d074cbe04 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/23ce70b0dcafc8c1c34596b79226584d074cbe04/locales/pivot.it.coffee | 1 | 50 |
cdglabs/apparatus:src/Util/NodeVisitor.coffee:1:raw_corpus | raw_corpus | # TODO: what about hatching?
module.exports = class NodeVisitor
constructor: ({@onVisit, @linksToFollow}) ->
@visitedNodes = []
visit: (node) ->
if @hasVisited(node)
return
node.__visitors.push(this)
@visitedNodes.push(node)
@onVisit(node) if @onVisit
if @linksToFollow.master
... | CoffeeScript | cdglabs/apparatus | src/Util/NodeVisitor.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/NodeVisitor.coffee | 1 | 38 | ||
cdglabs/apparatus:src/Util/NodeVisitor.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# TODO: what about hatching?
module.exports = class NodeVisitor
constructor: ({@onVisit, @linksToFollow}) ->
@visitedNodes = []
visit: (node) ->
if @hasVisited(node)
return
node.__visitors.push(this)
@visitedNodes.push(node)
@onV... | // TODO: what about hatching?
var NodeVisitor;
module.exports = NodeVisitor = class NodeVisitor {
constructor({onVisit, linksToFollow}) {
this.onVisit = onVisit;
this.linksToFollow = linksToFollow;
this.visitedNodes = [];
}
visit(node) {
var child, i, j, len, len1, master, parent, ref, ref1, var... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/NodeVisitor.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/NodeVisitor.coffee | 1 | 38 |
cdglabs/apparatus:src/Util/NodeVisitor.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// TODO: what about hatching?
var NodeVisitor;
module.exports = NodeVisitor = class NodeVisitor {
constructor({onVisit, linksToFollow}) {
this.onVisit = onVisit;
this.linksToFollow = linksToFollow;
this.visitedNodes = [];
}
visit(node) {
var... | # TODO: what about hatching?
module.exports = class NodeVisitor
constructor: ({@onVisit, @linksToFollow}) ->
@visitedNodes = []
visit: (node) ->
if @hasVisited(node)
return
node.__visitors.push(this)
@visitedNodes.push(node)
@onVisit(node) if @onVisit
if @linksToFollow.master
... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/NodeVisitor.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/NodeVisitor.coffee | 1 | 38 |
cdglabs/apparatus:src/Util/NodeVisitor.coffee:1:completion | completion | # TODO: what about hatching?
module.exports = class NodeVisitor
constructor: ({@onVisit, @linksToFollow}) ->
@visitedNodes = []
visit: (node) ->
if @hasVisited(node)
return
node.__visitors.push(this)
@visitedNodes.push(node)
@onVisit(node) if @onVisit
if @linksToFollow.master
... | @visit(variant) for variant in node.variants()
if @linksToFollow.parent
parent = node.parent()
@visit(parent) if parent
if @linksToFollow.children and node.isHatched()
@visit(child) for child in node.children()
return
hasVisited: (node) ->
node.__visitors = [] if !node.hasOwnPropert... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/NodeVisitor.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/NodeVisitor.coffee | 1 | 38 |
cdglabs/apparatus:src/Util/NodeVisitor.coffee:1:raw_corpus | raw_corpus | # TODO: what about hatching?
module.exports = class NodeVisitor
constructor: ({@onVisit, @linksToFollow}) ->
@visitedNodes = []
visit: (node) ->
if @hasVisited(node)
return
node.__visitors.push(this)
@visitedNodes.push(node)
@onVisit(node) if @onVisit
if @linksToFollow.master
... | CoffeeScript | cdglabs/apparatus | src/Util/NodeVisitor.coffee | MIT | 0def3c671846c1c5d87753eea571144144b086bd | 1,052 | https://github.com/cdglabs/apparatus/blob/0def3c671846c1c5d87753eea571144144b086bd/src/Util/NodeVisitor.coffee | 1 | 38 | ||
cdglabs/apparatus:src/Util/NodeVisitor.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# TODO: what about hatching?
module.exports = class NodeVisitor
constructor: ({@onVisit, @linksToFollow}) ->
@visitedNodes = []
visit: (node) ->
if @hasVisited(node)
return
node.__visitors.push(this)
@visitedNodes.push(node)
@onV... | // TODO: what about hatching?
var NodeVisitor;
module.exports = NodeVisitor = class NodeVisitor {
constructor({onVisit, linksToFollow}) {
this.onVisit = onVisit;
this.linksToFollow = linksToFollow;
this.visitedNodes = [];
}
visit(node) {
var child, i, j, len, len1, master, parent, ref, ref1, var... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/NodeVisitor.coffee | MIT | 0def3c671846c1c5d87753eea571144144b086bd | 1,052 | https://github.com/cdglabs/apparatus/blob/0def3c671846c1c5d87753eea571144144b086bd/src/Util/NodeVisitor.coffee | 1 | 38 |
cdglabs/apparatus:src/Util/NodeVisitor.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// TODO: what about hatching?
var NodeVisitor;
module.exports = NodeVisitor = class NodeVisitor {
constructor({onVisit, linksToFollow}) {
this.onVisit = onVisit;
this.linksToFollow = linksToFollow;
this.visitedNodes = [];
}
visit(node) {
var... | # TODO: what about hatching?
module.exports = class NodeVisitor
constructor: ({@onVisit, @linksToFollow}) ->
@visitedNodes = []
visit: (node) ->
if @hasVisited(node)
return
node.__visitors.push(this)
@visitedNodes.push(node)
@onVisit(node) if @onVisit
if @linksToFollow.master
... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/NodeVisitor.coffee | MIT | 0def3c671846c1c5d87753eea571144144b086bd | 1,052 | https://github.com/cdglabs/apparatus/blob/0def3c671846c1c5d87753eea571144144b086bd/src/Util/NodeVisitor.coffee | 1 | 38 |
cdglabs/apparatus:src/Util/NodeVisitor.coffee:1:completion | completion | # TODO: what about hatching?
module.exports = class NodeVisitor
constructor: ({@onVisit, @linksToFollow}) ->
@visitedNodes = []
visit: (node) ->
if @hasVisited(node)
return
node.__visitors.push(this)
@visitedNodes.push(node)
@onVisit(node) if @onVisit
if @linksToFollow.master
... | @visit(variant) for variant in node.variants()
if @linksToFollow.parent
parent = node.parent()
@visit(parent) if parent
if @linksToFollow.children
@visit(child) for child in node.children()
return
hasVisited: (node) ->
node.__visitors = [] if !node.hasOwnProperty('__visitors')
r... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/NodeVisitor.coffee | MIT | 0def3c671846c1c5d87753eea571144144b086bd | 1,052 | https://github.com/cdglabs/apparatus/blob/0def3c671846c1c5d87753eea571144144b086bd/src/Util/NodeVisitor.coffee | 1 | 38 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee:1:raw_corpus | raw_corpus | ###
# Copyright (c) 2016-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/dashboards/services/services.dashboardOverridesService.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee | 1 | 50 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee:1:completion | completion | ###
# Copyright (c) 2016-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 ... | resetOverrides = ->
return { pages: [] }
expandOverrides = (dashboard, dashboardOverrides) ->
dashboardOverrides.pages ?= []
_.each dashboard.pages, (page, index) ->
if !dashboardOverrides.pages[index]?
dashboardOverrides.pages.push { widgets: [] }
da... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee | 1 | 50 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee:2:raw_corpus | raw_corpus | # Pad out the overrides with empty pages/widgets
dashboardOverrides = expandOverrides dashboard, dashboardOverrides
logService.debug 'Dashboard Overrides: ' + JSON.stringify(dashboardOverrides)
resolve dashboardOverrides
.catch (error) ->
... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee | 51 | 74 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee:2:completion | completion | # Pad out the overrides with empty pages/widgets
dashboardOverrides = expandOverrides dashboard, dashboardOverrides
logService.debug 'Dashboard Overrides: ' + JSON.stringify(dashboardOverrides)
resolve dashboardOverrides
.catch (error) ->
... | resetAndExpandOverrides: (dashboard) ->
dashboardOverrides = resetOverrides()
expandOverrides dashboard, dashboardOverrides
saveDashboardOverrides: (dashboard, dashboardOverrides) ->
$localForage.setItem(getLocalStorageKey(dashboard), dashboardOverrides).then ->
... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee | 51 | 74 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee:1:raw_corpus | raw_corpus | ###
# Copyright (c) 2016 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 or ag... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee | MIT | d9f6710d26e1473dc1dab805685dd5b572fead4a | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/d9f6710d26e1473dc1dab805685dd5b572fead4a/cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee | 1 | 50 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee:1:completion | completion | ###
# Copyright (c) 2016 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 or ag... | resetOverrides = ->
return { pages: [] }
expandOverrides = (dashboard, dashboardOverrides) ->
dashboardOverrides.pages ?= []
_.each dashboard.pages, (page, index) ->
if !dashboardOverrides.pages[index]?
dashboardOverrides.pages.push { widgets: [] }
da... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee | MIT | d9f6710d26e1473dc1dab805685dd5b572fead4a | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/d9f6710d26e1473dc1dab805685dd5b572fead4a/cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee | 1 | 50 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee:2:raw_corpus | raw_corpus | # Pad out the overrides with empty pages/widgets
dashboardOverrides = expandOverrides dashboard, dashboardOverrides
logService.debug 'Dashboard Overrides: ' + JSON.stringify(dashboardOverrides)
resolve dashboardOverrides
.catch (error) ->
... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee | MIT | 08680403c1ab72b7789517426293681c2224eada | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/08680403c1ab72b7789517426293681c2224eada/cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee | 51 | 71 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee:2:completion | completion | # Pad out the overrides with empty pages/widgets
dashboardOverrides = expandOverrides dashboard, dashboardOverrides
logService.debug 'Dashboard Overrides: ' + JSON.stringify(dashboardOverrides)
resolve dashboardOverrides
.catch (error) ->
... | resetAndExpandOverrides: (dashboard) ->
dashboardOverrides = resetOverrides()
expandOverrides dashboard, dashboardOverrides
saveDashboardOverrides: (dashboard, dashboardOverrides) ->
$localForage.setItem(getLocalStorageKey(dashboard), dashboardOverrides).then ->
... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee | MIT | 08680403c1ab72b7789517426293681c2224eada | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/08680403c1ab72b7789517426293681c2224eada/cyclotron-site/app/scripts/dashboards/services/services.dashboardOverridesService.coffee | 51 | 71 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.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/dashboards/dataSources/dataSources.prometheus.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee | 1 | 40 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.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/dashboards/dataSources/dataSources.prometheus.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee | 1 | 40 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.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/dashboards/dataSources/dataSources.prometheus.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee | 1 | 40 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.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 ... | #
cyclotronDataSources.factory 'prometheusDataSource', ($q, $http, configService, dataSourceFactory) ->
getPrometheusUrl = (url) ->
# Clean up of Prometheus URL. TODO: More robust support
prometheusUrl = _.jsExec url
if prometheusUrl.indexOf('http') != 0 && prometheusUrl.indexOf('!{') != 0... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee | 1 | 40 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee:2:raw_corpus | raw_corpus | getProxyRequest = (options) ->
# Format: https://github.com/mikeal/request#requestoptions-callback
body =
method: 'GET'
json: true
url: getPrometheusUrl options.url
start = getDate(options.start || moment().subtract(24, 'hours').startOf('second'))
end... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee | 42 | 84 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
getProxyRequest = (options) ->
# Format: https://github.com/mikeal/request#requestoptions-callback
body =
method: 'GET'
json: true
url: getPrometheusUrl options.url
start = getDate(options.start || mome... | var getProxyRequest, runner;
getProxyRequest = function(options) {
var body, end, start, step;
// Format: https://github.com/mikeal/request#requestoptions-callback
body = {
method: 'GET',
json: true,
url: getPrometheusUrl(options.url)
};
start = getDate(options.start || moment().subtract(24, 'hou... | CoffeeScript | JavaScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee | 42 | 84 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var getProxyRequest, runner;
getProxyRequest = function(options) {
var body, end, start, step;
// Format: https://github.com/mikeal/request#requestoptions-callback
body = {
method: 'GET',
json: true,
url: getPrometheusUrl(options.url)
};
star... | getProxyRequest = (options) ->
# Format: https://github.com/mikeal/request#requestoptions-callback
body =
method: 'GET'
json: true
url: getPrometheusUrl options.url
start = getDate(options.start || moment().subtract(24, 'hours').startOf('second'))
end... | JavaScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee | 42 | 84 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee:2:completion | completion | getProxyRequest = (options) ->
# Format: https://github.com/mikeal/request#requestoptions-callback
body =
method: 'GET'
json: true
url: getPrometheusUrl options.url
start = getDate(options.start || moment().subtract(24, 'hours').startOf('second'))
end... | # Runner Failure
errorCallback = (error, status) ->
if error == '' && status == 0
# CORS error
error = 'Cross-Origin Resource Sharing error with the server.'
q.reject error
# Successful Result
successCallback = (result) ->
re... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee | 42 | 84 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee:3:raw_corpus | raw_corpus | metrics = result.body.data.result
data = _.reduce metrics, (data, metric) ->
rowTemplate = _.omit metric.metric, ['__name__']
metricName = metric.metric.__name__
_.each metric.values, (valueSet) ->
row = _.assign {
... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee | 86 | 124 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee:3:completion | completion | metrics = result.body.data.result
data = _.reduce metrics, (data, metric) ->
rowTemplate = _.omit metric.metric, ['__name__']
metricName = metric.metric.__name__
_.each metric.values, (valueSet) ->
row = _.assign {
... | '0':
data: data
columns: null
# Generate proxy URLs
proxyUri = new URI(_.jsExec(options.proxy) || configService.restServiceUrl)
.protocol '' # Remove protocol to work with either HTTP/HTTPS
.segment 'proxy' # Append /proxy endpoint
... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/dataSources/dataSources.prometheus.coffee | 86 | 124 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.