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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jashkenas/coffeescript:test/support/abstract_syntax_tree_helpers.coffee:1:completion | completion | # Helpers to get AST nodes for a string of code. The root node is always a
# `Block` node, so for brevity in the tests return its children from
# `expressions`.
getAstExpressions = (code) -> | ast = CoffeeScript.compile code, ast: yes
ast.expressions
exports.getExpressionAst = (code) -> getAstExpressions(code)[0] | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/support/abstract_syntax_tree_helpers.coffee | MIT | 4ba1be131c0cf368f807ebd485135f3505a3cbd3 | 16,577 | https://github.com/jashkenas/coffeescript/blob/4ba1be131c0cf368f807ebd485135f3505a3cbd3/test/support/abstract_syntax_tree_helpers.coffee | 1 | 8 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.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/directives/directives.widgetError.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | 1 | 39 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.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 ... | replace: false
templateUrl: '/partials/widgetError.html'
link: (scope, element, attrs) ->
$widgetError = $(element)
$errorContainer = $widgetError.find('.widget-error-container')
$widget = $widgetError.parent()
$bang = $widgetError.find('.fa-exclamation')... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | 1 | 39 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee:2:raw_corpus | raw_corpus | # Resize Reload
reloadSize = Math.min(13, Math.floor(widgetBodyHeight / 4))
$reload.css('font-size', reloadSize)
# Show/Hide message
if scope.widget.showWidgetErrors
errorMessageLength = $widgetError.width() * widgetBodyHeight / 512
... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | 41 | 80 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee:2:completion | completion | # Resize Reload
reloadSize = Math.min(13, Math.floor(widgetBodyHeight / 4))
$reload.css('font-size', reloadSize)
# Show/Hide message
if scope.widget.showWidgetErrors
errorMessageLength = $widgetError.width() * widgetBodyHeight / 512
... | scope.shortErrorMessage = scope.errorMessage
else
scope.shortErrorMessage = scope.errorMessage.substring(0, errorMessageLength - 3) + '...'
# Vertical align
topPadding = (widgetBodyHeight - $errorContainer.height()) / 3
$errorC... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | 41 | 80 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee:1:raw_corpus | raw_corpus | ###
# Copyright (c) 2013-2015 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | MIT | d9f6710d26e1473dc1dab805685dd5b572fead4a | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/d9f6710d26e1473dc1dab805685dd5b572fead4a/cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | 1 | 39 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee:1:completion | completion | ###
# Copyright (c) 2013-2015 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | replace: false
templateUrl: '/partials/widgetError.html'
link: (scope, element, attrs) ->
$widgetError = $(element)
$errorContainer = $widgetError.find('.widget-error-container')
$widget = $widgetError.parent()
$bang = $widgetError.find('.fa-exclamation')... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | MIT | d9f6710d26e1473dc1dab805685dd5b572fead4a | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/d9f6710d26e1473dc1dab805685dd5b572fead4a/cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | 1 | 39 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee:2:raw_corpus | raw_corpus | # Resize Reload
reloadSize = Math.min(13, Math.floor(widgetBodyHeight / 4))
$reload.css('font-size', reloadSize)
# Show/Hide message
if scope.widget.showWidgetErrors
errorMessageLength = $widgetError.width() * widgetBodyHeight / 512
... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | MIT | 08680403c1ab72b7789517426293681c2224eada | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/08680403c1ab72b7789517426293681c2224eada/cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | 41 | 80 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee:2:completion | completion | # Resize Reload
reloadSize = Math.min(13, Math.floor(widgetBodyHeight / 4))
$reload.css('font-size', reloadSize)
# Show/Hide message
if scope.widget.showWidgetErrors
errorMessageLength = $widgetError.width() * widgetBodyHeight / 512
... | scope.shortErrorMessage = scope.errorMessage
else
scope.shortErrorMessage = scope.errorMessage.substring(0, errorMessageLength - 3) + '...'
# Vertical align
topPadding = (widgetBodyHeight - $errorContainer.height()) / 3
$errorC... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | MIT | 08680403c1ab72b7789517426293681c2224eada | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/08680403c1ab72b7789517426293681c2224eada/cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | 41 | 80 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee:2:raw_corpus | raw_corpus | # Resize Reload
reloadSize = Math.min(13, Math.floor(widgetBodyHeight / 4))
$reload.css('font-size', reloadSize)
# Show/Hide message
if scope.widget.showWidgetErrors
errorMessageLength = $widgetError.width() * widgetBodyHeight / 512
... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | MIT | bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d/cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | 41 | 80 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee:2:completion | completion | # Resize Reload
reloadSize = Math.min(13, Math.floor(widgetBodyHeight / 4))
$reload.css('font-size', reloadSize)
# Show/Hide message
if scope.widget.showWidgetErrors
errorMessageLength = $widgetError.width() * widgetBodyHeight / 512
... | scope.shortErrorMessage = scope.errorMessage
else
scope.shortErrorMessage = scope.errorMessage.substring(0, errorMessageLength - 3) + '...'
# Vertical align
topPadding = (widgetBodyHeight - $errorContainer.height()) / 3
$errorC... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | MIT | bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d/cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | 41 | 80 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee:1:raw_corpus | raw_corpus | ###
# Copyright (c) 2013-2015 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | 1 | 50 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee:1:completion | completion | ###
# Copyright (c) 2013-2015 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | $widget = $widgetError.parent()
$bang = $widgetError.find('.fa-exclamation')
$reload = $widgetError.find('.widget-reload')
$message = $widgetError.find('.widget-error-message')
sizer = ->
$title = $widget.find('.title')
$footer = $widget.f... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | 1 | 50 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee:2:raw_corpus | raw_corpus | else if scope.dataSourceErrorMessage.length < errorMessageLength
scope.shortErrorMessage = scope.dataSourceErrorMessage
else
scope.shortErrorMessage = scope.dataSourceErrorMessage.substring(0, errorMessageLength - 3) + '...'
# Vertical... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | 51 | 74 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee:2:completion | completion | else if scope.dataSourceErrorMessage.length < errorMessageLength
scope.shortErrorMessage = scope.dataSourceErrorMessage
else
scope.shortErrorMessage = scope.dataSourceErrorMessage.substring(0, errorMessageLength - 3) + '...'
# Vertical... | sizer()
, 65)
# Run now & again in 100ms
sizer()
timer = $timeout(sizer, 100)
scope.$on '$destroy', ->
$timeout.cancel timer
return
} | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/dashboards/directives/directives.widgetError.coffee | 51 | 74 |
AriaMinaei/pretty-error:test/parsed-error.coffee:1:raw_corpus | raw_corpus | error = (what) ->
if typeof what is 'string'
return error -> throw Error what
else if what instanceof Function
try
do what
return null
catch e
return e
else
throw Error "bad argument for error"
ParsedError = mod 'parsed-error'
describe "constructor()"
it "should accept Error() instances", ->
(... | CoffeeScript | AriaMinaei/pretty-error | test/parsed-error.coffee | MIT | 802927b6b05dbc95684e9ca0f3f346f52827ff56 | 1,524 | https://github.com/AriaMinaei/pretty-error/blob/802927b6b05dbc95684e9ca0f3f346f52827ff56/test/parsed-error.coffee | 5 | 54 | ||
AriaMinaei/pretty-error:test/parsed-error.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
error = (what) ->
if typeof what is 'string'
return error -> throw Error what
else if what instanceof Function
try
do what
return null
catch e
return e
else
throw Error "bad argument for error"
ParsedError = mod 'parsed-error'
describe "co... | var ParsedError, error;
error = function(what) {
var e;
if (typeof what === 'string') {
return error(function() {
throw Error(what);
});
} else if (what instanceof Function) {
try {
what();
return null;
} catch (error1) {
e = error1;
return e;
}
} else {
th... | CoffeeScript | JavaScript | AriaMinaei/pretty-error | test/parsed-error.coffee | MIT | 802927b6b05dbc95684e9ca0f3f346f52827ff56 | 1,524 | https://github.com/AriaMinaei/pretty-error/blob/802927b6b05dbc95684e9ca0f3f346f52827ff56/test/parsed-error.coffee | 5 | 54 |
AriaMinaei/pretty-error:test/parsed-error.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ParsedError, error;
error = function(what) {
var e;
if (typeof what === 'string') {
return error(function() {
throw Error(what);
});
} else if (what instanceof Function) {
try {
what();
return null;
} catch (error1) {
... | error = (what) ->
if typeof what is 'string'
return error -> throw Error what
else if what instanceof Function
try
do what
return null
catch e
return e
else
throw Error "bad argument for error"
ParsedError = mod 'parsed-error'
describe "constructor()"
it "should accept Error() instances", ->
(... | JavaScript | CoffeeScript | AriaMinaei/pretty-error | test/parsed-error.coffee | MIT | 802927b6b05dbc95684e9ca0f3f346f52827ff56 | 1,524 | https://github.com/AriaMinaei/pretty-error/blob/802927b6b05dbc95684e9ca0f3f346f52827ff56/test/parsed-error.coffee | 5 | 54 |
AriaMinaei/pretty-error:test/parsed-error.coffee:1:completion | completion | error = (what) ->
if typeof what is 'string'
return error -> throw Error what
else if what instanceof Function
try
do what
return null
catch e
return e
else
throw Error "bad argument for error"
ParsedError = mod 'parsed-error'
describe "constructor()"
it "should accept Error() instances", ->
(... | (-> e = new ParsedError 'some string').should.not.throw()
describe "message"
it "should return the original error message", ->
e = new ParsedError error 'a'
e.message.should.equal 'a'
describe "kind"
it "should return 'Error' for normal error", ->
e = new ParsedError error 'a'
e.kind.should.equal 'Error'
it "s... | CoffeeScript | CoffeeScript | AriaMinaei/pretty-error | test/parsed-error.coffee | MIT | 802927b6b05dbc95684e9ca0f3f346f52827ff56 | 1,524 | https://github.com/AriaMinaei/pretty-error/blob/802927b6b05dbc95684e9ca0f3f346f52827ff56/test/parsed-error.coffee | 5 | 54 |
AriaMinaei/pretty-error:test/parsed-error.coffee:2:raw_corpus | raw_corpus | it "should return original error arguments", ->
e = new ParsedError error -> a.b = c
expect(e.arguments).to.be.like ['a']
describe "stack"
it "should return original error stack", ->
e = new ParsedError error -> a.b = c
expect(e.stack).to.equal e.error.stack
describe "trace"
it "should include correct informati... | CoffeeScript | AriaMinaei/pretty-error | test/parsed-error.coffee | MIT | 802927b6b05dbc95684e9ca0f3f346f52827ff56 | 1,524 | https://github.com/AriaMinaei/pretty-error/blob/802927b6b05dbc95684e9ca0f3f346f52827ff56/test/parsed-error.coffee | 55 | 90 | ||
AriaMinaei/pretty-error:test/parsed-error.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it "should return original error arguments", ->
e = new ParsedError error -> a.b = c
expect(e.arguments).to.be.like ['a']
describe "stack"
it "should return original error stack", ->
e = new ParsedError error -> a.b = c
expect(e.stack).to.equal e.error.stac... | it("should return original error arguments", function() {
var e;
e = new ParsedError(error(function() {
return a.b = c;
}));
return expect(e.arguments).to.be.like(['a']);
});
describe("stack");
it("should return original error stack", function() {
var e;
e = new ParsedError(error(function() {
retu... | CoffeeScript | JavaScript | AriaMinaei/pretty-error | test/parsed-error.coffee | MIT | 802927b6b05dbc95684e9ca0f3f346f52827ff56 | 1,524 | https://github.com/AriaMinaei/pretty-error/blob/802927b6b05dbc95684e9ca0f3f346f52827ff56/test/parsed-error.coffee | 55 | 90 |
AriaMinaei/pretty-error:test/parsed-error.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it("should return original error arguments", function() {
var e;
e = new ParsedError(error(function() {
return a.b = c;
}));
return expect(e.arguments).to.be.like(['a']);
});
describe("stack");
it("should return original error stack", function() {
v... | it "should return original error arguments", ->
e = new ParsedError error -> a.b = c
expect(e.arguments).to.be.like ['a']
describe "stack"
it "should return original error stack", ->
e = new ParsedError error -> a.b = c
expect(e.stack).to.equal e.error.stack
describe "trace"
it "should include correct informati... | JavaScript | CoffeeScript | AriaMinaei/pretty-error | test/parsed-error.coffee | MIT | 802927b6b05dbc95684e9ca0f3f346f52827ff56 | 1,524 | https://github.com/AriaMinaei/pretty-error/blob/802927b6b05dbc95684e9ca0f3f346f52827ff56/test/parsed-error.coffee | 55 | 90 |
AriaMinaei/pretty-error:test/parsed-error.coffee:2:completion | completion | it "should return original error arguments", ->
e = new ParsedError error -> a.b = c
expect(e.arguments).to.be.like ['a']
describe "stack"
it "should return original error stack", ->
e = new ParsedError error -> a.b = c
expect(e.stack).to.equal e.error.stack
describe "trace"
it "should include correct informati... | item.should.include.keys 'original',
'what', 'path', 'addr',
'file', 'dir', 'col',
'line', 'jsCol', 'jsLine'
'packageName', 'shortenedPath', 'shortenedAddr'
item.path.should.equal module.filename.replace(/[\\]+/g, '/')
item.line.should.be.a 'number'
item.col.should.be.a 'number'
describe "_rectifyPath()"
... | CoffeeScript | CoffeeScript | AriaMinaei/pretty-error | test/parsed-error.coffee | MIT | 802927b6b05dbc95684e9ca0f3f346f52827ff56 | 1,524 | https://github.com/AriaMinaei/pretty-error/blob/802927b6b05dbc95684e9ca0f3f346f52827ff56/test/parsed-error.coffee | 55 | 90 |
xhan/qqbot:src/dispatcher.coffee:1:raw_corpus | raw_corpus | Log = require 'log'
log = new Log('debug')
EventEmitter = require('events').EventEmitter
requireForce = (module_name) ->
try
delete require.cache[require.resolve(module_name)]
require(module_name)
catch error
log.error "Load module #{JSON.stringify module_name} failed"
log.error JSON.stringify err... | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/dispatcher.coffee | 1 | 50 | ||
xhan/qqbot:src/dispatcher.coffee:1:completion | completion | Log = require 'log'
log = new Log('debug')
EventEmitter = require('events').EventEmitter
requireForce = (module_name) ->
try
delete require.cache[require.resolve(module_name)]
require(module_name)
catch error
log.error "Load module #{JSON.stringify module_name} failed"
log.error JSON.stringify err... | for plugin in @obj_listeners
[obj,method] = plugin
obj[method](params...)
catch error
log.error error
###
针对 对象的方法
请传入 [obj,'methodname']
methodname 直接调用 methodname 会破坏内部变量 this.xxx
###
add_listener: (listener)->
if listener instanceof Function
... | CoffeeScript | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/dispatcher.coffee | 1 | 50 |
xhan/qqbot:src/dispatcher.coffee:2:raw_corpus | raw_corpus | @listeners = []
for plugin_name in @plugins
log.debug "Loading Plugin #{plugin_name}"
plugin = requireForce "../plugins/#{plugin_name}"
if plugin
if plugin instanceof Function
@listeners.push plugin
else
# init , received, stop 函数
@l... | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/dispatcher.coffee | 51 | 65 | ||
xhan/qqbot:src/dispatcher.coffee:2:completion | completion | @listeners = []
for plugin_name in @plugins
log.debug "Loading Plugin #{plugin_name}"
plugin = requireForce "../plugins/#{plugin_name}"
if plugin
if plugin instanceof Function
@listeners.push plugin | else
# init , received, stop 函数
@listeners.push plugin.received if plugin.received
plugin.init(@robot) if plugin.init
@stop_funcs.push plugin.stop if plugin.stop
module.exports = Dispatcher | CoffeeScript | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/dispatcher.coffee | 51 | 65 |
xhan/qqbot:src/dispatcher.coffee:1:raw_corpus | raw_corpus | Log = require 'log'
log = new Log('debug')
EventEmitter = require('events').EventEmitter
requireForce = (module_name) ->
try
delete require.cache[require.resolve(module_name)]
require(module_name)
catch error
log.error "Load module #{JSON.stringify module_name} failed"
log.error JSON.stringify err... | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | 6e3b13406fa75d37d27f8d8f633da808c6ded5d4 | 1,435 | https://github.com/xhan/qqbot/blob/6e3b13406fa75d37d27f8d8f633da808c6ded5d4/src/dispatcher.coffee | 1 | 50 | ||
xhan/qqbot:src/dispatcher.coffee:1:completion | completion | Log = require 'log'
log = new Log('debug')
EventEmitter = require('events').EventEmitter
requireForce = (module_name) ->
try
delete require.cache[require.resolve(module_name)]
require(module_name)
catch error
log.error "Load module #{JSON.stringify module_name} failed"
log.error JSON.stringify err... | for plugin in @obj_listeners
[obj,method] = plugin
obj[method](params...)
catch error
log.error error
###
针对 对象的方法
请传入 [obj,'methodname']
methodname 直接调用 methodname 会破坏内部变量 this.xxx
###
add_listener: (listener)->
if listener instanceof Function
... | CoffeeScript | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | 6e3b13406fa75d37d27f8d8f633da808c6ded5d4 | 1,435 | https://github.com/xhan/qqbot/blob/6e3b13406fa75d37d27f8d8f633da808c6ded5d4/src/dispatcher.coffee | 1 | 50 |
xhan/qqbot:src/dispatcher.coffee:2:raw_corpus | raw_corpus | for plugin_name in @plugins
log.debug "Loading Plugin #{plugin_name}"
plugin = requireForce "../plugins/#{plugin_name}"
if plugin
if plugin instanceof Function
@listeners.push plugin
else
# init , received, stop 函数
@listeners.push plugin.r... | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | 6e3b13406fa75d37d27f8d8f633da808c6ded5d4 | 1,435 | https://github.com/xhan/qqbot/blob/6e3b13406fa75d37d27f8d8f633da808c6ded5d4/src/dispatcher.coffee | 51 | 64 | ||
xhan/qqbot:src/dispatcher.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
for plugin_name in @plugins
log.debug "Loading Plugin #{plugin_name}"
plugin = requireForce "../plugins/#{plugin_name}"
if plugin
if plugin instanceof Function
@listeners.push plugin
else
# init ... | var i, len, plugin, plugin_name, ref;
ref = this.plugins;
for (i = 0, len = ref.length; i < len; i++) {
plugin_name = ref[i];
log.debug(`Loading Plugin ${plugin_name}`);
plugin = requireForce(`../plugins/${plugin_name}`);
if (plugin) {
if (plugin instanceof Function) {
this.listeners.push(plugin);
... | CoffeeScript | JavaScript | xhan/qqbot | src/dispatcher.coffee | MIT | 6e3b13406fa75d37d27f8d8f633da808c6ded5d4 | 1,435 | https://github.com/xhan/qqbot/blob/6e3b13406fa75d37d27f8d8f633da808c6ded5d4/src/dispatcher.coffee | 51 | 64 |
xhan/qqbot:src/dispatcher.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var i, len, plugin, plugin_name, ref;
ref = this.plugins;
for (i = 0, len = ref.length; i < len; i++) {
plugin_name = ref[i];
log.debug(`Loading Plugin ${plugin_name}`);
plugin = requireForce(`../plugins/${plugin_name}`);
if (plugin) {
if (plugin insta... | for plugin_name in @plugins
log.debug "Loading Plugin #{plugin_name}"
plugin = requireForce "../plugins/#{plugin_name}"
if plugin
if plugin instanceof Function
@listeners.push plugin
else
# init , received, stop 函数
@listeners.push plugin.r... | JavaScript | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | 6e3b13406fa75d37d27f8d8f633da808c6ded5d4 | 1,435 | https://github.com/xhan/qqbot/blob/6e3b13406fa75d37d27f8d8f633da808c6ded5d4/src/dispatcher.coffee | 51 | 64 |
xhan/qqbot:src/dispatcher.coffee:2:completion | completion | for plugin_name in @plugins
log.debug "Loading Plugin #{plugin_name}"
plugin = requireForce "../plugins/#{plugin_name}"
if plugin
if plugin instanceof Function
@listeners.push plugin
else | # init , received, stop 函数
@listeners.push plugin.received if plugin.received
plugin.init(@robot) if plugin.init
@stop_funcs.push plugin.stop if plugin.stop
module.exports = Dispatcher | CoffeeScript | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | 6e3b13406fa75d37d27f8d8f633da808c6ded5d4 | 1,435 | https://github.com/xhan/qqbot/blob/6e3b13406fa75d37d27f8d8f633da808c6ded5d4/src/dispatcher.coffee | 51 | 64 |
xhan/qqbot:src/dispatcher.coffee:1:raw_corpus | raw_corpus | Log = require 'log'
log = new Log('debug')
EventEmitter = require('events').EventEmitter
requireForce = (module_name) ->
try
delete require.cache[require.resolve(module_name)]
require(module_name)
catch error
log.error "Load module #{JSON.stringify module_name} failed"
log.error JSON.stringify err... | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | 89a00415c5475abd46b405e0aed99f0c6c70170f | 1,435 | https://github.com/xhan/qqbot/blob/89a00415c5475abd46b405e0aed99f0c6c70170f/src/dispatcher.coffee | 1 | 50 | ||
xhan/qqbot:src/dispatcher.coffee:1:completion | completion | Log = require 'log'
log = new Log('debug')
EventEmitter = require('events').EventEmitter
requireForce = (module_name) ->
try
delete require.cache[require.resolve(module_name)]
require(module_name)
catch error
log.error "Load module #{JSON.stringify module_name} failed"
log.error JSON.stringify err... | plugin(params...)
for plugin in @obj_listeners
[obj,method] = plugin
obj[method](params...)
catch error
log.error error
###
针对 对象的方法
请传入 [obj,'methodname']
methodname 直接调用 methodname 会破坏内部变量 this.xxx
###
add_listener: (listener)->
if listener... | CoffeeScript | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | 89a00415c5475abd46b405e0aed99f0c6c70170f | 1,435 | https://github.com/xhan/qqbot/blob/89a00415c5475abd46b405e0aed99f0c6c70170f/src/dispatcher.coffee | 1 | 50 |
xhan/qqbot:src/dispatcher.coffee:2:raw_corpus | raw_corpus | if plugin
if plugin instanceof Function
@listeners.push plugin
else
@listeners.push plugin.received if plugin.received
plugin.init(@robot) if plugin.init
module.exports = Dispatcher | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | 89a00415c5475abd46b405e0aed99f0c6c70170f | 1,435 | https://github.com/xhan/qqbot/blob/89a00415c5475abd46b405e0aed99f0c6c70170f/src/dispatcher.coffee | 51 | 60 | ||
xhan/qqbot:src/dispatcher.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if plugin
if plugin instanceof Function
@listeners.push plugin
else
@listeners.push plugin.received if plugin.received
plugin.init(@robot) if plugin.init
module.exports = Dispatcher
``` | if (plugin) {
if (plugin instanceof Function) {
this.listeners.push(plugin);
} else {
if (plugin.received) {
this.listeners.push(plugin.received);
}
if (plugin.init) {
plugin.init(this.robot);
}
}
}
module.exports = Dispatcher; | CoffeeScript | JavaScript | xhan/qqbot | src/dispatcher.coffee | MIT | 89a00415c5475abd46b405e0aed99f0c6c70170f | 1,435 | https://github.com/xhan/qqbot/blob/89a00415c5475abd46b405e0aed99f0c6c70170f/src/dispatcher.coffee | 51 | 60 |
xhan/qqbot:src/dispatcher.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
if (plugin) {
if (plugin instanceof Function) {
this.listeners.push(plugin);
} else {
if (plugin.received) {
this.listeners.push(plugin.received);
}
if (plugin.init) {
plugin.init(this.robot);
}
}
}
module.exports = Dispatcher... | if plugin
if plugin instanceof Function
@listeners.push plugin
else
@listeners.push plugin.received if plugin.received
plugin.init(@robot) if plugin.init
module.exports = Dispatcher | JavaScript | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | 89a00415c5475abd46b405e0aed99f0c6c70170f | 1,435 | https://github.com/xhan/qqbot/blob/89a00415c5475abd46b405e0aed99f0c6c70170f/src/dispatcher.coffee | 51 | 60 |
xhan/qqbot:src/dispatcher.coffee:2:completion | completion | if plugin
if plugin instanceof Function
@listeners.push plugin
else
@listeners.push plugin.received if plugin.received | plugin.init(@robot) if plugin.init
module.exports = Dispatcher | CoffeeScript | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | 89a00415c5475abd46b405e0aed99f0c6c70170f | 1,435 | https://github.com/xhan/qqbot/blob/89a00415c5475abd46b405e0aed99f0c6c70170f/src/dispatcher.coffee | 51 | 60 |
xhan/qqbot:src/dispatcher.coffee:1:raw_corpus | raw_corpus | Log = require 'log'
log = new Log('debug')
EventEmitter = require('events').EventEmitter
requireForce = (module_name) ->
try
delete require.cache[require.resolve(module_name)]
require(module_name)
catch error
log.error "Load module #{module} failed"
class Dispatcher extends EventEmitter
construc... | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | c7369241f204f07177201d042ee30ba4e882f4a6 | 1,435 | https://github.com/xhan/qqbot/blob/c7369241f204f07177201d042ee30ba4e882f4a6/src/dispatcher.coffee | 1 | 50 | ||
xhan/qqbot:src/dispatcher.coffee:1:completion | completion | Log = require 'log'
log = new Log('debug')
EventEmitter = require('events').EventEmitter
requireForce = (module_name) ->
try
delete require.cache[require.resolve(module_name)]
require(module_name)
catch error
log.error "Load module #{module} failed"
class Dispatcher extends EventEmitter
construc... | plugin(params...)
for plugin in @obj_listeners
[obj,method] = plugin
obj[method](params...)
catch error
log.error error
###
针对 对象的方法
请传入 [obj,'methodname']
methodname 直接调用 methodname 会破坏内部变量 this.xxx
###
add_listener: (listener)->
if listener... | CoffeeScript | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | c7369241f204f07177201d042ee30ba4e882f4a6 | 1,435 | https://github.com/xhan/qqbot/blob/c7369241f204f07177201d042ee30ba4e882f4a6/src/dispatcher.coffee | 1 | 50 |
xhan/qqbot:src/dispatcher.coffee:2:raw_corpus | raw_corpus | if plugin instanceof Function
@listeners.push plugin
else
@listeners.push plugin.received if plugin.received
plugin.init(@robot) if plugin.init
module.exports = Dispatcher | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | c7369241f204f07177201d042ee30ba4e882f4a6 | 1,435 | https://github.com/xhan/qqbot/blob/c7369241f204f07177201d042ee30ba4e882f4a6/src/dispatcher.coffee | 51 | 59 | ||
xhan/qqbot:src/dispatcher.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if plugin instanceof Function
@listeners.push plugin
else
@listeners.push plugin.received if plugin.received
plugin.init(@robot) if plugin.init
module.exports = Dispatcher
``` | if (plugin instanceof Function) {
this.listeners.push(plugin);
} else {
if (plugin.received) {
this.listeners.push(plugin.received);
}
if (plugin.init) {
plugin.init(this.robot);
}
}
module.exports = Dispatcher; | CoffeeScript | JavaScript | xhan/qqbot | src/dispatcher.coffee | MIT | c7369241f204f07177201d042ee30ba4e882f4a6 | 1,435 | https://github.com/xhan/qqbot/blob/c7369241f204f07177201d042ee30ba4e882f4a6/src/dispatcher.coffee | 51 | 59 |
xhan/qqbot:src/dispatcher.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
if (plugin instanceof Function) {
this.listeners.push(plugin);
} else {
if (plugin.received) {
this.listeners.push(plugin.received);
}
if (plugin.init) {
plugin.init(this.robot);
}
}
module.exports = Dispatcher;
``` | if plugin instanceof Function
@listeners.push plugin
else
@listeners.push plugin.received if plugin.received
plugin.init(@robot) if plugin.init
module.exports = Dispatcher | JavaScript | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | c7369241f204f07177201d042ee30ba4e882f4a6 | 1,435 | https://github.com/xhan/qqbot/blob/c7369241f204f07177201d042ee30ba4e882f4a6/src/dispatcher.coffee | 51 | 59 |
xhan/qqbot:src/dispatcher.coffee:2:completion | completion | if plugin instanceof Function
@listeners.push plugin
else
@listeners.push plugin.received if plugin.received | plugin.init(@robot) if plugin.init
module.exports = Dispatcher | CoffeeScript | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | c7369241f204f07177201d042ee30ba4e882f4a6 | 1,435 | https://github.com/xhan/qqbot/blob/c7369241f204f07177201d042ee30ba4e882f4a6/src/dispatcher.coffee | 51 | 59 |
xhan/qqbot:src/dispatcher.coffee:1:raw_corpus | raw_corpus | EventEmitter = require('events').EventEmitter
class Dispatcher extends EventEmitter
constructor: (@plugins ) ->
@listeners = []
@obj_listeners = []
@plugins ||= []
for plugin_name in @plugins
@listeners.push require "../plugins/#{plugin_name}"
dispatch: (params...)-... | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | 21396c36f0788942c3d40c560cfeac5e2ba3526a | 1,435 | https://github.com/xhan/qqbot/blob/21396c36f0788942c3d40c560cfeac5e2ba3526a/src/dispatcher.coffee | 1 | 30 | ||
xhan/qqbot:src/dispatcher.coffee:1:completion | completion | EventEmitter = require('events').EventEmitter
class Dispatcher extends EventEmitter
constructor: (@plugins ) ->
@listeners = []
@obj_listeners = []
@plugins ||= []
for plugin_name in @plugins
@listeners.push require "../plugins/#{plugin_name}"
dispatch: (params...)-... | obj[method](params...)
###
针对 对象的方法
请传入 [obj,'methodname']
methodname 直接调用 methodname 会破坏内部变量 this.xxx
###
add_listener: (listener)->
if listener instanceof Function
@listeners.push listener
else
@obj_listeners.push listener
module.exports = Dispatc... | CoffeeScript | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | 21396c36f0788942c3d40c560cfeac5e2ba3526a | 1,435 | https://github.com/xhan/qqbot/blob/21396c36f0788942c3d40c560cfeac5e2ba3526a/src/dispatcher.coffee | 1 | 30 |
xhan/qqbot:src/dispatcher.coffee:1:raw_corpus | raw_corpus | EventEmitter = require('events').EventEmitter
class Dispatcher extends EventEmitter
constructor: (@plugins) ->
@listeners = []
@obj_listeners = []
for plugin_name in @plugins
@listeners.push require "../plugins/#{plugin_name}"
dispatch: (params...)->
for plugin in @... | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | fbfa18a8e66997fb86fa19d22304c03cf05b6fa9 | 1,435 | https://github.com/xhan/qqbot/blob/fbfa18a8e66997fb86fa19d22304c03cf05b6fa9/src/dispatcher.coffee | 1 | 29 | ||
xhan/qqbot:src/dispatcher.coffee:1:completion | completion | EventEmitter = require('events').EventEmitter
class Dispatcher extends EventEmitter
constructor: (@plugins) ->
@listeners = []
@obj_listeners = []
for plugin_name in @plugins
@listeners.push require "../plugins/#{plugin_name}"
dispatch: (params...)->
for plugin in @... | obj[method](params...)
###
针对 对象的方法
请传入 [obj,'methodname']
methodname 直接调用 methodname 会破坏内部变量 this.xxx
###
add_listener: (listener)->
if listener instanceof Function
@listeners.push listener
else
@obj_listeners.push listener
module.exports = Dispatc... | CoffeeScript | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | fbfa18a8e66997fb86fa19d22304c03cf05b6fa9 | 1,435 | https://github.com/xhan/qqbot/blob/fbfa18a8e66997fb86fa19d22304c03cf05b6fa9/src/dispatcher.coffee | 1 | 29 |
xhan/qqbot:src/dispatcher.coffee:1:raw_corpus | raw_corpus | EventEmitter = require('events').EventEmitter
class Dispatcher extends EventEmitter
constructor: (@plugins) ->
@listeners = []
for plugin_name in @plugins
@listeners.push require "../plugins/#{plugin_name}"
dispatch: (content ,send, robot, message)->
for plugin in @listener... | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | ab343a11c18512a46bf2ca5b2f46bd8e1c710019 | 1,435 | https://github.com/xhan/qqbot/blob/ab343a11c18512a46bf2ca5b2f46bd8e1c710019/src/dispatcher.coffee | 1 | 17 | ||
xhan/qqbot:src/dispatcher.coffee:1:completion | completion | EventEmitter = require('events').EventEmitter
class Dispatcher extends EventEmitter
constructor: (@plugins) ->
@listeners = []
for plugin_name in @plugins
@listeners.push require "../plugins/#{plugin_name}" | dispatch: (content ,send, robot, message)->
for plugin in @listeners
plugin(content ,send, robot, message)
add_listener: (listener)->
@listeners.push listener
module.exports = Dispatcher | CoffeeScript | CoffeeScript | xhan/qqbot | src/dispatcher.coffee | MIT | ab343a11c18512a46bf2ca5b2f46bd8e1c710019 | 1,435 | https://github.com/xhan/qqbot/blob/ab343a11c18512a46bf2ca5b2f46bd8e1c710019/src/dispatcher.coffee | 1 | 17 |
meltingice/psd.js:lib/psd/mask.coffee:1:raw_corpus | raw_corpus | # Each layer/group in the PSD document can have a mask, which is
# represented by this class. The mask describes which parts of the
# layer are visible and which are hidden.
module.exports = class Mask
constructor: (@file) ->
@top = 0
@right = 0
@bottom = 0
@left = 0
parse: ->
# If there is no ... | CoffeeScript | meltingice/psd.js | lib/psd/mask.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/mask.coffee | 1 | 50 | ||
meltingice/psd.js:lib/psd/mask.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Each layer/group in the PSD document can have a mask, which is
# represented by this class. The mask describes which parts of the
# layer are visible and which are hidden.
module.exports = class Mask
constructor: (@file) ->
@top = 0
@right = 0
@bo... | // Each layer/group in the PSD document can have a mask, which is
// represented by this class. The mask describes which parts of the
// layer are visible and which are hidden.
var Mask;
module.exports = Mask = class Mask {
constructor(file) {
this.file = file;
this.top = 0;
this.right = 0;
this.bott... | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/mask.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/mask.coffee | 1 | 50 |
meltingice/psd.js:lib/psd/mask.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Each layer/group in the PSD document can have a mask, which is
// represented by this class. The mask describes which parts of the
// layer are visible and which are hidden.
var Mask;
module.exports = Mask = class Mask {
constructor(file) {
this.file = fi... | # Each layer/group in the PSD document can have a mask, which is
# represented by this class. The mask describes which parts of the
# layer are visible and which are hidden.
module.exports = class Mask
constructor: (@file) ->
@top = 0
@right = 0
@bottom = 0
@left = 0
parse: ->
# If there is no ... | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/mask.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/mask.coffee | 1 | 50 |
meltingice/psd.js:lib/psd/mask.coffee:1:completion | completion | # Each layer/group in the PSD document can have a mask, which is
# represented by this class. The mask describes which parts of the
# layer are visible and which are hidden.
module.exports = class Mask
constructor: (@file) ->
@top = 0
@right = 0
@bottom = 0
@left = 0
parse: ->
# If there is no ... | @width = @right - @left
@height = @bottom - @top
# Each mask defines a couple of flags that are used as extra metadata.
@relative = (@flags & 0x01) > 0
@disabled = (@flags & (0x01 << 1)) > 0
@invert = (@flags & (0x01 << 2)) > 0
@defaultColor = @file.readByte()
@flags = @file.readByte()
... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/mask.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/mask.coffee | 1 | 50 |
meltingice/psd.js:lib/psd/mask.coffee:1:raw_corpus | raw_corpus | module.exports = class Mask
constructor: (@file) ->
@top = 0
@right = 0
@bottom = 0
@left = 0
parse: ->
@size = @file.readInt()
return @ if @size is 0
maskEnd = @file.tell() + @size
@top = @file.readInt()
@left = @file.readInt()
@bottom = @file.readInt()
@right = @file... | CoffeeScript | meltingice/psd.js | lib/psd/mask.coffee | MIT | 28ac2075d7bad825fb58a2b269d9636ee382df4a | 2,846 | https://github.com/meltingice/psd.js/blob/28ac2075d7bad825fb58a2b269d9636ee382df4a/lib/psd/mask.coffee | 1 | 44 | ||
meltingice/psd.js:lib/psd/mask.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class Mask
constructor: (@file) ->
@top = 0
@right = 0
@bottom = 0
@left = 0
parse: ->
@size = @file.readInt()
return @ if @size is 0
maskEnd = @file.tell() + @size
@top = @file.readInt()
@left = @file.r... | var Mask;
module.exports = Mask = class Mask {
constructor(file) {
this.file = file;
this.top = 0;
this.right = 0;
this.bottom = 0;
this.left = 0;
}
parse() {
var maskEnd;
this.size = this.file.readInt();
if (this.size === 0) {
return this;
}
maskEnd = this.file.tel... | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/mask.coffee | MIT | 28ac2075d7bad825fb58a2b269d9636ee382df4a | 2,846 | https://github.com/meltingice/psd.js/blob/28ac2075d7bad825fb58a2b269d9636ee382df4a/lib/psd/mask.coffee | 1 | 44 |
meltingice/psd.js:lib/psd/mask.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Mask;
module.exports = Mask = class Mask {
constructor(file) {
this.file = file;
this.top = 0;
this.right = 0;
this.bottom = 0;
this.left = 0;
}
parse() {
var maskEnd;
this.size = this.file.readInt();
if (this.size === 0)... | module.exports = class Mask
constructor: (@file) ->
@top = 0
@right = 0
@bottom = 0
@left = 0
parse: ->
@size = @file.readInt()
return @ if @size is 0
maskEnd = @file.tell() + @size
@top = @file.readInt()
@left = @file.readInt()
@bottom = @file.readInt()
@right = @file... | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/mask.coffee | MIT | 28ac2075d7bad825fb58a2b269d9636ee382df4a | 2,846 | https://github.com/meltingice/psd.js/blob/28ac2075d7bad825fb58a2b269d9636ee382df4a/lib/psd/mask.coffee | 1 | 44 |
meltingice/psd.js:lib/psd/mask.coffee:1:completion | completion | module.exports = class Mask
constructor: (@file) ->
@top = 0
@right = 0
@bottom = 0
@left = 0
parse: ->
@size = @file.readInt()
return @ if @size is 0
maskEnd = @file.tell() + @size
@top = @file.readInt()
@left = @file.readInt()
@bottom = @file.readInt()
@right = @file... | @disabled = (@flags & (0x01 << 1)) > 0
@invert = (@flags & (0x01 << 2)) > 0
@defaultColor = @file.readByte()
@flags = @file.readByte()
@file.seek maskEnd
return @
export: ->
return {} if @size is 0
top: @top
left: @left
bottom: @bottom
right: @right
width: @width
he... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/mask.coffee | MIT | 28ac2075d7bad825fb58a2b269d9636ee382df4a | 2,846 | https://github.com/meltingice/psd.js/blob/28ac2075d7bad825fb58a2b269d9636ee382df4a/lib/psd/mask.coffee | 1 | 44 |
jianliaoim/talk-os:talk-web/client/mixin/message-handler.coffee:1:raw_corpus | raw_corpus | module.exports =
componentDidMount: ->
@_nameEl = @refs.author
getInitialState: ->
showPostViewer: false
showFile: false
showProfile: false
showQuoteViewer: false
showLinkViewer: false
showSnippetViewer: false
# methods
getAuthorName: ->
if detect.isTalkai(@props.message.get('... | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-handler.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-handler.coffee | 35 | 84 | ||
jianliaoim/talk-os:talk-web/client/mixin/message-handler.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
componentDidMount: ->
@_nameEl = @refs.author
getInitialState: ->
showPostViewer: false
showFile: false
showProfile: false
showQuoteViewer: false
showLinkViewer: false
showSnippetViewer: false
# methods
getA... | module.exports = {
componentDidMount: function() {
return this._nameEl = this.refs.author;
},
getInitialState: function() {
return {
showPostViewer: false,
showFile: false,
showProfile: false,
showQuoteViewer: false,
showLinkViewer: false,
showSnippetViewer: false
}... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/mixin/message-handler.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-handler.coffee | 35 | 84 |
jianliaoim/talk-os:talk-web/client/mixin/message-handler.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
componentDidMount: function() {
return this._nameEl = this.refs.author;
},
getInitialState: function() {
return {
showPostViewer: false,
showFile: false,
showProfile: false,
showQuoteViewer: false,
show... | module.exports =
componentDidMount: ->
@_nameEl = @refs.author
getInitialState: ->
showPostViewer: false
showFile: false
showProfile: false
showQuoteViewer: false
showLinkViewer: false
showSnippetViewer: false
# methods
getAuthorName: ->
if detect.isTalkai(@props.message.get('... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-handler.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-handler.coffee | 35 | 84 |
jianliaoim/talk-os:talk-web/client/mixin/message-handler.coffee:1:completion | completion | module.exports =
componentDidMount: ->
@_nameEl = @refs.author
getInitialState: ->
showPostViewer: false
showFile: false
showProfile: false
showQuoteViewer: false
showLinkViewer: false
showSnippetViewer: false
# methods
getAuthorName: ->
if detect.isTalkai(@props.message.get('... | else
_userId = query.userId(recorder.getState())
mentions = @props.message.get('mentions')
receiptors = @props.message.get('receiptors')
mentionedMe = mentions?.includes _userId
hasRead = receiptors?.includes _userId
messageReceiptClass = cx
'is-unread': mentionedMe and not ... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-handler.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-handler.coffee | 35 | 84 |
jianliaoim/talk-os:talk-web/client/mixin/message-handler.coffee:2:raw_corpus | raw_corpus | positionAlgorithm: (baseArea) ->
# card height is approximately 160
if baseArea.top > 160
bottom: "#{window.innerHeight - baseArea.top + 8}px"
left: "#{baseArea.left}px"
else
top: '10px'
left: "#{baseArea.left}px"
onAuthorClick: (event) ->
_userId = query.userId(recorder.getSt... | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-handler.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-handler.coffee | 85 | 134 | ||
jianliaoim/talk-os:talk-web/client/mixin/message-handler.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
positionAlgorithm: (baseArea) ->
# card height is approximately 160
if baseArea.top > 160
bottom: "#{window.innerHeight - baseArea.top + 8}px"
left: "#{baseArea.left}px"
else
top: '10px'
left: "#{baseArea.left}px"
onAuthorCl... | ({
positionAlgorithm: function(baseArea) {
// card height is approximately 160
if (baseArea.top > 160) {
return {
bottom: `${window.innerHeight - baseArea.top + 8}px`,
left: `${baseArea.left}px`
};
} else {
return {
top: '10px',
left: `${baseArea.left}px`
... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/mixin/message-handler.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-handler.coffee | 85 | 134 |
jianliaoim/talk-os:talk-web/client/mixin/message-handler.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
positionAlgorithm: function(baseArea) {
// card height is approximately 160
if (baseArea.top > 160) {
return {
bottom: `${window.innerHeight - baseArea.top + 8}px`,
left: `${baseArea.left}px`
};
} else {
return {
... | positionAlgorithm: (baseArea) ->
# card height is approximately 160
if baseArea.top > 160
bottom: "#{window.innerHeight - baseArea.top + 8}px"
left: "#{baseArea.left}px"
else
top: '10px'
left: "#{baseArea.left}px"
onAuthorClick: (event) ->
_userId = query.userId(recorder.getSt... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-handler.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-handler.coffee | 85 | 134 |
jianliaoim/talk-os:talk-web/client/mixin/message-handler.coffee:2:completion | completion | positionAlgorithm: (baseArea) ->
# card height is approximately 160
if baseArea.top > 160
bottom: "#{window.innerHeight - baseArea.top + 8}px"
left: "#{baseArea.left}px"
else
top: '10px'
left: "#{baseArea.left}px"
onAuthorClick: (event) ->
_userId = query.userId(recorder.getSt... | renderMemberCard: ->
showCard = @state.showProfile and @props.message.get('creator')?
LightPopover
onPopoverClose: @onAuthorClose
baseArea: if showCard then @getBaseArea() else {}
showClose: false, positionAlgorithm: @positionAlgorithm
show: showCard
name: 'member-card'
Membe... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-handler.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-handler.coffee | 85 | 134 |
jianliaoim/talk-os:talk-web/client/mixin/message-handler.coffee:3:raw_corpus | raw_corpus | # quote
onQuoteRedirect: (url) ->
window.open(url)
onQuoteViewerShow: -> @setState showQuoteViewer: true
onQuoteViewerClose: -> @setState showQuoteViewer: false
renderQuoteViewer: ->
LightModalBeta name: 'quote-viewer', onCloseClick: @onQuoteViewerClose, showClose: true, show: @state.showQuoteViewer,
... | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-handler.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-handler.coffee | 135 | 165 | ||
jianliaoim/talk-os:talk-web/client/mixin/message-handler.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# quote
onQuoteRedirect: (url) ->
window.open(url)
onQuoteViewerShow: -> @setState showQuoteViewer: true
onQuoteViewerClose: -> @setState showQuoteViewer: false
renderQuoteViewer: ->
LightModalBeta name: 'quote-viewer', onCloseClick: @onQuoteVie... | // quote
({
onQuoteRedirect: function(url) {
return window.open(url);
},
onQuoteViewerShow: function() {
return this.setState({
showQuoteViewer: true
});
},
onQuoteViewerClose: function() {
return this.setState({
showQuoteViewer: false
});
},
renderQuoteViewer: function() {... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/mixin/message-handler.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-handler.coffee | 135 | 165 |
jianliaoim/talk-os:talk-web/client/mixin/message-handler.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// quote
({
onQuoteRedirect: function(url) {
return window.open(url);
},
onQuoteViewerShow: function() {
return this.setState({
showQuoteViewer: true
});
},
onQuoteViewerClose: function() {
return this.setState({
showQuoteViewe... | # quote
onQuoteRedirect: (url) ->
window.open(url)
onQuoteViewerShow: -> @setState showQuoteViewer: true
onQuoteViewerClose: -> @setState showQuoteViewer: false
renderQuoteViewer: ->
LightModalBeta name: 'quote-viewer', onCloseClick: @onQuoteViewerClose, showClose: true, show: @state.showQuoteViewer,
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-handler.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-handler.coffee | 135 | 165 |
jianliaoim/talk-os:talk-web/client/mixin/message-handler.coffee:3:completion | completion | # quote
onQuoteRedirect: (url) ->
window.open(url)
onQuoteViewerShow: -> @setState showQuoteViewer: true
onQuoteViewerClose: -> @setState showQuoteViewer: false
renderQuoteViewer: ->
LightModalBeta name: 'quote-viewer', onCloseClick: @onQuoteViewerClose, showClose: true, show: @state.showQuoteViewer,
... | renderLinkViewer: ->
LightModalBeta name: 'link-viewer', onCloseClick: @onLinkViewerHide, showClose: true, show: @state.showLinkViewer,
LinkViewer message: @props.message, onClose: @onLinkViewerHide
# snippet
onSnippetViewerShow: ->
@setState showSnippetViewer: true
analytics.viewSnippet()
on... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-handler.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-handler.coffee | 135 | 165 |
jashkenas/coffeescript:test/cluster.coffee:1:raw_corpus | raw_corpus | # Cluster Module
# ---------
return if testingBrowser?
cluster = require 'cluster'
if cluster.isMaster
test "#2737 - cluster module can spawn workers from a coffeescript process", ->
cluster.once 'exit', (worker, code) ->
eq code, 0
cluster.fork()
else
process.exit 0 | CoffeeScript | jashkenas/coffeescript | test/cluster.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/cluster.coffee | 1 | 15 | ||
jashkenas/coffeescript:test/cluster.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Cluster Module
# ---------
return if testingBrowser?
cluster = require 'cluster'
if cluster.isMaster
test "#2737 - cluster module can spawn workers from a coffeescript process", ->
cluster.once 'exit', (worker, code) ->
eq code, 0
cluster.fo... | // Cluster Module
// ---------
var cluster;
if (typeof testingBrowser !== "undefined" && testingBrowser !== null) {
return;
}
cluster = require('cluster');
if (cluster.isMaster) {
test("#2737 - cluster module can spawn workers from a coffeescript process", function() {
cluster.once('exit', function(worker, c... | CoffeeScript | JavaScript | jashkenas/coffeescript | test/cluster.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/cluster.coffee | 1 | 15 |
jashkenas/coffeescript:test/cluster.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Cluster Module
// ---------
var cluster;
if (typeof testingBrowser !== "undefined" && testingBrowser !== null) {
return;
}
cluster = require('cluster');
if (cluster.isMaster) {
test("#2737 - cluster module can spawn workers from a coffeescript process", f... | # Cluster Module
# ---------
return if testingBrowser?
cluster = require 'cluster'
if cluster.isMaster
test "#2737 - cluster module can spawn workers from a coffeescript process", ->
cluster.once 'exit', (worker, code) ->
eq code, 0
cluster.fork()
else
process.exit 0 | JavaScript | CoffeeScript | jashkenas/coffeescript | test/cluster.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/cluster.coffee | 1 | 15 |
jashkenas/coffeescript:test/cluster.coffee:1:completion | completion | # Cluster Module
# ---------
return if testingBrowser?
cluster = require 'cluster' | if cluster.isMaster
test "#2737 - cluster module can spawn workers from a coffeescript process", ->
cluster.once 'exit', (worker, code) ->
eq code, 0
cluster.fork()
else
process.exit 0 | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/cluster.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/cluster.coffee | 1 | 15 |
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:1:raw_corpus | raw_corpus | module.exports = class Rubocop extends Beautifier
name: "Rubocop"
link: "https://github.com/bbatsov/rubocop"
isPreInstalled: false
options: {
Ruby:
indent_size: true
rubocop_path: true
}
executables: [
{
name: "Rubocop"
cmd: "rubocop"
homepage: "http://rubocop.readthe... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/rubocop.coffee | 9 | 58 | ||
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:1:completion | completion | module.exports = class Rubocop extends Beautifier
name: "Rubocop"
link: "https://github.com/bbatsov/rubocop"
isPreInstalled: false
options: {
Ruby:
indent_size: true
rubocop_path: true
}
executables: [
{
name: "Rubocop"
cmd: "rubocop"
homepage: "http://rubocop.readthe... | [projectPath, _relativePath] = atom.project.relativizePath(fullPath)
# Deprecate options.rubocop_path
if options.rubocop_path
@deprecateOptionForExecutable("Rubocop", "Ruby - Rubocop Path (rubocop_path)", "Path")
# Find the rubocop path
@Promise.all([
@which(options.rubocop_path) if option... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/rubocop.coffee | 9 | 58 |
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:2:raw_corpus | raw_corpus | }
tempConfig = @tempFile("rubocop-config", yaml.safeDump(config))
rubocopArguments = [
"--auto-correct"
"--force-exclusion"
"--stdin", fullPath or "atom-beautify.rb" # --stdin requires an argument
]
exeOptions = {
ignoreReturnCode: true,
cwd: projectPat... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/rubocop.coffee | 59 | 88 | ||
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:2:completion | completion | }
tempConfig = @tempFile("rubocop-config", yaml.safeDump(config))
rubocopArguments = [
"--auto-correct"
"--force-exclusion"
"--stdin", fullPath or "atom-beautify.rb" # --stdin requires an argument
]
exeOptions = {
ignoreReturnCode: true,
cwd: projectPat... | (if options.rubocop_path then \
@run(rubocopPath, rubocopArguments, exeOptions) else \
@exe("rubocop").run(rubocopArguments, exeOptions)
).then((stdout) =>
@debug("rubocop output", stdout)
# Rubocop output an error if stdout is empty
return text if stdout.length == 0
... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/rubocop.coffee | 59 | 88 |
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:2:raw_corpus | raw_corpus | }
tempConfig = @tempFile("rubocop-config", yaml.safeDump(config))
rubocopArguments = [
"--auto-correct"
"--force-exclusion"
"--stdin", "atom-beautify.rb" # filename is required but not used
]
exeOptions = {
ignoreReturnCode: true,
cwd: projectPath if co... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 196f57229000564dbf4e9f4e444758d507b30867 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/196f57229000564dbf4e9f4e444758d507b30867/src/beautifiers/rubocop.coffee | 59 | 88 | ||
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:2:completion | completion | }
tempConfig = @tempFile("rubocop-config", yaml.safeDump(config))
rubocopArguments = [
"--auto-correct"
"--force-exclusion"
"--stdin", "atom-beautify.rb" # filename is required but not used
]
exeOptions = {
ignoreReturnCode: true,
cwd: projectPath if co... | (if options.rubocop_path then \
@run(rubocopPath, rubocopArguments, exeOptions) else \
@exe("rubocop").run(rubocopArguments, exeOptions)
).then((stdout) =>
@debug("rubocop output", stdout)
# Rubocop output an error if stdout is empty
return text if stdout.length == 0
... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 196f57229000564dbf4e9f4e444758d507b30867 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/196f57229000564dbf4e9f4e444758d507b30867/src/beautifiers/rubocop.coffee | 59 | 88 |
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:2:raw_corpus | raw_corpus | }
tempConfig = @tempFile("rubocop-config", yaml.safeDump(config))
rubocopArguments = [
"--auto-correct"
"--force-exclusion"
"--stdin", "atom-beautify.rb" # filename is required but not used
]
exeOptions = {
ignoreReturnCode: true,
cwd: projectPath if co... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | e6077cdbdbd714062c64f9cca575778fe194d3a1 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/e6077cdbdbd714062c64f9cca575778fe194d3a1/src/beautifiers/rubocop.coffee | 59 | 86 | ||
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:2:completion | completion | }
tempConfig = @tempFile("rubocop-config", yaml.safeDump(config))
rubocopArguments = [
"--auto-correct"
"--force-exclusion"
"--stdin", "atom-beautify.rb" # filename is required but not used
]
exeOptions = {
ignoreReturnCode: true,
cwd: projectPath if co... | @debug("rubocop arguments", rubocopArguments)
(if options.rubocop_path then \
@run(rubocopPath, rubocopArguments, exeOptions) else \
@exe("rubocop").run(rubocopArguments, exeOptions)
).then((stdout) =>
@debug("rubocop output", stdout)
# Rubocop output an error if stdout is e... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | e6077cdbdbd714062c64f9cca575778fe194d3a1 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/e6077cdbdbd714062c64f9cca575778fe194d3a1/src/beautifiers/rubocop.coffee | 59 | 86 |
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:1:raw_corpus | raw_corpus | ###
Requires https://github.com/bbatsov/rubocop
###
"use strict"
Beautifier = require('./beautifier')
path = require('path')
module.exports = class Rubocop extends Beautifier
name: "Rubocop"
link: "https://github.com/bbatsov/rubocop"
isPreInstalled: false
options: {
Ruby:
indent_size: true
ru... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 4ecd6682088e061615e72d52fcbe2b3e34c0c7a0 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/4ecd6682088e061615e72d52fcbe2b3e34c0c7a0/src/beautifiers/rubocop.coffee | 1 | 50 | ||
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:1:completion | completion | ###
Requires https://github.com/bbatsov/rubocop
###
"use strict"
Beautifier = require('./beautifier')
path = require('path')
module.exports = class Rubocop extends Beautifier
name: "Rubocop"
link: "https://github.com/bbatsov/rubocop"
isPreInstalled: false
options: {
Ruby:
indent_size: true
ru... | version: {
parse: (text) -> text.match(/(\d+\.\d+\.\d+)/)[1]
}
}
]
beautify: (text, language, options, context) ->
fullPath = context.filePath or ""
[projectPath, _relativePath] = atom.project.relativizePath(fullPath)
# Find the rubocop path
@Promise.all([
@which(options.ru... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 4ecd6682088e061615e72d52fcbe2b3e34c0c7a0 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/4ecd6682088e061615e72d52fcbe2b3e34c0c7a0/src/beautifiers/rubocop.coffee | 1 | 50 |
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:2:raw_corpus | raw_corpus | yaml = require("yaml-front-matter")
config = {
"Style/IndentationWidth":
"Width": options.indent_size
}
tempConfig = @tempFile("rubocop-config", yaml.safeDump(config))
rubocopArguments = [
"--auto-correct"
"--force-exclusion"
"--stdin", "atom-... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 4ecd6682088e061615e72d52fcbe2b3e34c0c7a0 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/4ecd6682088e061615e72d52fcbe2b3e34c0c7a0/src/beautifiers/rubocop.coffee | 51 | 78 | ||
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:2:completion | completion | yaml = require("yaml-front-matter")
config = {
"Style/IndentationWidth":
"Width": options.indent_size
}
tempConfig = @tempFile("rubocop-config", yaml.safeDump(config))
rubocopArguments = [
"--auto-correct"
"--force-exclusion"
"--stdin", "atom-... | @exe("rubocop").run(rubocopArguments, {
ignoreReturnCode: true,
cwd: projectPath if configFile?,
onStdin: (stdin) -> stdin.end text
}).then((stdout) =>
@debug("rubocop output", stdout)
# Rubocop output an error if stdout is empty
return text if stdout.length == 0
... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 4ecd6682088e061615e72d52fcbe2b3e34c0c7a0 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/4ecd6682088e061615e72d52fcbe2b3e34c0c7a0/src/beautifiers/rubocop.coffee | 51 | 78 |
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:1:raw_corpus | raw_corpus | ###
Requires https://github.com/bbatsov/rubocop
###
"use strict"
Beautifier = require('./beautifier')
path = require('path')
module.exports = class Rubocop extends Beautifier
name: "Rubocop"
link: "https://github.com/bbatsov/rubocop"
isPreInstalled: false
options: {
Ruby:
indent_size: true
ru... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | d4db0089237cdd3d4bc6658c79a12127a7ae61bc | 1,503 | https://github.com/Glavin001/atom-beautify/blob/d4db0089237cdd3d4bc6658c79a12127a7ae61bc/src/beautifiers/rubocop.coffee | 1 | 50 | ||
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:1:completion | completion | ###
Requires https://github.com/bbatsov/rubocop
###
"use strict"
Beautifier = require('./beautifier')
path = require('path')
module.exports = class Rubocop extends Beautifier
name: "Rubocop"
link: "https://github.com/bbatsov/rubocop"
isPreInstalled: false
options: {
Ruby:
indent_size: true
ru... | @which(options.rubocop_path) if options.rubocop_path
@which('rubocop')
])
.then((paths) =>
@debug('rubocop paths', paths)
# Get first valid, absolute path
rubocopPath = paths.find((p) -> p and path.isAbsolute(p)) or "rubocop"
@verbose('rubocopPath', rubocopPath)
@debug('ruboc... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | d4db0089237cdd3d4bc6658c79a12127a7ae61bc | 1,503 | https://github.com/Glavin001/atom-beautify/blob/d4db0089237cdd3d4bc6658c79a12127a7ae61bc/src/beautifiers/rubocop.coffee | 1 | 50 |
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:2:raw_corpus | raw_corpus | rubocopArguments.push("--config", tempConfig) if tempConfig?
@debug("rubocop arguments", rubocopArguments)
@run(rubocopPath, rubocopArguments, {
ignoreReturnCode: true,
cwd: projectPath,
onStdin: (stdin) -> stdin.end text
}).then((stdout) =>
@debug("rubocop output", st... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | d4db0089237cdd3d4bc6658c79a12127a7ae61bc | 1,503 | https://github.com/Glavin001/atom-beautify/blob/d4db0089237cdd3d4bc6658c79a12127a7ae61bc/src/beautifiers/rubocop.coffee | 51 | 66 | ||
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:2:completion | completion | rubocopArguments.push("--config", tempConfig) if tempConfig?
@debug("rubocop arguments", rubocopArguments)
@run(rubocopPath, rubocopArguments, {
ignoreReturnCode: true,
cwd: projectPath,
onStdin: (stdin) -> stdin.end text
}).then((stdout) => | @debug("rubocop output", stdout)
# Rubocop output an error if stdout is empty
return text if stdout.length == 0
result = stdout.split("====================\n")
result[result.length - 1]
)
) | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | d4db0089237cdd3d4bc6658c79a12127a7ae61bc | 1,503 | https://github.com/Glavin001/atom-beautify/blob/d4db0089237cdd3d4bc6658c79a12127a7ae61bc/src/beautifiers/rubocop.coffee | 51 | 66 |
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:1:raw_corpus | raw_corpus | ###
Requires https://github.com/bbatsov/rubocop
###
"use strict"
Beautifier = require('./beautifier')
path = require('path')
module.exports = class Rubocop extends Beautifier
name: "Rubocop"
link: "https://github.com/bbatsov/rubocop"
isPreInstalled: false
options: {
Ruby:
indent_size: true
ru... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 6f8036ba7adb058d9ce718858236f2b329e9d298 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/6f8036ba7adb058d9ce718858236f2b329e9d298/src/beautifiers/rubocop.coffee | 1 | 50 | ||
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:1:completion | completion | ###
Requires https://github.com/bbatsov/rubocop
###
"use strict"
Beautifier = require('./beautifier')
path = require('path')
module.exports = class Rubocop extends Beautifier
name: "Rubocop"
link: "https://github.com/bbatsov/rubocop"
isPreInstalled: false
options: {
Ruby:
indent_size: true
ru... | @which(options.rubocop_path) if options.rubocop_path
@which('rubocop')
])
.then((paths) =>
@debug('rubocop paths', paths)
# Get first valid, absolute path
rubocopPath = paths.find((p) -> p and path.isAbsolute(p)) or "rubocop"
@verbose('rubocopPath', rubocopPath)
@debug('ruboc... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 6f8036ba7adb058d9ce718858236f2b329e9d298 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/6f8036ba7adb058d9ce718858236f2b329e9d298/src/beautifiers/rubocop.coffee | 1 | 50 |
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:1:raw_corpus | raw_corpus | ###
Requires https://github.com/bbatsov/rubocop
###
"use strict"
Beautifier = require('./beautifier')
path = require('path')
temp = require('temp').track()
module.exports = class Rubocop extends Beautifier
name: "Rubocop"
link: "https://github.com/bbatsov/rubocop"
isPreInstalled: false
options: {
Ruby:
... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 5f36431b1d70310a7e70ee6f1580084c875f6d8b | 1,503 | https://github.com/Glavin001/atom-beautify/blob/5f36431b1d70310a7e70ee6f1580084c875f6d8b/src/beautifiers/rubocop.coffee | 1 | 50 | ||
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:1:completion | completion | ###
Requires https://github.com/bbatsov/rubocop
###
"use strict"
Beautifier = require('./beautifier')
path = require('path')
temp = require('temp').track()
module.exports = class Rubocop extends Beautifier
name: "Rubocop"
link: "https://github.com/bbatsov/rubocop"
isPreInstalled: false
options: {
Ruby:
... | @Promise.all([
@which(options.rubocop_path) if options.rubocop_path
@which('rubocop')
])
.then((paths) =>
@debug('rubocop paths', paths)
# Get first valid, absolute path
rubocopPath = paths.find((p) -> p and path.isAbsolute(p)) or "rubocop"
@verbose('rubocopPath', rubocopPath... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 5f36431b1d70310a7e70ee6f1580084c875f6d8b | 1,503 | https://github.com/Glavin001/atom-beautify/blob/5f36431b1d70310a7e70ee6f1580084c875f6d8b/src/beautifiers/rubocop.coffee | 1 | 50 |
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:2:raw_corpus | raw_corpus | ]
rubocopArguments.push("--config", tempConfig) if tempConfig?
@debug("rubocop arguments", rubocopArguments)
@run(rubocopPath, rubocopArguments, {
ignoreReturnCode: true,
cwd: projectPath,
onStdin: (stdin) -> stdin.end text
}).then((stdout) =>
@debug("rubocop out... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 5f36431b1d70310a7e70ee6f1580084c875f6d8b | 1,503 | https://github.com/Glavin001/atom-beautify/blob/5f36431b1d70310a7e70ee6f1580084c875f6d8b/src/beautifiers/rubocop.coffee | 51 | 67 | ||
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:2:completion | completion | ]
rubocopArguments.push("--config", tempConfig) if tempConfig?
@debug("rubocop arguments", rubocopArguments)
@run(rubocopPath, rubocopArguments, {
ignoreReturnCode: true,
cwd: projectPath,
onStdin: (stdin) -> stdin.end text | }).then((stdout) =>
@debug("rubocop output", stdout)
# Rubocop output an error if stdout is empty
return text if stdout.length == 0
result = stdout.split("====================\n")
result[result.length - 1]
)
) | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 5f36431b1d70310a7e70ee6f1580084c875f6d8b | 1,503 | https://github.com/Glavin001/atom-beautify/blob/5f36431b1d70310a7e70ee6f1580084c875f6d8b/src/beautifiers/rubocop.coffee | 51 | 67 |
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:1:raw_corpus | raw_corpus | ###
Requires https://github.com/bbatsov/rubocop
###
"use strict"
Beautifier = require('./beautifier')
path = require('path')
temp = require('temp').track()
module.exports = class Rubocop extends Beautifier
name: "Rubocop"
link: "https://github.com/bbatsov/rubocop"
isPreInstalled: false
options: {
Ruby:
... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 2d595f2a20e917b68490a5d98866f8f2e7f61c9f | 1,503 | https://github.com/Glavin001/atom-beautify/blob/2d595f2a20e917b68490a5d98866f8f2e7f61c9f/src/beautifiers/rubocop.coffee | 1 | 50 | ||
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:1:completion | completion | ###
Requires https://github.com/bbatsov/rubocop
###
"use strict"
Beautifier = require('./beautifier')
path = require('path')
temp = require('temp').track()
module.exports = class Rubocop extends Beautifier
name: "Rubocop"
link: "https://github.com/bbatsov/rubocop"
isPreInstalled: false
options: {
Ruby:
... | @Promise.all([
@which(options.rubocop_path) if options.rubocop_path
@which('rubocop')
])
.then((paths) =>
@debug('rubocop paths', paths)
# Get first valid, absolute path
rubocopPath = paths.find((p) -> p and path.isAbsolute(p)) or "rubocop"
@verbose('rubocopPath', rubocopPath... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 2d595f2a20e917b68490a5d98866f8f2e7f61c9f | 1,503 | https://github.com/Glavin001/atom-beautify/blob/2d595f2a20e917b68490a5d98866f8f2e7f61c9f/src/beautifiers/rubocop.coffee | 1 | 50 |
Glavin001/atom-beautify:src/beautifiers/rubocop.coffee:2:raw_corpus | raw_corpus | "--stdin", relativePath || temp.path({suffix: '.rb'})
]
rubocopArguments.push("--config", tempConfig) if tempConfig?
@debug("rubocop arguments", rubocopArguments)
@run(rubocopPath, rubocopArguments, {
ignoreReturnCode: true,
cwd: projectPath,
onStdin: (stdin) -> stdin.end text
}).... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rubocop.coffee | MIT | 2d595f2a20e917b68490a5d98866f8f2e7f61c9f | 1,503 | https://github.com/Glavin001/atom-beautify/blob/2d595f2a20e917b68490a5d98866f8f2e7f61c9f/src/beautifiers/rubocop.coffee | 51 | 67 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.