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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mojs/mojs:spec/shapes/equal.coffee:2:completion | completion | it 'should set `d` attribute if `radiusX` changed', ->
equal = new Equal
radius: 20
points: 10
equal._draw()
spyOn equal.el, 'setAttribute'
equal._props.radiusX = 30
equal._draw()
expect( equal.el.setAttribute ).toHaveBeenCalled()
it 'should set `d` attribute if ... | radius: 20
points: 10
equal._draw()
spyOn equal.el, 'setAttribute'
equal._props.points = 30
equal._draw()
expect( equal.el.setAttribute ).toHaveBeenCalled()
describe 'getLength method', ->
it 'should calculate total length of the path', ->
radius = 100
bit = new ... | CoffeeScript | CoffeeScript | mojs/mojs | spec/shapes/equal.coffee | MIT | 0a9cf9a87dd5637e6fa770755e79048489bcf817 | 18,698 | https://github.com/mojs/mojs/blob/0a9cf9a87dd5637e6fa770755e79048489bcf817/spec/shapes/equal.coffee | 45 | 88 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:1:raw_corpus | raw_corpus | module.exports = MobileSchema = new Schema
phoneNumber: type: String, trim: true
user: type: Schema.Types.ObjectId, ref: 'User'
createdAt: type: Date, default: Date.now
updatedAt: type: Date, default: Date.now
,
read: 'secondaryPreferred'
toObject:
virtuals: true
getters: true
toJSON:
virtuals... | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 13 | 36 | ||
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = MobileSchema = new Schema
phoneNumber: type: String, trim: true
user: type: Schema.Types.ObjectId, ref: 'User'
createdAt: type: Date, default: Date.now
updatedAt: type: Date, default: Date.now
,
read: 'secondaryPreferred'
toObject:
... | var MobileSchema;
module.exports = MobileSchema = new Schema({
phoneNumber: {
type: String,
trim: true
},
user: {
type: Schema.Types.ObjectId,
ref: 'User'
},
createdAt: {
type: Date,
default: Date.now
},
updatedAt: {
type: Date,
default: Date.now
}
}, {
read: 'secondar... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 13 | 36 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var MobileSchema;
module.exports = MobileSchema = new Schema({
phoneNumber: {
type: String,
trim: true
},
user: {
type: Schema.Types.ObjectId,
ref: 'User'
},
createdAt: {
type: Date,
default: Date.now
},
updatedAt: {
type:... | module.exports = MobileSchema = new Schema
phoneNumber: type: String, trim: true
user: type: Schema.Types.ObjectId, ref: 'User'
createdAt: type: Date, default: Date.now
updatedAt: type: Date, default: Date.now
,
read: 'secondaryPreferred'
toObject:
virtuals: true
getters: true
toJSON:
virtuals... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 13 | 36 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:1:completion | completion | module.exports = MobileSchema = new Schema
phoneNumber: type: String, trim: true
user: type: Schema.Types.ObjectId, ref: 'User'
createdAt: type: Date, default: Date.now
updatedAt: type: Date, default: Date.now
,
read: 'secondaryPreferred'
toObject:
virtuals: true
getters: true
toJSON:
virtuals... | getters: true
MobileSchema.virtual 'login'
.get -> 'mobile'
MobileSchema.virtual 'showname'
.get -> @phoneNumber
###*
* 生成绑定信息随机码
* @return {String} bindCode 随机码
### | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 13 | 36 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:2:raw_corpus | raw_corpus | MobileSchema.methods.genBindCode = (callback) ->
bindCode = shortid()
cacheKey = "mobilebindcode:#{bindCode}"
data =
_id: @_id
showname: @showname
redis.setex cacheKey, 600, JSON.stringify(data), (err) ->
callback err, bindCode
############################ STATICS ############################
###*... | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 37 | 51 | ||
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
MobileSchema.methods.genBindCode = (callback) ->
bindCode = shortid()
cacheKey = "mobilebindcode:#{bindCode}"
data =
_id: @_id
showname: @showname
redis.setex cacheKey, 600, JSON.stringify(data), (err) ->
callback err, bindCode
##############... | MobileSchema.methods.genBindCode = function(callback) {
var bindCode, cacheKey, data;
bindCode = shortid();
cacheKey = `mobilebindcode:${bindCode}`;
data = {
_id: this._id,
showname: this.showname
};
return redis.setex(cacheKey, 600, JSON.stringify(data), function(err) {
return callback(err, bin... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 37 | 51 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
MobileSchema.methods.genBindCode = function(callback) {
var bindCode, cacheKey, data;
bindCode = shortid();
cacheKey = `mobilebindcode:${bindCode}`;
data = {
_id: this._id,
showname: this.showname
};
return redis.setex(cacheKey, 600, JSON.string... | MobileSchema.methods.genBindCode = (callback) ->
bindCode = shortid()
cacheKey = "mobilebindcode:#{bindCode}"
data =
_id: @_id
showname: @showname
redis.setex cacheKey, 600, JSON.stringify(data), (err) ->
callback err, bindCode
############################ STATICS ############################
###*... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 37 | 51 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:2:completion | completion | MobileSchema.methods.genBindCode = (callback) ->
bindCode = shortid()
cacheKey = "mobilebindcode:#{bindCode}"
data =
_id: @_id
showname: @showname
redis.setex cacheKey, 600, JSON.stringify(data), (err) -> | callback err, bindCode
############################ STATICS ############################
###*
* 获取绑定信息随机码
* @return {String} showname 账号名称
### | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 37 | 51 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:3:raw_corpus | raw_corpus | MobileSchema.statics.getBindData = (bindCode, callback) ->
cacheKey = "mobilebindcode:#{bindCode}"
redis.get cacheKey, (err, data) ->
try
{showname} = JSON.parse data
catch err
if showname?.length
return callback null,
showname: showname
else
return callback(new Err('OBJE... | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 52 | 69 | ||
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
MobileSchema.statics.getBindData = (bindCode, callback) ->
cacheKey = "mobilebindcode:#{bindCode}"
redis.get cacheKey, (err, data) ->
try
{showname} = JSON.parse data
catch err
if showname?.length
return callback null,
showna... | MobileSchema.statics.getBindData = function(bindCode, callback) {
var cacheKey;
cacheKey = `mobilebindcode:${bindCode}`;
return redis.get(cacheKey, function(err, data) {
var showname;
try {
({showname} = JSON.parse(data));
} catch (error) {
err = error;
}
if (showname != null ? sho... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 52 | 69 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
MobileSchema.statics.getBindData = function(bindCode, callback) {
var cacheKey;
cacheKey = `mobilebindcode:${bindCode}`;
return redis.get(cacheKey, function(err, data) {
var showname;
try {
({showname} = JSON.parse(data));
} catch (error) {
... | MobileSchema.statics.getBindData = (bindCode, callback) ->
cacheKey = "mobilebindcode:#{bindCode}"
redis.get cacheKey, (err, data) ->
try
{showname} = JSON.parse data
catch err
if showname?.length
return callback null,
showname: showname
else
return callback(new Err('OBJE... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 52 | 69 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:3:completion | completion | MobileSchema.statics.getBindData = (bindCode, callback) ->
cacheKey = "mobilebindcode:#{bindCode}"
redis.get cacheKey, (err, data) ->
try
{showname} = JSON.parse data
catch err
if showname?.length | return callback null,
showname: showname
else
return callback(new Err('OBJECT_MISSING', 'showname'))
###*
* 验证 bindCode,获取对应 mobile 对象
* @return {Model} mobile 对象
### | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 52 | 69 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:4:raw_corpus | raw_corpus | MobileSchema.statics.verifyBindCode = (bindCode, callback) ->
cacheKey = "mobilebindcode:#{bindCode}"
MobileModel = this
redis.get cacheKey, (err, data) ->
try
{_id} = JSON.parse data
catch err
return callback(new Err('VERIFY_FAILED')) unless _id
MobileModel.findOne _id: _id, (err, mobile) -... | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 70 | 81 | ||
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
MobileSchema.statics.verifyBindCode = (bindCode, callback) ->
cacheKey = "mobilebindcode:#{bindCode}"
MobileModel = this
redis.get cacheKey, (err, data) ->
try
{_id} = JSON.parse data
catch err
return callback(new Err('VERIFY_FAILED')) unl... | MobileSchema.statics.verifyBindCode = function(bindCode, callback) {
var MobileModel, cacheKey;
cacheKey = `mobilebindcode:${bindCode}`;
MobileModel = this;
return redis.get(cacheKey, function(err, data) {
var _id;
try {
({_id} = JSON.parse(data));
} catch (error) {
err = error;
}
... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 70 | 81 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
MobileSchema.statics.verifyBindCode = function(bindCode, callback) {
var MobileModel, cacheKey;
cacheKey = `mobilebindcode:${bindCode}`;
MobileModel = this;
return redis.get(cacheKey, function(err, data) {
var _id;
try {
({_id} = JSON.parse(da... | MobileSchema.statics.verifyBindCode = (bindCode, callback) ->
cacheKey = "mobilebindcode:#{bindCode}"
MobileModel = this
redis.get cacheKey, (err, data) ->
try
{_id} = JSON.parse data
catch err
return callback(new Err('VERIFY_FAILED')) unless _id
MobileModel.findOne _id: _id, (err, mobile) -... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 70 | 81 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:4:completion | completion | MobileSchema.statics.verifyBindCode = (bindCode, callback) ->
cacheKey = "mobilebindcode:#{bindCode}"
MobileModel = this
redis.get cacheKey, (err, data) ->
try
{_id} = JSON.parse data | catch err
return callback(new Err('VERIFY_FAILED')) unless _id
MobileModel.findOne _id: _id, (err, mobile) ->
return callback(new Err('OBJECT_MISSING', 'mobile')) unless mobile
redis.del cacheKey
callback err, mobile | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 70 | 81 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:5:raw_corpus | raw_corpus | MobileSchema.statics.getVerifyData = (randomCode, callback) ->
cacheKey = "smsverifycode:#{randomCode}"
redis.get cacheKey, (err, data) ->
try
{createdAt, phoneNumber, verifyCode} = JSON.parse data
catch err
if phoneNumber?.length
if createdAt?
return callback null,
creat... | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 83 | 107 | ||
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
MobileSchema.statics.getVerifyData = (randomCode, callback) ->
cacheKey = "smsverifycode:#{randomCode}"
redis.get cacheKey, (err, data) ->
try
{createdAt, phoneNumber, verifyCode} = JSON.parse data
catch err
if phoneNumber?.length
if... | MobileSchema.statics.getVerifyData = function(randomCode, callback) {
var cacheKey;
cacheKey = `smsverifycode:${randomCode}`;
return redis.get(cacheKey, function(err, data) {
var createdAt, phoneNumber, verifyCode;
try {
({createdAt, phoneNumber, verifyCode} = JSON.parse(data));
} catch (error) ... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 83 | 107 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
MobileSchema.statics.getVerifyData = function(randomCode, callback) {
var cacheKey;
cacheKey = `smsverifycode:${randomCode}`;
return redis.get(cacheKey, function(err, data) {
var createdAt, phoneNumber, verifyCode;
try {
({createdAt, phoneNumber... | MobileSchema.statics.getVerifyData = (randomCode, callback) ->
cacheKey = "smsverifycode:#{randomCode}"
redis.get cacheKey, (err, data) ->
try
{createdAt, phoneNumber, verifyCode} = JSON.parse data
catch err
if phoneNumber?.length
if createdAt?
return callback null,
creat... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 83 | 107 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:5:completion | completion | MobileSchema.statics.getVerifyData = (randomCode, callback) ->
cacheKey = "smsverifycode:#{randomCode}"
redis.get cacheKey, (err, data) ->
try
{createdAt, phoneNumber, verifyCode} = JSON.parse data
catch err
if phoneNumber?.length
if createdAt?
return callback null,
creat... | phoneNumber: phoneNumber
else
return callback(new Err('OBJECT_MISSING', 'createdAt'))
else
return callback(new Err('OBJECT_MISSING', 'phoneNumber'))
###*
* 发送手机验证码
* @param {Object} options with phoneNumber
* @param {Function} callback
* @return {Object} randomCode: shortId
* @todo 验证手机号... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 83 | 107 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:6:raw_corpus | raw_corpus | MobileSchema.statics.sendVerifyCode = (options, callback = ->) ->
randomCode = shortid()
cacheKey = "smsverifycode:#{randomCode}"
# 保存新的 verify code
verifyCode = "#{Math.random()}"[2...6]
data =
verifyCode: verifyCode
phoneNumber: options.phoneNumber
createdAt: Date.now()
password: options.pa... | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 108 | 133 | ||
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
MobileSchema.statics.sendVerifyCode = (options, callback = ->) ->
randomCode = shortid()
cacheKey = "smsverifycode:#{randomCode}"
# 保存新的 verify code
verifyCode = "#{Math.random()}"[2...6]
data =
verifyCode: verifyCode
phoneNumber: options.phone... | MobileSchema.statics.sendVerifyCode = function(options, callback = function() {}) {
var $sendSMS, $verifyCode, cacheKey, data, randomCode, verifyCode;
randomCode = shortid();
cacheKey = `smsverifycode:${randomCode}`;
// 保存新的 verify code
verifyCode = `${Math.random()}`.slice(2, 6);
data = {
verifyCode: v... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 108 | 133 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
MobileSchema.statics.sendVerifyCode = function(options, callback = function() {}) {
var $sendSMS, $verifyCode, cacheKey, data, randomCode, verifyCode;
randomCode = shortid();
cacheKey = `smsverifycode:${randomCode}`;
// 保存新的 verify code
verifyCode = `${Ma... | MobileSchema.statics.sendVerifyCode = (options, callback = ->) ->
randomCode = shortid()
cacheKey = "smsverifycode:#{randomCode}"
# 保存新的 verify code
verifyCode = "#{Math.random()}"[2...6]
data =
verifyCode: verifyCode
phoneNumber: options.phoneNumber
createdAt: Date.now()
password: options.pa... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 108 | 133 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:6:completion | completion | MobileSchema.statics.sendVerifyCode = (options, callback = ->) ->
randomCode = shortid()
cacheKey = "smsverifycode:#{randomCode}"
# 保存新的 verify code
verifyCode = "#{Math.random()}"[2...6]
data =
verifyCode: verifyCode
phoneNumber: options.phoneNumber
createdAt: Date.now()
password: options.pa... | .then -> verifyCode
$sendSMS = $verifyCode.then (verifyCode) ->
msg = "您的手机验证码 #{verifyCode},请在十分钟内使用,简聊/Talk"
options.msg = msg
util.sendSMS options
Promise.all [$verifyCode, $sendSMS]
.spread (verifyCode) ->
callback null,
randomCode: randomCode
verifyCode: verifyCode
.catch call... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 108 | 133 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:7:raw_corpus | raw_corpus | MobileSchema.statics.verify = (randomCode, verifyCode, callback) ->
cacheKey = "smsverifycode:#{randomCode}"
redis.get cacheKey, (err, data) ->
try
verifyData = JSON.parse data
catch err
verifyData or= {}
if verifyData.verifyCode?.length and verifyData.verifyCode is verifyCode and
ve... | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 135 | 151 | ||
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:7:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
MobileSchema.statics.verify = (randomCode, verifyCode, callback) ->
cacheKey = "smsverifycode:#{randomCode}"
redis.get cacheKey, (err, data) ->
try
verifyData = JSON.parse data
catch err
verifyData or= {}
if verifyData.verifyCode?.len... | MobileSchema.statics.verify = function(randomCode, verifyCode, callback) {
var cacheKey;
cacheKey = `smsverifycode:${randomCode}`;
return redis.get(cacheKey, function(err, data) {
var ref, ref1, verifyData;
try {
verifyData = JSON.parse(data);
} catch (error) {
err = error;
}
verif... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 135 | 151 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:7:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
MobileSchema.statics.verify = function(randomCode, verifyCode, callback) {
var cacheKey;
cacheKey = `smsverifycode:${randomCode}`;
return redis.get(cacheKey, function(err, data) {
var ref, ref1, verifyData;
try {
verifyData = JSON.parse(data);
... | MobileSchema.statics.verify = (randomCode, verifyCode, callback) ->
cacheKey = "smsverifycode:#{randomCode}"
redis.get cacheKey, (err, data) ->
try
verifyData = JSON.parse data
catch err
verifyData or= {}
if verifyData.verifyCode?.length and verifyData.verifyCode is verifyCode and
ve... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 135 | 151 |
jianliaoim/talk-os:talk-account/server/schemas/mobile.coffee:7:completion | completion | MobileSchema.statics.verify = (randomCode, verifyCode, callback) ->
cacheKey = "smsverifycode:#{randomCode}"
redis.get cacheKey, (err, data) ->
try
verifyData = JSON.parse data
catch err | verifyData or= {}
if verifyData.verifyCode?.length and verifyData.verifyCode is verifyCode and
verifyData.phoneNumber?.length
# 手机号存在且验证码正确
redis.del cacheKey
return callback null, verifyData
callback(new Err('VERIFY_FAILED')) | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/mobile.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/mobile.coffee | 135 | 151 |
jianliaoim/talk-os:talk-web/client/app/user-alias.coffee:1:raw_corpus | raw_corpus | React = require 'react'
recorder = require 'actions-recorder'
PureRenderMixin = require 'react-addons-pure-render-mixin'
query = require '../query'
lang = require '../locales/lang'
mixinSubscribe = require '../mixin/subscribe'
detect = require '../util/detect'
div = React.createFactory 'div'
span = React.cre... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/user-alias.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/user-alias.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-web/client/app/user-alias.coffee:1:completion | completion | React = require 'react'
recorder = require 'actions-recorder'
PureRenderMixin = require 'react-addons-pure-render-mixin'
query = require '../query'
lang = require '../locales/lang'
mixinSubscribe = require '../mixin/subscribe'
detect = require '../util/detect'
div = React.createFactory 'div'
span = React.cre... | replaceMe: T.bool
onClick: T.func
getDefaultProps: ->
replaceMe: false
getInitialState: ->
alias: @getAlias()
componentDidMount: ->
@subscribe recorder, => @setState alias: @getAlias()
getAlias: ->
prefs = query.contactPrefsBy(recorder.getState(), @props._teamId, @props._userId)
alia... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/user-alias.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/user-alias.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/app/user-alias.coffee:2:raw_corpus | raw_corpus | name = lang.getText('ai-robot')
else
name = @state.alias or @props.defaultName or lang.getText('someone')
span className: 'name text-overflow', onClick: @onClick, name | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/user-alias.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/user-alias.coffee | 51 | 55 | ||
jianliaoim/talk-os:talk-web/client/app/user-alias.coffee:2:completion | completion | name = lang.getText('ai-robot')
else | name = @state.alias or @props.defaultName or lang.getText('someone')
span className: 'name text-overflow', onClick: @onClick, name | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/user-alias.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/user-alias.coffee | 51 | 55 |
buttercoin/buttercoin:test/processingchainentrance.coffee:1:raw_corpus | raw_corpus | ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal())
@replication = sinon.mock({start: (->), send: (->)})
@engin... | CoffeeScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | 77bdcec5d890976d4f02b71666d7265840e0c172 | 663 | https://github.com/buttercoin/buttercoin/blob/77bdcec5d890976d4f02b71666d7265840e0c172/test/processingchainentrance.coffee | 1 | 36 | ||
buttercoin/buttercoin:test/processingchainentrance.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal())
@repli... | var Journal, ProcessingChainEntrance, TradeEngine;
ProcessingChainEntrance = require('../lib/processingchainentrance');
TradeEngine = require('../lib/trade_engine');
Journal = require('../lib/journal');
describe('ProcessingChainEntrance', function() {
beforeEach(function(done) {
this.journal = sinon.mock(new ... | CoffeeScript | JavaScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | 77bdcec5d890976d4f02b71666d7265840e0c172 | 663 | https://github.com/buttercoin/buttercoin/blob/77bdcec5d890976d4f02b71666d7265840e0c172/test/processingchainentrance.coffee | 1 | 36 |
buttercoin/buttercoin:test/processingchainentrance.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Journal, ProcessingChainEntrance, TradeEngine;
ProcessingChainEntrance = require('../lib/processingchainentrance');
TradeEngine = require('../lib/trade_engine');
Journal = require('../lib/journal');
describe('ProcessingChainEntrance', function() {
beforeE... | ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal())
@replication = sinon.mock({start: (->), send: (->)})
@engin... | JavaScript | CoffeeScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | 77bdcec5d890976d4f02b71666d7265840e0c172 | 663 | https://github.com/buttercoin/buttercoin/blob/77bdcec5d890976d4f02b71666d7265840e0c172/test/processingchainentrance.coffee | 1 | 36 |
buttercoin/buttercoin:test/processingchainentrance.coffee:1:completion | completion | ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal())
@replication = sinon.mock({start: (->), send: (->)})
@engin... | it 'should intialize the transaction log and replication when starting', (done) ->
@journal.expects('start').once().returns(then: ->)
@replication.expects('start').once().returns(then: ->)
@pce.start()
done()
it 'should log, replicate, and package a messge upon receiving it', (done) ->
deferred ... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | 77bdcec5d890976d4f02b71666d7265840e0c172 | 663 | https://github.com/buttercoin/buttercoin/blob/77bdcec5d890976d4f02b71666d7265840e0c172/test/processingchainentrance.coffee | 1 | 36 |
buttercoin/buttercoin:test/processingchainentrance.coffee:1:raw_corpus | raw_corpus | ProcessingChainEntrance = require('../lib/processingchainentrance')
TransactionLog = require('../lib/transactionlog')
TradeEngine = require('../lib/trade_engine')
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@tlog = sinon.mock(new TransactionLog())
@replication = sinon.mock({start: (->), send:... | CoffeeScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | 00a0415c2b9bda51c9f49edaedd16aea3284c7e7 | 663 | https://github.com/buttercoin/buttercoin/blob/00a0415c2b9bda51c9f49edaedd16aea3284c7e7/test/processingchainentrance.coffee | 1 | 36 | ||
buttercoin/buttercoin:test/processingchainentrance.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
ProcessingChainEntrance = require('../lib/processingchainentrance')
TransactionLog = require('../lib/transactionlog')
TradeEngine = require('../lib/trade_engine')
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@tlog = sinon.mock(new Transactio... | var ProcessingChainEntrance, TradeEngine, TransactionLog;
ProcessingChainEntrance = require('../lib/processingchainentrance');
TransactionLog = require('../lib/transactionlog');
TradeEngine = require('../lib/trade_engine');
describe('ProcessingChainEntrance', function() {
beforeEach(function(done) {
this.tlog... | CoffeeScript | JavaScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | 00a0415c2b9bda51c9f49edaedd16aea3284c7e7 | 663 | https://github.com/buttercoin/buttercoin/blob/00a0415c2b9bda51c9f49edaedd16aea3284c7e7/test/processingchainentrance.coffee | 1 | 36 |
buttercoin/buttercoin:test/processingchainentrance.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ProcessingChainEntrance, TradeEngine, TransactionLog;
ProcessingChainEntrance = require('../lib/processingchainentrance');
TransactionLog = require('../lib/transactionlog');
TradeEngine = require('../lib/trade_engine');
describe('ProcessingChainEntrance', f... | ProcessingChainEntrance = require('../lib/processingchainentrance')
TransactionLog = require('../lib/transactionlog')
TradeEngine = require('../lib/trade_engine')
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@tlog = sinon.mock(new TransactionLog())
@replication = sinon.mock({start: (->), send:... | JavaScript | CoffeeScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | 00a0415c2b9bda51c9f49edaedd16aea3284c7e7 | 663 | https://github.com/buttercoin/buttercoin/blob/00a0415c2b9bda51c9f49edaedd16aea3284c7e7/test/processingchainentrance.coffee | 1 | 36 |
buttercoin/buttercoin:test/processingchainentrance.coffee:1:completion | completion | ProcessingChainEntrance = require('../lib/processingchainentrance')
TransactionLog = require('../lib/transactionlog')
TradeEngine = require('../lib/trade_engine')
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@tlog = sinon.mock(new TransactionLog())
@replication = sinon.mock({start: (->), send:... | it 'should intialize the transaction log and replication when starting', (done) ->
@tlog.expects('start').once().returns(then: ->)
@replication.expects('start').once().returns(then: ->)
@pce.start()
done()
it 'should log, replicate, and package a messge upon receiving it', (done) ->
deferred = ... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | 00a0415c2b9bda51c9f49edaedd16aea3284c7e7 | 663 | https://github.com/buttercoin/buttercoin/blob/00a0415c2b9bda51c9f49edaedd16aea3284c7e7/test/processingchainentrance.coffee | 1 | 36 |
buttercoin/buttercoin:test/processingchainentrance.coffee:1:raw_corpus | raw_corpus | ProcessingChainEntrance = require('../lib/processingchainentrance')
Journal = require('../lib/journal')
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal())
@replication = sinon.mock({start: (->), send: (->)})
@pce = new ProcessingChainEntrance(null, @journal.o... | CoffeeScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | 1f186911398a725c15be4770d1a60bffb6454c4e | 663 | https://github.com/buttercoin/buttercoin/blob/1f186911398a725c15be4770d1a60bffb6454c4e/test/processingchainentrance.coffee | 1 | 32 | ||
buttercoin/buttercoin:test/processingchainentrance.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
ProcessingChainEntrance = require('../lib/processingchainentrance')
Journal = require('../lib/journal')
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal())
@replication = sinon.mock({start: (->), send: (->)}... | var Journal, ProcessingChainEntrance;
ProcessingChainEntrance = require('../lib/processingchainentrance');
Journal = require('../lib/journal');
describe('ProcessingChainEntrance', function() {
beforeEach(function(done) {
this.journal = sinon.mock(new Journal());
this.replication = sinon.mock({
start:... | CoffeeScript | JavaScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | 1f186911398a725c15be4770d1a60bffb6454c4e | 663 | https://github.com/buttercoin/buttercoin/blob/1f186911398a725c15be4770d1a60bffb6454c4e/test/processingchainentrance.coffee | 1 | 32 |
buttercoin/buttercoin:test/processingchainentrance.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Journal, ProcessingChainEntrance;
ProcessingChainEntrance = require('../lib/processingchainentrance');
Journal = require('../lib/journal');
describe('ProcessingChainEntrance', function() {
beforeEach(function(done) {
this.journal = sinon.mock(new Journ... | ProcessingChainEntrance = require('../lib/processingchainentrance')
Journal = require('../lib/journal')
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal())
@replication = sinon.mock({start: (->), send: (->)})
@pce = new ProcessingChainEntrance(null, @journal.o... | JavaScript | CoffeeScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | 1f186911398a725c15be4770d1a60bffb6454c4e | 663 | https://github.com/buttercoin/buttercoin/blob/1f186911398a725c15be4770d1a60bffb6454c4e/test/processingchainentrance.coffee | 1 | 32 |
buttercoin/buttercoin:test/processingchainentrance.coffee:1:completion | completion | ProcessingChainEntrance = require('../lib/processingchainentrance')
Journal = require('../lib/journal')
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal())
@replication = sinon.mock({start: (->), send: (->)})
@pce = new ProcessingChainEntrance(null, @journal.o... | @journal.expects('start').once().returns(then: ->)
@replication.expects('start').once().returns(then: ->)
@pce.start()
done()
it 'should log, replicate, and package a messge upon receiving it', (done) ->
message = {}
@journal.expects('record').once().withArgs(message).returns(then: ->)
@re... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | 1f186911398a725c15be4770d1a60bffb6454c4e | 663 | https://github.com/buttercoin/buttercoin/blob/1f186911398a725c15be4770d1a60bffb6454c4e/test/processingchainentrance.coffee | 1 | 32 |
buttercoin/buttercoin:test/processingchainentrance.coffee:1:raw_corpus | raw_corpus | ProcessingChainEntrance = require('../lib/processingchainentrance')
TransactionLog = require('../lib/transactionlog')
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@tlog = sinon.mock(new TransactionLog())
@replication = sinon.mock({start: (->), send: (->)})
@pce = new ProcessingChainEntranc... | CoffeeScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | 390aea79a869c4571274a3711edaad98028d141a | 663 | https://github.com/buttercoin/buttercoin/blob/390aea79a869c4571274a3711edaad98028d141a/test/processingchainentrance.coffee | 1 | 31 | ||
buttercoin/buttercoin:test/processingchainentrance.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
ProcessingChainEntrance = require('../lib/processingchainentrance')
TransactionLog = require('../lib/transactionlog')
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@tlog = sinon.mock(new TransactionLog())
@replication = sinon.mock({start:... | var ProcessingChainEntrance, TransactionLog;
ProcessingChainEntrance = require('../lib/processingchainentrance');
TransactionLog = require('../lib/transactionlog');
describe('ProcessingChainEntrance', function() {
beforeEach(function(done) {
this.tlog = sinon.mock(new TransactionLog());
this.replication = ... | CoffeeScript | JavaScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | 390aea79a869c4571274a3711edaad98028d141a | 663 | https://github.com/buttercoin/buttercoin/blob/390aea79a869c4571274a3711edaad98028d141a/test/processingchainentrance.coffee | 1 | 31 |
buttercoin/buttercoin:test/processingchainentrance.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ProcessingChainEntrance, TransactionLog;
ProcessingChainEntrance = require('../lib/processingchainentrance');
TransactionLog = require('../lib/transactionlog');
describe('ProcessingChainEntrance', function() {
beforeEach(function(done) {
this.tlog = si... | ProcessingChainEntrance = require('../lib/processingchainentrance')
TransactionLog = require('../lib/transactionlog')
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@tlog = sinon.mock(new TransactionLog())
@replication = sinon.mock({start: (->), send: (->)})
@pce = new ProcessingChainEntranc... | JavaScript | CoffeeScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | 390aea79a869c4571274a3711edaad98028d141a | 663 | https://github.com/buttercoin/buttercoin/blob/390aea79a869c4571274a3711edaad98028d141a/test/processingchainentrance.coffee | 1 | 31 |
buttercoin/buttercoin:test/processingchainentrance.coffee:1:completion | completion | ProcessingChainEntrance = require('../lib/processingchainentrance')
TransactionLog = require('../lib/transactionlog')
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@tlog = sinon.mock(new TransactionLog())
@replication = sinon.mock({start: (->), send: (->)})
@pce = new ProcessingChainEntranc... | it 'should intialize the transaction log and replication when starting', (done) ->
@tlog.expects('start').once().returns(then: ->)
@replication.expects('start').once().returns(then: ->)
@pce.start()
done()
it 'should log, replicate, and package a messge upon receiving it', (done) ->
message = {... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | 390aea79a869c4571274a3711edaad98028d141a | 663 | https://github.com/buttercoin/buttercoin/blob/390aea79a869c4571274a3711edaad98028d141a/test/processingchainentrance.coffee | 1 | 31 |
buttercoin/buttercoin:test/processingchainentrance.coffee:1:raw_corpus | raw_corpus | ProcessingChainEntrance = require('../lib/processingchainentrance')
describe 'ProcessingChainEntrance', ->
xit 'should intialize the transaction log and replication when starting'
xit 'should log, replicate, and package a messge upon receiving it' | CoffeeScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | ace4b484991436878bd854700fe8e82b665a3e77 | 663 | https://github.com/buttercoin/buttercoin/blob/ace4b484991436878bd854700fe8e82b665a3e77/test/processingchainentrance.coffee | 1 | 5 | ||
buttercoin/buttercoin:test/processingchainentrance.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
ProcessingChainEntrance = require('../lib/processingchainentrance')
describe 'ProcessingChainEntrance', ->
xit 'should intialize the transaction log and replication when starting'
xit 'should log, replicate, and package a messge upon receiving it'
``` | var ProcessingChainEntrance;
ProcessingChainEntrance = require('../lib/processingchainentrance');
describe('ProcessingChainEntrance', function() {
xit('should intialize the transaction log and replication when starting');
return xit('should log, replicate, and package a messge upon receiving it');
}); | CoffeeScript | JavaScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | ace4b484991436878bd854700fe8e82b665a3e77 | 663 | https://github.com/buttercoin/buttercoin/blob/ace4b484991436878bd854700fe8e82b665a3e77/test/processingchainentrance.coffee | 1 | 5 |
buttercoin/buttercoin:test/processingchainentrance.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ProcessingChainEntrance;
ProcessingChainEntrance = require('../lib/processingchainentrance');
describe('ProcessingChainEntrance', function() {
xit('should intialize the transaction log and replication when starting');
return xit('should log, replicate, an... | ProcessingChainEntrance = require('../lib/processingchainentrance')
describe 'ProcessingChainEntrance', ->
xit 'should intialize the transaction log and replication when starting'
xit 'should log, replicate, and package a messge upon receiving it' | JavaScript | CoffeeScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | ace4b484991436878bd854700fe8e82b665a3e77 | 663 | https://github.com/buttercoin/buttercoin/blob/ace4b484991436878bd854700fe8e82b665a3e77/test/processingchainentrance.coffee | 1 | 5 |
buttercoin/buttercoin:test/processingchainentrance.coffee:1:completion | completion | ProcessingChainEntrance = require('../lib/processingchainentrance') | describe 'ProcessingChainEntrance', ->
xit 'should intialize the transaction log and replication when starting'
xit 'should log, replicate, and package a messge upon receiving it' | CoffeeScript | CoffeeScript | buttercoin/buttercoin | test/processingchainentrance.coffee | MIT | ace4b484991436878bd854700fe8e82b665a3e77 | 663 | https://github.com/buttercoin/buttercoin/blob/ace4b484991436878bd854700fe8e82b665a3e77/test/processingchainentrance.coffee | 1 | 5 |
js2coffee/js2coffee:lib/report_notes.coffee:1:raw_corpus | raw_corpus | {eachGroup} = require('./specs_iterator')
eachGroup (group) ->
return if group.pending
specs = group.specs.filter (s) -> s.meta?.notes
return if specs.length is 0
console.log "## #{group.name}\n"
for spec in specs
console.log "### #{spec.name}\n"
console.log "#{spec.meta.notes}\n"
console.log "... | CoffeeScript | js2coffee/js2coffee | lib/report_notes.coffee | MIT | 98638da5e08d362d7076ee0d5acdf8ebe85ee032 | 2,082 | https://github.com/js2coffee/js2coffee/blob/98638da5e08d362d7076ee0d5acdf8ebe85ee032/lib/report_notes.coffee | 1 | 14 | ||
js2coffee/js2coffee:lib/report_notes.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{eachGroup} = require('./specs_iterator')
eachGroup (group) ->
return if group.pending
specs = group.specs.filter (s) -> s.meta?.notes
return if specs.length is 0
console.log "## #{group.name}\n"
for spec in specs
console.log "### #{spec.name}\n"... | var eachGroup;
({eachGroup} = require('./specs_iterator'));
eachGroup(function(group) {
var i, len, results, spec, specs;
if (group.pending) {
return;
}
specs = group.specs.filter(function(s) {
var ref;
return (ref = s.meta) != null ? ref.notes : void 0;
});
if (specs.length === 0) {
retur... | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/report_notes.coffee | MIT | 98638da5e08d362d7076ee0d5acdf8ebe85ee032 | 2,082 | https://github.com/js2coffee/js2coffee/blob/98638da5e08d362d7076ee0d5acdf8ebe85ee032/lib/report_notes.coffee | 1 | 14 |
js2coffee/js2coffee:lib/report_notes.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var eachGroup;
({eachGroup} = require('./specs_iterator'));
eachGroup(function(group) {
var i, len, results, spec, specs;
if (group.pending) {
return;
}
specs = group.specs.filter(function(s) {
var ref;
return (ref = s.meta) != null ? ref.note... | {eachGroup} = require('./specs_iterator')
eachGroup (group) ->
return if group.pending
specs = group.specs.filter (s) -> s.meta?.notes
return if specs.length is 0
console.log "## #{group.name}\n"
for spec in specs
console.log "### #{spec.name}\n"
console.log "#{spec.meta.notes}\n"
console.log "... | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/report_notes.coffee | MIT | 98638da5e08d362d7076ee0d5acdf8ebe85ee032 | 2,082 | https://github.com/js2coffee/js2coffee/blob/98638da5e08d362d7076ee0d5acdf8ebe85ee032/lib/report_notes.coffee | 1 | 14 |
js2coffee/js2coffee:lib/report_notes.coffee:1:completion | completion | {eachGroup} = require('./specs_iterator')
eachGroup (group) ->
return if group.pending
specs = group.specs.filter (s) -> s.meta?.notes
return if specs.length is 0 | console.log "## #{group.name}\n"
for spec in specs
console.log "### #{spec.name}\n"
console.log "#{spec.meta.notes}\n"
console.log "```js\n// Input:\n#{spec.input}```\n"
console.log "```coffee\n# Output:\n#{spec.output}```\n" | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/report_notes.coffee | MIT | 98638da5e08d362d7076ee0d5acdf8ebe85ee032 | 2,082 | https://github.com/js2coffee/js2coffee/blob/98638da5e08d362d7076ee0d5acdf8ebe85ee032/lib/report_notes.coffee | 1 | 14 |
fragaria/angular-daterangepicker:coffee/daterangepicker.coffee:3:raw_corpus | raw_corpus | el.on('apply', (ev, picker) ->
$timeout(->
$scope.$apply(->
modelCtrl.$setViewValue(
startDate: picker.startDate.toDate()
endDate: picker.endDate.toDate()
)
modelCtrl.$render()
... | CoffeeScript | fragaria/angular-daterangepicker | coffee/daterangepicker.coffee | MIT | f069fc977183341dd5b92719fce28bcd815385df | 517 | https://github.com/fragaria/angular-daterangepicker/blob/f069fc977183341dd5b92719fce28bcd815385df/coffee/daterangepicker.coffee | 88 | 127 | ||
fragaria/angular-daterangepicker:coffee/daterangepicker.coffee:3:completion | completion | el.on('apply', (ev, picker) ->
$timeout(->
$scope.$apply(->
modelCtrl.$setViewValue(
startDate: picker.startDate.toDate()
endDate: picker.endDate.toDate()
)
modelCtrl.$render()
... | ))
)
if attrs.min
$scope.$watch('dateMin', (date) ->
if date
if not modelCtrl.$isEmpty(modelCtrl.$viewValue)
_validateMin(date, modelCtrl.$viewValue.startDate)
opts['minDate'] = moment(date)
els... | CoffeeScript | CoffeeScript | fragaria/angular-daterangepicker | coffee/daterangepicker.coffee | MIT | f069fc977183341dd5b92719fce28bcd815385df | 517 | https://github.com/fragaria/angular-daterangepicker/blob/f069fc977183341dd5b92719fce28bcd815385df/coffee/daterangepicker.coffee | 88 | 127 |
fragaria/angular-daterangepicker:coffee/daterangepicker.coffee:1:raw_corpus | raw_corpus | picker = angular.module('daterangepicker', [])
picker.directive('dateRangePicker', ['$compile', '$timeout', ($compile, $timeout) ->
require: 'ngModel'
restrict: 'A'
scope:
dateMin: '=min'
dateMax: '=max'
opts: '=options'
link: ($scope, element, attrs, modelCtrl) ->
el = ... | CoffeeScript | fragaria/angular-daterangepicker | coffee/daterangepicker.coffee | MIT | 472acd748ea6b41e592ee291ea39cd409b0f9ae6 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/472acd748ea6b41e592ee291ea39cd409b0f9ae6/coffee/daterangepicker.coffee | 1 | 47 | ||
fragaria/angular-daterangepicker:coffee/daterangepicker.coffee:1:completion | completion | picker = angular.module('daterangepicker', [])
picker.directive('dateRangePicker', ['$compile', '$timeout', ($compile, $timeout) ->
require: 'ngModel'
restrict: 'A'
scope:
dateMin: '=min'
dateMax: '=max'
opts: '=options'
link: ($scope, element, attrs, modelCtrl) ->
el = ... | _validateMin = (min, start) ->
min = moment(min)
start = moment(start)
valid = min.isBefore(start) or min.isSame(start, 'day')
modelCtrl.$setValidity('min', valid)
return valid
_validateMax = (max, end) ->
max = moment(max)
end... | CoffeeScript | CoffeeScript | fragaria/angular-daterangepicker | coffee/daterangepicker.coffee | MIT | 472acd748ea6b41e592ee291ea39cd409b0f9ae6 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/472acd748ea6b41e592ee291ea39cd409b0f9ae6/coffee/daterangepicker.coffee | 1 | 47 |
fragaria/angular-daterangepicker:coffee/daterangepicker.coffee:2:raw_corpus | raw_corpus | modelCtrl.$parsers.unshift((val) ->
# Check if input is invalid.
if not _.isObject(val) or not (_.has(val, 'startDate') and _.has(val, 'endDate'))
return modelCtrl.$modelValue
# If min-max set, validate as well.
if $scope.dateMin and val.startDate
... | CoffeeScript | fragaria/angular-daterangepicker | coffee/daterangepicker.coffee | MIT | 472acd748ea6b41e592ee291ea39cd409b0f9ae6 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/472acd748ea6b41e592ee291ea39cd409b0f9ae6/coffee/daterangepicker.coffee | 49 | 87 | ||
fragaria/angular-daterangepicker:coffee/daterangepicker.coffee:2:completion | completion | modelCtrl.$parsers.unshift((val) ->
# Check if input is invalid.
if not _.isObject(val) or not (_.has(val, 'startDate') and _.has(val, 'endDate'))
return modelCtrl.$modelValue
# If min-max set, validate as well.
if $scope.dateMin and val.startDate
... | modelCtrl.$isEmpty = (val) ->
# modelCtrl is empty if val is invalid or any of the ranges are not set.
not val or (val.startDate == null or val.endDate == null)
modelCtrl.$render = ->
if not modelCtrl.$viewValue
return el.val('')
if modelCtrl.$vi... | CoffeeScript | CoffeeScript | fragaria/angular-daterangepicker | coffee/daterangepicker.coffee | MIT | 472acd748ea6b41e592ee291ea39cd409b0f9ae6 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/472acd748ea6b41e592ee291ea39cd409b0f9ae6/coffee/daterangepicker.coffee | 49 | 87 |
octoblu/meshblu:lib/oldUpdateDevice.coffee:1:raw_corpus | raw_corpus | Device = require './models/device'
module.exports = (uuid, params={}, callback=_.noop, dependencies={})->
device = new Device uuid: uuid, dependencies
device.set params
device.save (error) =>
return callback error if error?
device.fetch callback | CoffeeScript | octoblu/meshblu | lib/oldUpdateDevice.coffee | MIT | 494f8e5c6b395879c8e33c0122939d053af84ae7 | 815 | https://github.com/octoblu/meshblu/blob/494f8e5c6b395879c8e33c0122939d053af84ae7/lib/oldUpdateDevice.coffee | 1 | 9 | ||
octoblu/meshblu:lib/oldUpdateDevice.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Device = require './models/device'
module.exports = (uuid, params={}, callback=_.noop, dependencies={})->
device = new Device uuid: uuid, dependencies
device.set params
device.save (error) =>
return callback error if error?
device.fetch callback
`... | var Device;
Device = require('./models/device');
module.exports = function(uuid, params = {}, callback = _.noop, dependencies = {}) {
var device;
device = new Device({
uuid: uuid
}, dependencies);
device.set(params);
return device.save((error) => {
if (error != null) {
return callback(error);
... | CoffeeScript | JavaScript | octoblu/meshblu | lib/oldUpdateDevice.coffee | MIT | 494f8e5c6b395879c8e33c0122939d053af84ae7 | 815 | https://github.com/octoblu/meshblu/blob/494f8e5c6b395879c8e33c0122939d053af84ae7/lib/oldUpdateDevice.coffee | 1 | 9 |
octoblu/meshblu:lib/oldUpdateDevice.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Device;
Device = require('./models/device');
module.exports = function(uuid, params = {}, callback = _.noop, dependencies = {}) {
var device;
device = new Device({
uuid: uuid
}, dependencies);
device.set(params);
return device.save((error) => {
... | Device = require './models/device'
module.exports = (uuid, params={}, callback=_.noop, dependencies={})->
device = new Device uuid: uuid, dependencies
device.set params
device.save (error) =>
return callback error if error?
device.fetch callback | JavaScript | CoffeeScript | octoblu/meshblu | lib/oldUpdateDevice.coffee | MIT | 494f8e5c6b395879c8e33c0122939d053af84ae7 | 815 | https://github.com/octoblu/meshblu/blob/494f8e5c6b395879c8e33c0122939d053af84ae7/lib/oldUpdateDevice.coffee | 1 | 9 |
octoblu/meshblu:lib/oldUpdateDevice.coffee:1:completion | completion | Device = require './models/device'
module.exports = (uuid, params={}, callback=_.noop, dependencies={})->
device = new Device uuid: uuid, dependencies | device.set params
device.save (error) =>
return callback error if error?
device.fetch callback | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/oldUpdateDevice.coffee | MIT | 494f8e5c6b395879c8e33c0122939d053af84ae7 | 815 | https://github.com/octoblu/meshblu/blob/494f8e5c6b395879c8e33c0122939d053af84ae7/lib/oldUpdateDevice.coffee | 1 | 9 |
octoblu/meshblu:lib/oldUpdateDevice.coffee:1:raw_corpus | raw_corpus | Device = require './models/device'
module.exports = (uuid, params={}, callback=_.noop, dependencies={})->
getDevice = dependencies.getDevice ? require './getDevice'
clearCache = dependencies.clearCache ? require './clearCache'
device = new Device uuid: uuid, dependencies
device.set params
device.save (err... | CoffeeScript | octoblu/meshblu | lib/oldUpdateDevice.coffee | MIT | cb391c74d09b0a15a42c95b0dc884034632400d8 | 815 | https://github.com/octoblu/meshblu/blob/cb391c74d09b0a15a42c95b0dc884034632400d8/lib/oldUpdateDevice.coffee | 1 | 13 | ||
octoblu/meshblu:lib/oldUpdateDevice.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Device = require './models/device'
module.exports = (uuid, params={}, callback=_.noop, dependencies={})->
getDevice = dependencies.getDevice ? require './getDevice'
clearCache = dependencies.clearCache ? require './clearCache'
device = new Device uuid: u... | var Device;
Device = require('./models/device');
module.exports = function(uuid, params = {}, callback = _.noop, dependencies = {}) {
var clearCache, device, getDevice, ref, ref1;
getDevice = (ref = dependencies.getDevice) != null ? ref : require('./getDevice');
clearCache = (ref1 = dependencies.clearCache) != ... | CoffeeScript | JavaScript | octoblu/meshblu | lib/oldUpdateDevice.coffee | MIT | cb391c74d09b0a15a42c95b0dc884034632400d8 | 815 | https://github.com/octoblu/meshblu/blob/cb391c74d09b0a15a42c95b0dc884034632400d8/lib/oldUpdateDevice.coffee | 1 | 13 |
octoblu/meshblu:lib/oldUpdateDevice.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Device;
Device = require('./models/device');
module.exports = function(uuid, params = {}, callback = _.noop, dependencies = {}) {
var clearCache, device, getDevice, ref, ref1;
getDevice = (ref = dependencies.getDevice) != null ? ref : require('./getDevice... | Device = require './models/device'
module.exports = (uuid, params={}, callback=_.noop, dependencies={})->
getDevice = dependencies.getDevice ? require './getDevice'
clearCache = dependencies.clearCache ? require './clearCache'
device = new Device uuid: uuid, dependencies
device.set params
device.save (err... | JavaScript | CoffeeScript | octoblu/meshblu | lib/oldUpdateDevice.coffee | MIT | cb391c74d09b0a15a42c95b0dc884034632400d8 | 815 | https://github.com/octoblu/meshblu/blob/cb391c74d09b0a15a42c95b0dc884034632400d8/lib/oldUpdateDevice.coffee | 1 | 13 |
octoblu/meshblu:lib/oldUpdateDevice.coffee:1:completion | completion | Device = require './models/device'
module.exports = (uuid, params={}, callback=_.noop, dependencies={})->
getDevice = dependencies.getDevice ? require './getDevice'
clearCache = dependencies.clearCache ? require './clearCache' | device = new Device uuid: uuid, dependencies
device.set params
device.save (error) =>
return callback error if error?
clearCache uuid, =>
getDevice uuid, callback | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/oldUpdateDevice.coffee | MIT | cb391c74d09b0a15a42c95b0dc884034632400d8 | 815 | https://github.com/octoblu/meshblu/blob/cb391c74d09b0a15a42c95b0dc884034632400d8/lib/oldUpdateDevice.coffee | 1 | 13 |
CaryLandholt/AngularFun:scripts/controllers/personDetails.coffee:1:raw_corpus | raw_corpus | ###global define###
define ['controllers/controllers', 'services/people'], (controllers) ->
'use strict'
controllers.controller 'personDetails', ['$scope', '$rootScope', 'people', ($scope, $rootScope, service) ->
$scope.person = service.person
$scope.onRouteChange = (routeParams) ->
service.getPerson routeP... | CoffeeScript | CaryLandholt/AngularFun | scripts/controllers/personDetails.coffee | MIT | 8a9db5d5208a4acfd264afc641d3ff3e745487d5 | 672 | https://github.com/CaryLandholt/AngularFun/blob/8a9db5d5208a4acfd264afc641d3ff3e745487d5/scripts/controllers/personDetails.coffee | 1 | 11 | ||
CaryLandholt/AngularFun:scripts/controllers/personDetails.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###global define###
define ['controllers/controllers', 'services/people'], (controllers) ->
'use strict'
controllers.controller 'personDetails', ['$scope', '$rootScope', 'people', ($scope, $rootScope, service) ->
$scope.person = service.person
$scope.onR... | /*global define*/
define(['controllers/controllers', 'services/people'], function(controllers) {
'use strict';
return controllers.controller('personDetails', [
'$scope',
'$rootScope',
'people',
function($scope,
$rootScope,
service) {
$scope.person = service.person;
return $scope.... | CoffeeScript | JavaScript | CaryLandholt/AngularFun | scripts/controllers/personDetails.coffee | MIT | 8a9db5d5208a4acfd264afc641d3ff3e745487d5 | 672 | https://github.com/CaryLandholt/AngularFun/blob/8a9db5d5208a4acfd264afc641d3ff3e745487d5/scripts/controllers/personDetails.coffee | 1 | 11 |
CaryLandholt/AngularFun:scripts/controllers/personDetails.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*global define*/
define(['controllers/controllers', 'services/people'], function(controllers) {
'use strict';
return controllers.controller('personDetails', [
'$scope',
'$rootScope',
'people',
function($scope,
$rootScope,
service) {
... | ###global define###
define ['controllers/controllers', 'services/people'], (controllers) ->
'use strict'
controllers.controller 'personDetails', ['$scope', '$rootScope', 'people', ($scope, $rootScope, service) ->
$scope.person = service.person
$scope.onRouteChange = (routeParams) ->
service.getPerson routeP... | JavaScript | CoffeeScript | CaryLandholt/AngularFun | scripts/controllers/personDetails.coffee | MIT | 8a9db5d5208a4acfd264afc641d3ff3e745487d5 | 672 | https://github.com/CaryLandholt/AngularFun/blob/8a9db5d5208a4acfd264afc641d3ff3e745487d5/scripts/controllers/personDetails.coffee | 1 | 11 |
CaryLandholt/AngularFun:scripts/controllers/personDetails.coffee:1:completion | completion | ###global define###
define ['controllers/controllers', 'services/people'], (controllers) ->
'use strict' | controllers.controller 'personDetails', ['$scope', '$rootScope', 'people', ($scope, $rootScope, service) ->
$scope.person = service.person
$scope.onRouteChange = (routeParams) ->
service.getPerson routeParams.id
] | CoffeeScript | CoffeeScript | CaryLandholt/AngularFun | scripts/controllers/personDetails.coffee | MIT | 8a9db5d5208a4acfd264afc641d3ff3e745487d5 | 672 | https://github.com/CaryLandholt/AngularFun/blob/8a9db5d5208a4acfd264afc641d3ff3e745487d5/scripts/controllers/personDetails.coffee | 1 | 11 |
CaryLandholt/AngularFun:scripts/controllers/personDetails.coffee:1:raw_corpus | raw_corpus | ###global define###
define ['controllers/controllers', 'services/people'], (controllers) ->
'use strict'
controllers.controller 'personDetails', ['$scope', '$rootScope', 'people', ($scope, $rootScope, service) ->
$scope.person = service.person
$rootScope.$on 'personDetails$routeChangeSuccess', (event, currentR... | CoffeeScript | CaryLandholt/AngularFun | scripts/controllers/personDetails.coffee | MIT | f71adf9c94b291059af8de342e725937457a8170 | 672 | https://github.com/CaryLandholt/AngularFun/blob/f71adf9c94b291059af8de342e725937457a8170/scripts/controllers/personDetails.coffee | 1 | 14 | ||
CaryLandholt/AngularFun:scripts/controllers/personDetails.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###global define###
define ['controllers/controllers', 'services/people'], (controllers) ->
'use strict'
controllers.controller 'personDetails', ['$scope', '$rootScope', 'people', ($scope, $rootScope, service) ->
$scope.person = service.person
$rootScope... | /*global define*/
define(['controllers/controllers', 'services/people'], function(controllers) {
'use strict';
return controllers.controller('personDetails', [
'$scope',
'$rootScope',
'people',
function($scope,
$rootScope,
service) {
$scope.person = service.person;
return $rootSc... | CoffeeScript | JavaScript | CaryLandholt/AngularFun | scripts/controllers/personDetails.coffee | MIT | f71adf9c94b291059af8de342e725937457a8170 | 672 | https://github.com/CaryLandholt/AngularFun/blob/f71adf9c94b291059af8de342e725937457a8170/scripts/controllers/personDetails.coffee | 1 | 14 |
CaryLandholt/AngularFun:scripts/controllers/personDetails.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*global define*/
define(['controllers/controllers', 'services/people'], function(controllers) {
'use strict';
return controllers.controller('personDetails', [
'$scope',
'$rootScope',
'people',
function($scope,
$rootScope,
service) {
... | ###global define###
define ['controllers/controllers', 'services/people'], (controllers) ->
'use strict'
controllers.controller 'personDetails', ['$scope', '$rootScope', 'people', ($scope, $rootScope, service) ->
$scope.person = service.person
$rootScope.$on 'personDetails$routeChangeSuccess', (event, currentR... | JavaScript | CoffeeScript | CaryLandholt/AngularFun | scripts/controllers/personDetails.coffee | MIT | f71adf9c94b291059af8de342e725937457a8170 | 672 | https://github.com/CaryLandholt/AngularFun/blob/f71adf9c94b291059af8de342e725937457a8170/scripts/controllers/personDetails.coffee | 1 | 14 |
CaryLandholt/AngularFun:scripts/controllers/personDetails.coffee:1:completion | completion | ###global define###
define ['controllers/controllers', 'services/people'], (controllers) ->
'use strict'
controllers.controller 'personDetails', ['$scope', '$rootScope', 'people', ($scope, $rootScope, service) ->
$scope.person = service.person | $rootScope.$on 'personDetails$routeChangeSuccess', (event, currentRoute, priorRoute) ->
id = currentRoute.params.id
service.getPerson id
$scope.$broadcast 'changeTab#people'
] | CoffeeScript | CoffeeScript | CaryLandholt/AngularFun | scripts/controllers/personDetails.coffee | MIT | f71adf9c94b291059af8de342e725937457a8170 | 672 | https://github.com/CaryLandholt/AngularFun/blob/f71adf9c94b291059af8de342e725937457a8170/scripts/controllers/personDetails.coffee | 1 | 14 |
CaryLandholt/AngularFun:scripts/controllers/personDetails.coffee:1:raw_corpus | raw_corpus | ###global define###
define ['controllers/controllers', 'services/people'], (controllers) ->
'use strict'
controllers.controller 'personDetails', ['$scope', '$rootScope', 'people', ($scope, $rootScope, service) ->
$scope.person = service.person
$rootScope.$on 'personDetails$afterRouteChange', (event, currentRou... | CoffeeScript | CaryLandholt/AngularFun | scripts/controllers/personDetails.coffee | MIT | 8807e89f28a76910be41e712bbf14fe40c34fa1a | 672 | https://github.com/CaryLandholt/AngularFun/blob/8807e89f28a76910be41e712bbf14fe40c34fa1a/scripts/controllers/personDetails.coffee | 1 | 14 | ||
CaryLandholt/AngularFun:scripts/controllers/personDetails.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###global define###
define ['controllers/controllers', 'services/people'], (controllers) ->
'use strict'
controllers.controller 'personDetails', ['$scope', '$rootScope', 'people', ($scope, $rootScope, service) ->
$scope.person = service.person
$rootScope... | /*global define*/
define(['controllers/controllers', 'services/people'], function(controllers) {
'use strict';
return controllers.controller('personDetails', [
'$scope',
'$rootScope',
'people',
function($scope,
$rootScope,
service) {
$scope.person = service.person;
return $rootSc... | CoffeeScript | JavaScript | CaryLandholt/AngularFun | scripts/controllers/personDetails.coffee | MIT | 8807e89f28a76910be41e712bbf14fe40c34fa1a | 672 | https://github.com/CaryLandholt/AngularFun/blob/8807e89f28a76910be41e712bbf14fe40c34fa1a/scripts/controllers/personDetails.coffee | 1 | 14 |
CaryLandholt/AngularFun:scripts/controllers/personDetails.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*global define*/
define(['controllers/controllers', 'services/people'], function(controllers) {
'use strict';
return controllers.controller('personDetails', [
'$scope',
'$rootScope',
'people',
function($scope,
$rootScope,
service) {
... | ###global define###
define ['controllers/controllers', 'services/people'], (controllers) ->
'use strict'
controllers.controller 'personDetails', ['$scope', '$rootScope', 'people', ($scope, $rootScope, service) ->
$scope.person = service.person
$rootScope.$on 'personDetails$afterRouteChange', (event, currentRou... | JavaScript | CoffeeScript | CaryLandholt/AngularFun | scripts/controllers/personDetails.coffee | MIT | 8807e89f28a76910be41e712bbf14fe40c34fa1a | 672 | https://github.com/CaryLandholt/AngularFun/blob/8807e89f28a76910be41e712bbf14fe40c34fa1a/scripts/controllers/personDetails.coffee | 1 | 14 |
CaryLandholt/AngularFun:scripts/controllers/personDetails.coffee:1:completion | completion | ###global define###
define ['controllers/controllers', 'services/people'], (controllers) ->
'use strict'
controllers.controller 'personDetails', ['$scope', '$rootScope', 'people', ($scope, $rootScope, service) ->
$scope.person = service.person | $rootScope.$on 'personDetails$afterRouteChange', (event, currentRoute, priorRoute) ->
id = currentRoute.params.id
service.getPerson id
$scope.$emit 'changeTab#people'
] | CoffeeScript | CoffeeScript | CaryLandholt/AngularFun | scripts/controllers/personDetails.coffee | MIT | 8807e89f28a76910be41e712bbf14fe40c34fa1a | 672 | https://github.com/CaryLandholt/AngularFun/blob/8807e89f28a76910be41e712bbf14fe40c34fa1a/scripts/controllers/personDetails.coffee | 1 | 14 |
oozcitak/xmlbuilder-js:src/XMLElement.coffee:1:raw_corpus | raw_corpus | module.exports = class XMLElement extends XMLNode
# Initializes a new instance of `XMLElement`
#
# `parent` the parent node
# `name` element name
# `attributes` an object containing name/value pairs of attributes
constructor: (parent, name, attributes) ->
super parent
if not name?
throw new... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLElement.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLElement.coffee | 9 | 58 | ||
oozcitak/xmlbuilder-js:src/XMLElement.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class XMLElement extends XMLNode
# Initializes a new instance of `XMLElement`
#
# `parent` the parent node
# `name` element name
# `attributes` an object containing name/value pairs of attributes
constructor: (parent, name, attribut... | var XMLElement;
module.exports = XMLElement = (function() {
class XMLElement extends XMLNode {
// Initializes a new instance of `XMLElement`
// `parent` the parent node
// `name` element name
// `attributes` an object containing name/value pairs of attributes
constructor(parent, name, attributes... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | src/XMLElement.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLElement.coffee | 9 | 58 |
oozcitak/xmlbuilder-js:src/XMLElement.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var XMLElement;
module.exports = XMLElement = (function() {
class XMLElement extends XMLNode {
// Initializes a new instance of `XMLElement`
// `parent` the parent node
// `name` element name
// `attributes` an object containing name/value pairs... | module.exports = class XMLElement extends XMLNode
# Initializes a new instance of `XMLElement`
#
# `parent` the parent node
# `name` element name
# `attributes` an object containing name/value pairs of attributes
constructor: (parent, name, attributes) ->
super parent
if not name?
throw new... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLElement.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLElement.coffee | 9 | 58 |
oozcitak/xmlbuilder-js:src/XMLElement.coffee:1:completion | completion | module.exports = class XMLElement extends XMLNode
# Initializes a new instance of `XMLElement`
#
# `parent` the parent node
# `name` element name
# `attributes` an object containing name/value pairs of attributes
constructor: (parent, name, attributes) ->
super parent
if not name?
throw new... | @documentObject = parent
parent.rootObject = @
# set dtd name
if parent.children
for child in parent.children
if child.type is NodeType.DocType
child.name = @name
break
# DOM level 1
Object.defineProperty @::, 'tagName', get: () -> @name
# DOM level 4... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLElement.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLElement.coffee | 9 | 58 |
oozcitak/xmlbuilder-js:src/XMLElement.coffee:2:raw_corpus | raw_corpus | # Creates and returns a deep clone of `this`
#
clone: () ->
clonedSelf = Object.create @
# remove document element
if clonedSelf.isRoot
clonedSelf.documentObject = null
# clone attributes
clonedSelf.attribs = {}
for own attName, att of @attribs
clonedSelf.attribs[attName] = att... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLElement.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLElement.coffee | 59 | 108 | ||
oozcitak/xmlbuilder-js:src/XMLElement.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Creates and returns a deep clone of `this`
#
clone: () ->
clonedSelf = Object.create @
# remove document element
if clonedSelf.isRoot
clonedSelf.documentObject = null
# clone attributes
clonedSelf.attribs = {}
for own attName... | // Creates and returns a deep clone of `this`
var hasProp = {}.hasOwnProperty;
({
clone: function() {
var att, attName, clonedSelf, ref;
clonedSelf = Object.create(this);
// remove document element
if (clonedSelf.isRoot) {
clonedSelf.documentObject = null;
}
// clone attributes
clo... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | src/XMLElement.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLElement.coffee | 59 | 108 |
oozcitak/xmlbuilder-js:src/XMLElement.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Creates and returns a deep clone of `this`
var hasProp = {}.hasOwnProperty;
({
clone: function() {
var att, attName, clonedSelf, ref;
clonedSelf = Object.create(this);
// remove document element
if (clonedSelf.isRoot) {
clonedSelf.docum... | # Creates and returns a deep clone of `this`
#
clone: () ->
clonedSelf = Object.create @
# remove document element
if clonedSelf.isRoot
clonedSelf.documentObject = null
# clone attributes
clonedSelf.attribs = {}
for own attName, att of @attribs
clonedSelf.attribs[attName] = att... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLElement.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLElement.coffee | 59 | 108 |
oozcitak/xmlbuilder-js:src/XMLElement.coffee:2:completion | completion | # Creates and returns a deep clone of `this`
#
clone: () ->
clonedSelf = Object.create @
# remove document element
if clonedSelf.isRoot
clonedSelf.documentObject = null
# clone attributes
clonedSelf.attribs = {}
for own attName, att of @attribs
clonedSelf.attribs[attName] = att... | #
# `name` attribute name
# `value` attribute value
attribute: (name, value) ->
name = getValue(name) if name?
if isObject name # expand if object
for own attName, attValue of name
@attribute attName, attValue
else
value = value.apply() if isFunction value
if @options.keepNu... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLElement.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLElement.coffee | 59 | 108 |
oozcitak/xmlbuilder-js:src/XMLElement.coffee:3:raw_corpus | raw_corpus | if not name?
throw new Error "Missing attribute name. " + @debugInfo()
name = getValue name
if Array.isArray name # expand if array
for attName in name
delete @attribs[attName]
else
delete @attribs[name]
return @
# Converts the XML fragment to string
#
# `options.pret... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLElement.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLElement.coffee | 109 | 158 | ||
oozcitak/xmlbuilder-js:src/XMLElement.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if not name?
throw new Error "Missing attribute name. " + @debugInfo()
name = getValue name
if Array.isArray name # expand if array
for attName in name
delete @attribs[attName]
else
delete @attribs[name]
return @
# ... | var attName, i, len, name;
if (typeof name === "undefined" || name === null) {
throw new Error("Missing attribute name. " + this.debugInfo());
}
name = getValue(name);
if (Array.isArray(name)) { // expand if array
for (i = 0, len = name.length; i < len; i++) {
attName = name[i];
delete this.attribs[attNa... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | src/XMLElement.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLElement.coffee | 109 | 158 |
oozcitak/xmlbuilder-js:src/XMLElement.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var attName, i, len, name;
if (typeof name === "undefined" || name === null) {
throw new Error("Missing attribute name. " + this.debugInfo());
}
name = getValue(name);
if (Array.isArray(name)) { // expand if array
for (i = 0, len = name.length; i < len; i++)... | if not name?
throw new Error "Missing attribute name. " + @debugInfo()
name = getValue name
if Array.isArray name # expand if array
for attName in name
delete @attribs[attName]
else
delete @attribs[name]
return @
# Converts the XML fragment to string
#
# `options.pret... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLElement.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLElement.coffee | 109 | 158 |
oozcitak/xmlbuilder-js:src/XMLElement.coffee:3:completion | completion | if not name?
throw new Error "Missing attribute name. " + @debugInfo()
name = getValue name
if Array.isArray name # expand if array
for attName in name
delete @attribs[attName]
else
delete @attribs[name]
return @
# Converts the XML fragment to string
#
# `options.pret... | att: (name, value) -> @attribute name, value
a: (name, value) -> @attribute name, value
# DOM Level 1
getAttribute: (name) -> if @attribs.hasOwnProperty(name) then @attribs[name].value else null
setAttribute: (name, value) -> throw new Error "This DOM method is not implemented." + @debugInfo()
getAttributeN... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLElement.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLElement.coffee | 109 | 158 |
oozcitak/xmlbuilder-js:src/XMLElement.coffee:4:raw_corpus | raw_corpus | setIdAttributeNode: (idAttr, isId) -> throw new Error "This DOM method is not implemented." + @debugInfo()
# DOM Level 4
getElementsByTagName: (tagname) -> throw new Error "This DOM method is not implemented." + @debugInfo()
getElementsByTagNameNS: (namespaceURI, localName) -> throw new Error "This DOM method i... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLElement.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLElement.coffee | 159 | 178 | ||
oozcitak/xmlbuilder-js:src/XMLElement.coffee:4:completion | completion | setIdAttributeNode: (idAttr, isId) -> throw new Error "This DOM method is not implemented." + @debugInfo()
# DOM Level 4
getElementsByTagName: (tagname) -> throw new Error "This DOM method is not implemented." + @debugInfo()
getElementsByTagNameNS: (namespaceURI, localName) -> throw new Error "This DOM method i... | if not super.isEqualNode(node) then return false
if node.namespaceURI isnt @namespaceURI then return false
if node.prefix isnt @prefix then return false
if node.localName isnt @localName then return false
if node.attribs.length isnt @attribs.length then return false
for i in [0..@attribs.length - 1... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLElement.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLElement.coffee | 159 | 178 |
oozcitak/xmlbuilder-js:src/XMLElement.coffee:4:raw_corpus | raw_corpus | setIdAttributeNode: (idAttr, isId) -> throw new Error "This DOM method is not implemented." + @debugInfo()
# DOM Level 4
getElementsByTagName: (tagname) -> throw new Error "This DOM method is not implemented." + @debugInfo()
getElementsByTagNameNS: (namespaceURI, localName) -> throw new Error "This DOM method i... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLElement.coffee | MIT | 731c0e0c4226598187e6577969b815a22663d695 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/731c0e0c4226598187e6577969b815a22663d695/src/XMLElement.coffee | 159 | 165 | ||
oozcitak/xmlbuilder-js:src/XMLElement.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
setIdAttributeNode: (idAttr, isId) -> throw new Error "This DOM method is not implemented." + @debugInfo()
# DOM Level 4
getElementsByTagName: (tagname) -> throw new Error "This DOM method is not implemented." + @debugInfo()
getElementsByTagNameNS: (names... | ({
setIdAttributeNode: function(idAttr, isId) {
throw new Error("This DOM method is not implemented." + this.debugInfo()({
// DOM Level 4
getElementsByTagName: function(tagname) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
},
getElementsByTagNameNS: ... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | src/XMLElement.coffee | MIT | 731c0e0c4226598187e6577969b815a22663d695 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/731c0e0c4226598187e6577969b815a22663d695/src/XMLElement.coffee | 159 | 165 |
oozcitak/xmlbuilder-js:src/XMLElement.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
setIdAttributeNode: function(idAttr, isId) {
throw new Error("This DOM method is not implemented." + this.debugInfo()({
// DOM Level 4
getElementsByTagName: function(tagname) {
throw new Error("This DOM method is not implemented." + thi... | setIdAttributeNode: (idAttr, isId) -> throw new Error "This DOM method is not implemented." + @debugInfo()
# DOM Level 4
getElementsByTagName: (tagname) -> throw new Error "This DOM method is not implemented." + @debugInfo()
getElementsByTagNameNS: (namespaceURI, localName) -> throw new Error "This DOM method i... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLElement.coffee | MIT | 731c0e0c4226598187e6577969b815a22663d695 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/731c0e0c4226598187e6577969b815a22663d695/src/XMLElement.coffee | 159 | 165 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.