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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ichord/At.js:src/controller.coffee:4:completion | completion | sel = @app.window.getSelection()
sel.removeAllRanges()
sel.addRange(range)
else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stackoverflow.com/questions/155359... | # Render list view
#
# @param data [Array] The data
render_view: (data) ->
search_key = this.get_opt("search_key")
data = this.callbacks("sorter").call(this, @query.text, data[0..1000] , search_key)
@view.render data[0...this.get_opt('limit')]
# Searching!
look_up: ->
return if not (query = t... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 3134ece10fdcf7e1bcdc4fca7891fa9d3d412f8a | 5,250 | https://github.com/ichord/At.js/blob/3134ece10fdcf7e1bcdc4fca7891fa9d3d412f8a/src/controller.coffee | 151 | 178 |
ichord/At.js:src/controller.coffee:2:raw_corpus | raw_corpus | event_name = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The callback.
callbacks: (func_name)-... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 79bbef4efbf2556826e171308075acca4a4d8494 | 5,250 | https://github.com/ichord/At.js/blob/79bbef4efbf2556826e171308075acca4a4d8494/src/controller.coffee | 51 | 100 | ||
ichord/At.js:src/controller.coffee:2:completion | completion | event_name = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The callback.
callbacks: (func_name)-... | #
# @return [Hash] Info of the query. Look likes this: {'text': "hello", 'head_pos': 0, 'end_pos': 0}
catch_query: ->
content = this.content()
caret_pos = @$inputor.caret('pos')
subtext = content.slice(0,caret_pos)
query = this.callbacks("matcher").call(this, @at, subtext, this.get_opt('start_with_... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 79bbef4efbf2556826e171308075acca4a4d8494 | 5,250 | https://github.com/ichord/At.js/blob/79bbef4efbf2556826e171308075acca4a4d8494/src/controller.coffee | 51 | 100 |
ichord/At.js:src/controller.coffee:1:raw_corpus | raw_corpus | class Controller
uid: ->
(Math.random().toString(16)+"000000000").substr(2,8) + (new Date().getTime())
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@id = @$inputor[0].id || this.uid()
@setting = null
@query = null
@pos = 0
@cur_rect = null
@range = null
$CO... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | cc1c239f48df65b5d172b26e11de8af5e56c69ee | 5,250 | https://github.com/ichord/At.js/blob/cc1c239f48df65b5d172b26e11de8af5e56c69ee/src/controller.coffee | 1 | 50 | ||
ichord/At.js:src/controller.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Controller
uid: ->
(Math.random().toString(16)+"000000000").substr(2,8) + (new Date().getTime())
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@id = @$inputor[0].id || this.uid()
@setting = null
@query = null
@pos ... | var Controller;
Controller = class Controller {
uid() {
return (Math.random().toString(16) + "000000000").substr(2, 8) + (new Date().getTime());
}
constructor(app, at) {
this.app = app;
this.at = at;
this.$inputor = this.app.$inputor;
this.id = this.$inputor[0].id || this.uid();
this.set... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | cc1c239f48df65b5d172b26e11de8af5e56c69ee | 5,250 | https://github.com/ichord/At.js/blob/cc1c239f48df65b5d172b26e11de8af5e56c69ee/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Controller;
Controller = class Controller {
uid() {
return (Math.random().toString(16) + "000000000").substr(2, 8) + (new Date().getTime());
}
constructor(app, at) {
this.app = app;
this.at = at;
this.$inputor = this.app.$inputor;
th... | class Controller
uid: ->
(Math.random().toString(16)+"000000000").substr(2,8) + (new Date().getTime())
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@id = @$inputor[0].id || this.uid()
@setting = null
@query = null
@pos = 0
@cur_rect = null
@range = null
$CO... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | cc1c239f48df65b5d172b26e11de8af5e56c69ee | 5,250 | https://github.com/ichord/At.js/blob/cc1c239f48df65b5d172b26e11de8af5e56c69ee/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:1:completion | completion | class Controller
uid: ->
(Math.random().toString(16)+"000000000").substr(2,8) + (new Date().getTime())
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@id = @$inputor[0].id || this.uid()
@setting = null
@query = null
@pos = 0
@cur_rect = null
@range = null
$CO... | @model.destroy()
@view.destroy()
call_default: (func_name, args...) ->
try
DEFAULT_CALLBACKS[func_name].apply this, args
catch error
$.error "#{error} Or maybe At.js doesn't have function #{func_name}"
# Delegate custom `jQueryEvent` to the inputor
# This function will add `atwho` as nam... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | cc1c239f48df65b5d172b26e11de8af5e56c69ee | 5,250 | https://github.com/ichord/At.js/blob/cc1c239f48df65b5d172b26e11de8af5e56c69ee/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:2:raw_corpus | raw_corpus | @$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The callback.
callbacks: (func_name)->
this.get_opt("callbacks")[func_name] || DEFAULT_CALLBACKS[func_name]
... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | cc1c239f48df65b5d172b26e11de8af5e56c69ee | 5,250 | https://github.com/ichord/At.js/blob/cc1c239f48df65b5d172b26e11de8af5e56c69ee/src/controller.coffee | 51 | 100 | ||
ichord/At.js:src/controller.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The callback.
callbacks: (func_name)->
this.get_opt("... | this.$inputor.trigger(event_name, data({
// Get callback either in settings which was set by plugin user or in default callbacks list.
// @param func_name [String] callback's name
// @return [Function] The callback.
callbacks: function(func_name) {
return this.get_opt("callbacks")[func_name] || DEFAULT_CAL... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | cc1c239f48df65b5d172b26e11de8af5e56c69ee | 5,250 | https://github.com/ichord/At.js/blob/cc1c239f48df65b5d172b26e11de8af5e56c69ee/src/controller.coffee | 51 | 100 |
ichord/At.js:src/controller.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.$inputor.trigger(event_name, data({
// Get callback either in settings which was set by plugin user or in default callbacks list.
// @param func_name [String] callback's name
// @return [Function] The callback.
callbacks: function(func_name) {
ret... | @$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The callback.
callbacks: (func_name)->
this.get_opt("callbacks")[func_name] || DEFAULT_CALLBACKS[func_name]
... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | cc1c239f48df65b5d172b26e11de8af5e56c69ee | 5,250 | https://github.com/ichord/At.js/blob/cc1c239f48df65b5d172b26e11de8af5e56c69ee/src/controller.coffee | 51 | 100 |
ichord/At.js:src/controller.coffee:2:completion | completion | @$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The callback.
callbacks: (func_name)->
this.get_opt("callbacks")[func_name] || DEFAULT_CALLBACKS[func_name]
... | # @return [Hash] Info of the query. Look likes this: {'text': "hello", 'head_pos': 0, 'end_pos': 0}
catch_query: ->
content = this.content()
caret_pos = @$inputor.caret('pos')
subtext = content.slice(0,caret_pos)
query = this.callbacks("matcher").call(this, @at, subtext, this.get_opt('start_with_spac... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | cc1c239f48df65b5d172b26e11de8af5e56c69ee | 5,250 | https://github.com/ichord/At.js/blob/cc1c239f48df65b5d172b26e11de8af5e56c69ee/src/controller.coffee | 51 | 100 |
ichord/At.js:src/controller.coffee:3:raw_corpus | raw_corpus | {left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$inputor.attr('contentEditable') == 'true'
@range = @app.window.getSelection().getRangeAt(0) if @app.window.getSelection
@ie8_ra... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | cc1c239f48df65b5d172b26e11de8af5e56c69ee | 5,250 | https://github.com/ichord/At.js/blob/cc1c239f48df65b5d172b26e11de8af5e56c69ee/src/controller.coffee | 101 | 150 | ||
ichord/At.js:src/controller.coffee:3:completion | completion | {left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$inputor.attr('contentEditable') == 'true'
@range = @app.window.getSelection().getRangeAt(0) if @app.window.getSelection
@ie8_ra... | if $inputor.attr('contentEditable') == 'true'
class_name = "atwho-view-flag atwho-view-flag-#{this.get_opt('alias') || @at}"
content_node = "#{content}<span contenteditable='false'> <span>"
insert_node = "<span contenteditable='false' class='#{class_name}'>#{content_node}</span>"
$insert_no... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | cc1c239f48df65b5d172b26e11de8af5e56c69ee | 5,250 | https://github.com/ichord/At.js/blob/cc1c239f48df65b5d172b26e11de8af5e56c69ee/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:4:raw_corpus | raw_corpus | sel.removeAllRanges()
sel.addRange(range)
else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stackoverflow.com/questions/15535933/ie-html1114-error-with-custom-cledit... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | cc1c239f48df65b5d172b26e11de8af5e56c69ee | 5,250 | https://github.com/ichord/At.js/blob/cc1c239f48df65b5d172b26e11de8af5e56c69ee/src/controller.coffee | 151 | 177 | ||
ichord/At.js:src/controller.coffee:4:completion | completion | sel.removeAllRanges()
sel.addRange(range)
else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stackoverflow.com/questions/15535933/ie-html1114-error-with-custom-cledit... | # Render list view
#
# @param data [Array] The data
render_view: (data) ->
search_key = this.get_opt("search_key")
data = this.callbacks("sorter").call(this, @query.text, data[0..1000] , search_key)
@view.render data[0...this.get_opt('limit')]
# Searching!
look_up: ->
return if not (query = t... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | cc1c239f48df65b5d172b26e11de8af5e56c69ee | 5,250 | https://github.com/ichord/At.js/blob/cc1c239f48df65b5d172b26e11de8af5e56c69ee/src/controller.coffee | 151 | 177 |
ichord/At.js:src/controller.coffee:1:raw_corpus | raw_corpus | class Controller
_uuid = 0
uuid = ->
_uuid += 1
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@oDocument = @$inputor[0].ownerDocument
@oWindow = @oDocument.defaultView || @oDocument.parentWindow
@id = @$inputor[0].id || uuid()
@setting = null
@query = null
@pos =... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | f3e706542de650f6dd1f103d9826c37f032a6ed4 | 5,250 | https://github.com/ichord/At.js/blob/f3e706542de650f6dd1f103d9826c37f032a6ed4/src/controller.coffee | 1 | 50 | ||
ichord/At.js:src/controller.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Controller
_uuid = 0
uuid = ->
_uuid += 1
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@oDocument = @$inputor[0].ownerDocument
@oWindow = @oDocument.defaultView || @oDocument.parentWindow
@id = @$inputor[0].id || uuid()
... | var Controller;
Controller = (function() {
var _uuid, uuid;
class Controller {
constructor(app, at) {
this.app = app;
this.at = at;
this.$inputor = this.app.$inputor;
this.oDocument = this.$inputor[0].ownerDocument;
this.oWindow = this.oDocument.defaultView || this.oDocument.pare... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | f3e706542de650f6dd1f103d9826c37f032a6ed4 | 5,250 | https://github.com/ichord/At.js/blob/f3e706542de650f6dd1f103d9826c37f032a6ed4/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Controller;
Controller = (function() {
var _uuid, uuid;
class Controller {
constructor(app, at) {
this.app = app;
this.at = at;
this.$inputor = this.app.$inputor;
this.oDocument = this.$inputor[0].ownerDocument;
this.oWin... | class Controller
_uuid = 0
uuid = ->
_uuid += 1
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@oDocument = @$inputor[0].ownerDocument
@oWindow = @oDocument.defaultView || @oDocument.parentWindow
@id = @$inputor[0].id || uuid()
@setting = null
@query = null
@pos =... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | f3e706542de650f6dd1f103d9826c37f032a6ed4 | 5,250 | https://github.com/ichord/At.js/blob/f3e706542de650f6dd1f103d9826c37f032a6ed4/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:1:completion | completion | class Controller
_uuid = 0
uuid = ->
_uuid += 1
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@oDocument = @$inputor[0].ownerDocument
@oWindow = @oDocument.defaultView || @oDocument.parentWindow
@id = @$inputor[0].id || uuid()
@setting = null
@query = null
@pos =... | destroy: ->
this.trigger 'beforeDestroy'
@model.destroy()
@view.destroy()
call_default: (func_name, args...) ->
try
DEFAULT_CALLBACKS[func_name].apply this, args
catch error
$.error "#{error} Or maybe At.js doesn't have function #{func_name}"
# Delegate custom `jQueryEvent` to the ... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | f3e706542de650f6dd1f103d9826c37f032a6ed4 | 5,250 | https://github.com/ichord/At.js/blob/f3e706542de650f6dd1f103d9826c37f032a6ed4/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:2:raw_corpus | raw_corpus | data.push this
alias = this.get_opt('alias')
event_name = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @retu... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | f3e706542de650f6dd1f103d9826c37f032a6ed4 | 5,250 | https://github.com/ichord/At.js/blob/f3e706542de650f6dd1f103d9826c37f032a6ed4/src/controller.coffee | 51 | 100 | ||
ichord/At.js:src/controller.coffee:2:completion | completion | data.push this
alias = this.get_opt('alias')
event_name = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @retu... | # Catch query string behind the at char
#
# @return [Hash] Info of the query. Look likes this: {'text': "hello", 'head_pos': 0, 'end_pos': 0}
catch_query: ->
content = this.content()
caret_pos = @$inputor.caret('pos')
subtext = content.slice(0,caret_pos)
query = this.callbacks("matcher").call(thi... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | f3e706542de650f6dd1f103d9826c37f032a6ed4 | 5,250 | https://github.com/ichord/At.js/blob/f3e706542de650f6dd1f103d9826c37f032a6ed4/src/controller.coffee | 51 | 100 |
ichord/At.js:src/controller.coffee:3:raw_corpus | raw_corpus | return if not c = @$inputor.caret('offset', @pos - 1)
c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('con... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | f3e706542de650f6dd1f103d9826c37f032a6ed4 | 5,250 | https://github.com/ichord/At.js/blob/f3e706542de650f6dd1f103d9826c37f032a6ed4/src/controller.coffee | 101 | 150 | ||
ichord/At.js:src/controller.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return if not c = @$inputor.caret('offset', @pos - 1)
c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
r... | var c, scale_bottom;
if (!(c = this.$inputor.caret('offset', this.pos - 1))) {
if (this.$inputor.attr('contentEditable') === 'true') {
c = (this.cur_rect || (this.cur_rect = c)) || c;
}
scale_bottom = document.selection ? 0 : 2;
return {
left: c.left,
top: c.top,
bottom: c.top + c.height + scal... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | f3e706542de650f6dd1f103d9826c37f032a6ed4 | 5,250 | https://github.com/ichord/At.js/blob/f3e706542de650f6dd1f103d9826c37f032a6ed4/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var c, scale_bottom;
if (!(c = this.$inputor.caret('offset', this.pos - 1))) {
if (this.$inputor.attr('contentEditable') === 'true') {
c = (this.cur_rect || (this.cur_rect = c)) || c;
}
scale_bottom = document.selection ? 0 : 2;
return {
left: c.le... | return if not c = @$inputor.caret('offset', @pos - 1)
c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('con... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | f3e706542de650f6dd1f103d9826c37f032a6ed4 | 5,250 | https://github.com/ichord/At.js/blob/f3e706542de650f6dd1f103d9826c37f032a6ed4/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:completion | completion | return if not c = @$inputor.caret('offset', @pos - 1)
c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('con... | insert: (content, $li) ->
$inputor = @$inputor
if $inputor.attr('contentEditable') == 'true'
class_name = "atwho-view-flag atwho-view-flag-#{this.get_opt('alias') || @at}"
content_node = "#{content}<span contenteditable='false'> <span>"
insert_node = "<span contenteditable='false' class=... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | f3e706542de650f6dd1f103d9826c37f032a6ed4 | 5,250 | https://github.com/ichord/At.js/blob/f3e706542de650f6dd1f103d9826c37f032a6ed4/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:4:raw_corpus | raw_corpus | range.insertNode($insert_node[0])
range.collapse(false)
sel = @oWindow.getSelection()
sel.removeAllRanges()
sel.addRange(range)
else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it wor... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | f3e706542de650f6dd1f103d9826c37f032a6ed4 | 5,250 | https://github.com/ichord/At.js/blob/f3e706542de650f6dd1f103d9826c37f032a6ed4/src/controller.coffee | 151 | 180 | ||
ichord/At.js:src/controller.coffee:4:completion | completion | range.insertNode($insert_node[0])
range.collapse(false)
sel = @oWindow.getSelection()
sel.removeAllRanges()
sel.addRange(range)
else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it wor... | # Render list view
#
# @param data [Array] The data
render_view: (data) ->
search_key = this.get_opt("search_key")
data = this.callbacks("sorter").call(this, @query.text, data[0..1000] , search_key)
@view.render data[0...this.get_opt('limit')]
# Searching!
look_up: ->
return if not (query = t... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | f3e706542de650f6dd1f103d9826c37f032a6ed4 | 5,250 | https://github.com/ichord/At.js/blob/f3e706542de650f6dd1f103d9826c37f032a6ed4/src/controller.coffee | 151 | 180 |
ichord/At.js:src/controller.coffee:1:raw_corpus | raw_corpus | class Controller
_uuid = 0
uuid = ->
_uuid += 1
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@oDocument = @$inputor[0].ownerDocument
@oWindow = @oDocument.defaultView || @oDocument.parentWindow
@id = @$inputor[0].id || uuid()
@setting = null
@query = null
@pos =... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | c084f8afce9a723d5a0556e0b1173484518fc33a | 5,250 | https://github.com/ichord/At.js/blob/c084f8afce9a723d5a0556e0b1173484518fc33a/src/controller.coffee | 1 | 50 | ||
ichord/At.js:src/controller.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Controller
_uuid = 0
uuid = ->
_uuid += 1
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@oDocument = @$inputor[0].ownerDocument
@oWindow = @oDocument.defaultView || @oDocument.parentWindow
@id = @$inputor[0].id || uuid()
... | var Controller;
Controller = (function() {
var _uuid, uuid;
class Controller {
constructor(app, at) {
this.app = app;
this.at = at;
this.$inputor = this.app.$inputor;
this.oDocument = this.$inputor[0].ownerDocument;
this.oWindow = this.oDocument.defaultView || this.oDocument.pare... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | c084f8afce9a723d5a0556e0b1173484518fc33a | 5,250 | https://github.com/ichord/At.js/blob/c084f8afce9a723d5a0556e0b1173484518fc33a/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Controller;
Controller = (function() {
var _uuid, uuid;
class Controller {
constructor(app, at) {
this.app = app;
this.at = at;
this.$inputor = this.app.$inputor;
this.oDocument = this.$inputor[0].ownerDocument;
this.oWin... | class Controller
_uuid = 0
uuid = ->
_uuid += 1
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@oDocument = @$inputor[0].ownerDocument
@oWindow = @oDocument.defaultView || @oDocument.parentWindow
@id = @$inputor[0].id || uuid()
@setting = null
@query = null
@pos =... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | c084f8afce9a723d5a0556e0b1173484518fc33a | 5,250 | https://github.com/ichord/At.js/blob/c084f8afce9a723d5a0556e0b1173484518fc33a/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:1:completion | completion | class Controller
_uuid = 0
uuid = ->
_uuid += 1
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@oDocument = @$inputor[0].ownerDocument
@oWindow = @oDocument.defaultView || @oDocument.parentWindow
@id = @$inputor[0].id || uuid()
@setting = null
@query = null
@pos =... | @model.reload @setting.data
call_default: (func_name, args...) ->
try
DEFAULT_CALLBACKS[func_name].apply this, args
catch error
$.error "#{error} Or maybe At.js doesn't have function #{func_name}"
# Delegate custom `jQueryEvent` to the inputor
# This function will add `atwho` as namespace to... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | c084f8afce9a723d5a0556e0b1173484518fc33a | 5,250 | https://github.com/ichord/At.js/blob/c084f8afce9a723d5a0556e0b1173484518fc33a/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:2:raw_corpus | raw_corpus | # Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The callback.
callbacks: (func_name)->
this.get_opt("callbacks")[func_name] || DEFAULT_CALLBACKS[func_name]
# Because different registered at cha... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | c084f8afce9a723d5a0556e0b1173484518fc33a | 5,250 | https://github.com/ichord/At.js/blob/c084f8afce9a723d5a0556e0b1173484518fc33a/src/controller.coffee | 51 | 100 | ||
ichord/At.js:src/controller.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The callback.
callbacks: (func_name)->
this.get_opt("callbacks")[func_name] || DEFAULT_CALL... | // Get callback either in settings which was set by plugin user or in default callbacks list.
// @param func_name [String] callback's name
// @return [Function] The callback.
({
callbacks: function(func_name) {
return this.get_opt("callbacks")[func_name] || DEFAULT_CALLBACKS[func_name];
},
// Because differe... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | c084f8afce9a723d5a0556e0b1173484518fc33a | 5,250 | https://github.com/ichord/At.js/blob/c084f8afce9a723d5a0556e0b1173484518fc33a/src/controller.coffee | 51 | 100 |
ichord/At.js:src/controller.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Get callback either in settings which was set by plugin user or in default callbacks list.
// @param func_name [String] callback's name
// @return [Function] The callback.
({
callbacks: function(func_name) {
return this.get_opt("callbacks")[func_name] || ... | # Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The callback.
callbacks: (func_name)->
this.get_opt("callbacks")[func_name] || DEFAULT_CALLBACKS[func_name]
# Because different registered at cha... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | c084f8afce9a723d5a0556e0b1173484518fc33a | 5,250 | https://github.com/ichord/At.js/blob/c084f8afce9a723d5a0556e0b1173484518fc33a/src/controller.coffee | 51 | 100 |
ichord/At.js:src/controller.coffee:2:completion | completion | # Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The callback.
callbacks: (func_name)->
this.get_opt("callbacks")[func_name] || DEFAULT_CALLBACKS[func_name]
# Because different registered at cha... | catch_query: ->
content = this.content()
caret_pos = @$inputor.caret('pos')
subtext = content.slice(0,caret_pos)
query = this.callbacks("matcher").call(this, @at, subtext, this.get_opt('start_with_space'))
if typeof query is "string" and query.length <= this.get_opt('max_len', 20)
start = car... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | c084f8afce9a723d5a0556e0b1173484518fc33a | 5,250 | https://github.com/ichord/At.js/blob/c084f8afce9a723d5a0556e0b1173484518fc33a/src/controller.coffee | 51 | 100 |
ichord/At.js:src/controller.coffee:3:raw_corpus | raw_corpus | reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$inputor.attr('contentEditable') == 'true'
@range = @oWindow.getSelection().getRangeAt(0) if @oWindow.getSelection
@ie8_range = @oDocument.selection.createRange() if @oDocument.selection
insert_co... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | c084f8afce9a723d5a0556e0b1173484518fc33a | 5,250 | https://github.com/ichord/At.js/blob/c084f8afce9a723d5a0556e0b1173484518fc33a/src/controller.coffee | 101 | 150 | ||
ichord/At.js:src/controller.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$inputor.attr('contentEditable') == 'true'
@range = @oWindow.getSelection().getRangeAt(0) if @oWindow.getSelection
@ie8_range = @oDocument.sel... | ({
reset_rect: function() {
if (this.$inputor.attr('contentEditable') === 'true') {
return this.cur_rect = null;
}
},
mark_range: function() {
if (this.$inputor.attr('contentEditable') === 'true') {
if (this.oWindow.getSelection) {
this.range = this.oWindow.getSelection().getRangeA... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | c084f8afce9a723d5a0556e0b1173484518fc33a | 5,250 | https://github.com/ichord/At.js/blob/c084f8afce9a723d5a0556e0b1173484518fc33a/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
reset_rect: function() {
if (this.$inputor.attr('contentEditable') === 'true') {
return this.cur_rect = null;
}
},
mark_range: function() {
if (this.$inputor.attr('contentEditable') === 'true') {
if (this.oWindow.getSelection) {
... | reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$inputor.attr('contentEditable') == 'true'
@range = @oWindow.getSelection().getRangeAt(0) if @oWindow.getSelection
@ie8_range = @oDocument.selection.createRange() if @oDocument.selection
insert_co... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | c084f8afce9a723d5a0556e0b1173484518fc33a | 5,250 | https://github.com/ichord/At.js/blob/c084f8afce9a723d5a0556e0b1173484518fc33a/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:completion | completion | reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$inputor.attr('contentEditable') == 'true'
@range = @oWindow.getSelection().getRangeAt(0) if @oWindow.getSelection
@ie8_range = @oDocument.selection.createRange() if @oDocument.selection
insert_co... | content_node = "#{content}<span contenteditable='false'> <span>"
insert_node = "<span contenteditable='false' class='#{class_name}'>#{content_node}</span>"
$insert_node = $(insert_node, @oDocument).data('atwho-data-item', $li.data('item-data'))
if @oDocument.selection
$insert_node = $("<s... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | c084f8afce9a723d5a0556e0b1173484518fc33a | 5,250 | https://github.com/ichord/At.js/blob/c084f8afce9a723d5a0556e0b1173484518fc33a/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:4:raw_corpus | raw_corpus | else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stackoverflow.com/questions/15535933/ie-html1114-error-with-custom-cleditor-button?answertab=votes#tab-top
range.moveSt... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | c084f8afce9a723d5a0556e0b1173484518fc33a | 5,250 | https://github.com/ichord/At.js/blob/c084f8afce9a723d5a0556e0b1173484518fc33a/src/controller.coffee | 151 | 175 | ||
ichord/At.js:src/controller.coffee:4:completion | completion | else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stackoverflow.com/questions/15535933/ie-html1114-error-with-custom-cleditor-button?answertab=votes#tab-top
range.moveSt... | #
# @param data [Array] The data
render_view: (data) ->
search_key = this.get_opt("search_key")
data = this.callbacks("sorter").call(this, @query.text, data[0..1000] , search_key)
@view.render data[0...this.get_opt('limit')]
# Searching!
look_up: ->
return if not (query = this.catch_query())
... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | c084f8afce9a723d5a0556e0b1173484518fc33a | 5,250 | https://github.com/ichord/At.js/blob/c084f8afce9a723d5a0556e0b1173484518fc33a/src/controller.coffee | 151 | 175 |
ichord/At.js:src/controller.coffee:4:raw_corpus | raw_corpus | else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stackoverflow.com/questions/15535933/ie-html1114-error-with-custom-cleditor-button?answertab=votes#tab-top
range.moveSt... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 7569078e80d186c7f530356e57cf3339202efcd8 | 5,250 | https://github.com/ichord/At.js/blob/7569078e80d186c7f530356e57cf3339202efcd8/src/controller.coffee | 151 | 175 | ||
ichord/At.js:src/controller.coffee:4:completion | completion | else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stackoverflow.com/questions/15535933/ie-html1114-error-with-custom-cleditor-button?answertab=votes#tab-top
range.moveSt... | #
# @param data [Array] The data
render_view: (data) ->
search_key = this.get_opt("search_key")
data = this.callbacks("sorter").call(this, @query.text, data[0..1000] , search_key)
@view.render data[0...this.get_opt('limit')]
# Searching!
look_up: ->
return if not (query = this.catch_query())
... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 7569078e80d186c7f530356e57cf3339202efcd8 | 5,250 | https://github.com/ichord/At.js/blob/7569078e80d186c7f530356e57cf3339202efcd8/src/controller.coffee | 151 | 175 |
mojotech/pioneer:test/integration/steps/iframe_steps.coffee:1:raw_corpus | raw_corpus | module.exports = ->
@When /^I switch to the iframe "([^"]*)" I should see the content "([^"]*)"$/, (iframe, content)->
new @Widgets.Myframe({
root: iframe
}).focus()
.then (w) -> w.getParentText('p')
.should.eventually.eql(content)
@When /^I unfocus from the iframe "([^"]*)" I should see "([^... | CoffeeScript | mojotech/pioneer | test/integration/steps/iframe_steps.coffee | MIT | 5a0c6a3758504e10469f9563c85db6460419bcfc | 523 | https://github.com/mojotech/pioneer/blob/5a0c6a3758504e10469f9563c85db6460419bcfc/test/integration/steps/iframe_steps.coffee | 1 | 14 | ||
mojotech/pioneer:test/integration/steps/iframe_steps.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = ->
@When /^I switch to the iframe "([^"]*)" I should see the content "([^"]*)"$/, (iframe, content)->
new @Widgets.Myframe({
root: iframe
}).focus()
.then (w) -> w.getParentText('p')
.should.eventually.eql(content)
@Whe... | module.exports = function() {
this.When(/^I switch to the iframe "([^"]*)" I should see the content "([^"]*)"$/, function(iframe, content) {
return new this.Widgets.Myframe({
root: iframe
}).focus().then(function(w) {
return w.getParentText('p');
}).should.eventually.eql(content);
});
retu... | CoffeeScript | JavaScript | mojotech/pioneer | test/integration/steps/iframe_steps.coffee | MIT | 5a0c6a3758504e10469f9563c85db6460419bcfc | 523 | https://github.com/mojotech/pioneer/blob/5a0c6a3758504e10469f9563c85db6460419bcfc/test/integration/steps/iframe_steps.coffee | 1 | 14 |
mojotech/pioneer:test/integration/steps/iframe_steps.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = function() {
this.When(/^I switch to the iframe "([^"]*)" I should see the content "([^"]*)"$/, function(iframe, content) {
return new this.Widgets.Myframe({
root: iframe
}).focus().then(function(w) {
return w.getParentText('p... | module.exports = ->
@When /^I switch to the iframe "([^"]*)" I should see the content "([^"]*)"$/, (iframe, content)->
new @Widgets.Myframe({
root: iframe
}).focus()
.then (w) -> w.getParentText('p')
.should.eventually.eql(content)
@When /^I unfocus from the iframe "([^"]*)" I should see "([^... | JavaScript | CoffeeScript | mojotech/pioneer | test/integration/steps/iframe_steps.coffee | MIT | 5a0c6a3758504e10469f9563c85db6460419bcfc | 523 | https://github.com/mojotech/pioneer/blob/5a0c6a3758504e10469f9563c85db6460419bcfc/test/integration/steps/iframe_steps.coffee | 1 | 14 |
mojotech/pioneer:test/integration/steps/iframe_steps.coffee:1:completion | completion | module.exports = ->
@When /^I switch to the iframe "([^"]*)" I should see the content "([^"]*)"$/, (iframe, content)->
new @Widgets.Myframe({
root: iframe
}).focus()
.then (w) -> w.getParentText('p')
.should.eventually.eql(content) | @When /^I unfocus from the iframe "([^"]*)" I should see "([^"]*)"$/, (iframe, content) ->
new @Widgets.Myframe({
root: iframe
}).unfocus()
.then (w) -> w.getParentText('p')
.should.eventually.eql(content) | CoffeeScript | CoffeeScript | mojotech/pioneer | test/integration/steps/iframe_steps.coffee | MIT | 5a0c6a3758504e10469f9563c85db6460419bcfc | 523 | https://github.com/mojotech/pioneer/blob/5a0c6a3758504e10469f9563c85db6460419bcfc/test/integration/steps/iframe_steps.coffee | 1 | 14 |
xhan/qqbot:tests/prompt.coffee:1:raw_corpus | raw_corpus | #!/usr/bin/env coffee
prompt = (title, callback) ->
process.stdin.resume()
process.stdout.write(title)
process.stdin.once "data", (data) ->
callback data.toString().trim()
process.stdin.pause()
# control + d to end
process.stdin.on 'end', ->
process.stdout.write('end')
... | CoffeeScript | xhan/qqbot | tests/prompt.coffee | MIT | 6cd2e1127421f1307ba64b6c9fdff905d9a9e921 | 1,435 | https://github.com/xhan/qqbot/blob/6cd2e1127421f1307ba64b6c9fdff905d9a9e921/tests/prompt.coffee | 1 | 21 | ||
xhan/qqbot:tests/prompt.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
#!/usr/bin/env coffee
prompt = (title, callback) ->
process.stdin.resume()
process.stdout.write(title)
process.stdin.once "data", (data) ->
callback data.toString().trim()
process.stdin.pause()
# control + d to end
process.st... | //!/usr/bin/env coffee
var log, prompt;
prompt = function(title, callback) {
process.stdin.resume();
process.stdout.write(title);
process.stdin.once("data", function(data) {
callback(data.toString().trim());
return process.stdin.pause();
});
// control + d to end
return process.stdin.on('end', func... | CoffeeScript | JavaScript | xhan/qqbot | tests/prompt.coffee | MIT | 6cd2e1127421f1307ba64b6c9fdff905d9a9e921 | 1,435 | https://github.com/xhan/qqbot/blob/6cd2e1127421f1307ba64b6c9fdff905d9a9e921/tests/prompt.coffee | 1 | 21 |
xhan/qqbot:tests/prompt.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
//!/usr/bin/env coffee
var log, prompt;
prompt = function(title, callback) {
process.stdin.resume();
process.stdout.write(title);
process.stdin.once("data", function(data) {
callback(data.toString().trim());
return process.stdin.pause();
});
// c... | #!/usr/bin/env coffee
prompt = (title, callback) ->
process.stdin.resume()
process.stdout.write(title)
process.stdin.once "data", (data) ->
callback data.toString().trim()
process.stdin.pause()
# control + d to end
process.stdin.on 'end', ->
process.stdout.write('end')
... | JavaScript | CoffeeScript | xhan/qqbot | tests/prompt.coffee | MIT | 6cd2e1127421f1307ba64b6c9fdff905d9a9e921 | 1,435 | https://github.com/xhan/qqbot/blob/6cd2e1127421f1307ba64b6c9fdff905d9a9e921/tests/prompt.coffee | 1 | 21 |
xhan/qqbot:tests/prompt.coffee:1:completion | completion | #!/usr/bin/env coffee
prompt = (title, callback) ->
process.stdin.resume()
process.stdout.write(title)
process.stdin.once "data", (data) ->
callback data.toString().trim()
process.stdin.pause()
# control + d to end
process.stdin.on 'end', -> | process.stdout.write('end')
callback()
log = console.log
log "hello"
prompt "input something", (content)->
log content
log "end" | CoffeeScript | CoffeeScript | xhan/qqbot | tests/prompt.coffee | MIT | 6cd2e1127421f1307ba64b6c9fdff905d9a9e921 | 1,435 | https://github.com/xhan/qqbot/blob/6cd2e1127421f1307ba64b6c9fdff905d9a9e921/tests/prompt.coffee | 1 | 21 |
nevir/groc:lib/utils/logger.coffee:1:raw_corpus | raw_corpus | # # groc.Logger
colors = require 'colors'
CompatibilityHelpers = require './compatibility_helpers'
# We have pretty simple needs for a logger, and so far have been unable to find a reasonable
# off-the-shelf solution that fits them without being too overbearing:
module.exports = class Logger
# * We want the stand... | CoffeeScript | nevir/groc | lib/utils/logger.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/logger.coffee | 1 | 50 | ||
nevir/groc:lib/utils/logger.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# # groc.Logger
colors = require 'colors'
CompatibilityHelpers = require './compatibility_helpers'
# We have pretty simple needs for a logger, and so far have been unable to find a reasonable
# off-the-shelf solution that fits them without being too overbeari... | // # groc.Logger
var CompatibilityHelpers, Logger, colors;
colors = require('colors');
CompatibilityHelpers = require('./compatibility_helpers');
// We have pretty simple needs for a logger, and so far have been unable to find a reasonable
// off-the-shelf solution that fits them without being too overbearing:
modul... | CoffeeScript | JavaScript | nevir/groc | lib/utils/logger.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/logger.coffee | 1 | 50 |
nevir/groc:lib/utils/logger.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// # groc.Logger
var CompatibilityHelpers, Logger, colors;
colors = require('colors');
CompatibilityHelpers = require('./compatibility_helpers');
// We have pretty simple needs for a logger, and so far have been unable to find a reasonable
// off-the-shelf solut... | # # groc.Logger
colors = require 'colors'
CompatibilityHelpers = require './compatibility_helpers'
# We have pretty simple needs for a logger, and so far have been unable to find a reasonable
# off-the-shelf solution that fits them without being too overbearing:
module.exports = class Logger
# * We want the stand... | JavaScript | CoffeeScript | nevir/groc | lib/utils/logger.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/logger.coffee | 1 | 50 |
nevir/groc:lib/utils/logger.coffee:1:completion | completion | # # groc.Logger
colors = require 'colors'
CompatibilityHelpers = require './compatibility_helpers'
# We have pretty simple needs for a logger, and so far have been unable to find a reasonable
# off-the-shelf solution that fits them without being too overbearing:
module.exports = class Logger
# * We want the stand... | INFO: ' '
PASS: '✓ '
WARN: '» '
ERROR: '! '
# * Colors make the world better.
LEVEL_COLORS:
TRACE: 'grey'
DEBUG: 'grey'
INFO: 'black'
PASS: 'green'
WARN: 'yellow'
ERROR: 'red'
# * Don't forget the semantics of our output.
LEVEL_STREAMS:
TRACE: console.log
DEB... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/logger.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/logger.coffee | 1 | 50 |
nevir/groc:lib/utils/logger.coffee:2:raw_corpus | raw_corpus | for name of @LEVELS
do (name) =>
@[name.toLowerCase()] = (args...) ->
@emit name, args...
emit: (levelName, args...) ->
if @LEVELS[levelName] >= @minLevel
output = CompatibilityHelpers.format args...
# * We like nicely indented output
output = output.split(/\r?\n/).join... | CoffeeScript | nevir/groc | lib/utils/logger.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/logger.coffee | 51 | 73 | ||
nevir/groc:lib/utils/logger.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
for name of @LEVELS
do (name) =>
@[name.toLowerCase()] = (args...) ->
@emit name, args...
emit: (levelName, args...) ->
if @LEVELS[levelName] >= @minLevel
output = CompatibilityHelpers.format args...
# * We like nicely ... | var globalLogger, level, name;
for (name in this.LEVELS) {
((name) => {
return this[name.toLowerCase()] = function(...args) {
return this.emit(name, ...args);
};
})(name);
}
({
emit: function(levelName, ...args) {
var output;
if (this.LEVELS[levelName] >= this.minLevel) {
output = Co... | CoffeeScript | JavaScript | nevir/groc | lib/utils/logger.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/logger.coffee | 51 | 73 |
nevir/groc:lib/utils/logger.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var globalLogger, level, name;
for (name in this.LEVELS) {
((name) => {
return this[name.toLowerCase()] = function(...args) {
return this.emit(name, ...args);
};
})(name);
}
({
emit: function(levelName, ...args) {
var output;
if (this.... | for name of @LEVELS
do (name) =>
@[name.toLowerCase()] = (args...) ->
@emit name, args...
emit: (levelName, args...) ->
if @LEVELS[levelName] >= @minLevel
output = CompatibilityHelpers.format args...
# * We like nicely indented output
output = output.split(/\r?\n/).join... | JavaScript | CoffeeScript | nevir/groc | lib/utils/logger.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/logger.coffee | 51 | 73 |
nevir/groc:lib/utils/logger.coffee:2:completion | completion | for name of @LEVELS
do (name) =>
@[name.toLowerCase()] = (args...) ->
@emit name, args...
emit: (levelName, args...) ->
if @LEVELS[levelName] >= @minLevel
output = CompatibilityHelpers.format args...
# * We like nicely indented output
output = output.split(/\r?\n/).join... | @LEVEL_STREAMS[levelName] colors[@LEVEL_COLORS[levelName]] "#{@LEVEL_PREFIXES[levelName]}#{output}"
output
# * Sometimes we just want one-off logging
globalLogger = new Logger Logger::LEVELS.TRACE
for level of globalLogger.LEVELS
do (level) ->
Logger[level.toLowerCase()] = (args...) -> globalLogger[level... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/logger.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/logger.coffee | 51 | 73 |
nevir/groc:lib/utils/logger.coffee:1:raw_corpus | raw_corpus | # # groc.Logger
CompatibilityHelpers = require './compatibility_helpers'
colors = require 'colors'
# We have pretty simple needs for a logger, and so far have been unable to find a reasonable
# off-the-shelf solution that fits them without being too overbearing:
class Logger
# * We want the standard levels of outpu... | CoffeeScript | nevir/groc | lib/utils/logger.coffee | MIT | 0baa87b0141f11a3c5cd610b6039ce26ec357bf6 | 579 | https://github.com/nevir/groc/blob/0baa87b0141f11a3c5cd610b6039ce26ec357bf6/lib/utils/logger.coffee | 1 | 50 | ||
nevir/groc:lib/utils/logger.coffee:1:completion | completion | # # groc.Logger
CompatibilityHelpers = require './compatibility_helpers'
colors = require 'colors'
# We have pretty simple needs for a logger, and so far have been unable to find a reasonable
# off-the-shelf solution that fits them without being too overbearing:
class Logger
# * We want the standard levels of outpu... | WARN: '» '
ERROR: '! '
# * Colors make the world better.
LEVEL_COLORS:
TRACE: 'grey'
DEBUG: 'grey'
INFO: 'black'
PASS: 'green'
WARN: 'yellow'
ERROR: 'red'
# * Don't forget the semantics of our output.
LEVEL_STREAMS:
TRACE: console.log
DEBUG: console.log
INFO: conso... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/logger.coffee | MIT | 0baa87b0141f11a3c5cd610b6039ce26ec357bf6 | 579 | https://github.com/nevir/groc/blob/0baa87b0141f11a3c5cd610b6039ce26ec357bf6/lib/utils/logger.coffee | 1 | 50 |
nevir/groc:lib/utils/logger.coffee:2:raw_corpus | raw_corpus | do (name) =>
@[name.toLowerCase()] = (args...) ->
@emit name, args...
emit: (levelName, args...) ->
if @LEVELS[levelName] >= @minLevel
output = CompatibilityHelpers.format args...
# * We like nicely indented output
output = output.split(/\r?\n/).join('\n ')
@LEVEL_STR... | CoffeeScript | nevir/groc | lib/utils/logger.coffee | MIT | 0baa87b0141f11a3c5cd610b6039ce26ec357bf6 | 579 | https://github.com/nevir/groc/blob/0baa87b0141f11a3c5cd610b6039ce26ec357bf6/lib/utils/logger.coffee | 51 | 73 | ||
nevir/groc:lib/utils/logger.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
do (name) =>
@[name.toLowerCase()] = (args...) ->
@emit name, args...
emit: (levelName, args...) ->
if @LEVELS[levelName] >= @minLevel
output = CompatibilityHelpers.format args...
# * We like nicely indented output
outp... | var globalLogger, level;
((name) => {
return this[name.toLowerCase()] = function(...args) {
return this.emit(name, ...args);
};
})(name);
({
emit: function(levelName, ...args) {
var output;
if (this.LEVELS[levelName] >= this.minLevel) {
output = CompatibilityHelpers.format(...args);
// *... | CoffeeScript | JavaScript | nevir/groc | lib/utils/logger.coffee | MIT | 0baa87b0141f11a3c5cd610b6039ce26ec357bf6 | 579 | https://github.com/nevir/groc/blob/0baa87b0141f11a3c5cd610b6039ce26ec357bf6/lib/utils/logger.coffee | 51 | 73 |
nevir/groc:lib/utils/logger.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var globalLogger, level;
((name) => {
return this[name.toLowerCase()] = function(...args) {
return this.emit(name, ...args);
};
})(name);
({
emit: function(levelName, ...args) {
var output;
if (this.LEVELS[levelName] >= this.minLevel) {
ou... | do (name) =>
@[name.toLowerCase()] = (args...) ->
@emit name, args...
emit: (levelName, args...) ->
if @LEVELS[levelName] >= @minLevel
output = CompatibilityHelpers.format args...
# * We like nicely indented output
output = output.split(/\r?\n/).join('\n ')
@LEVEL_STR... | JavaScript | CoffeeScript | nevir/groc | lib/utils/logger.coffee | MIT | 0baa87b0141f11a3c5cd610b6039ce26ec357bf6 | 579 | https://github.com/nevir/groc/blob/0baa87b0141f11a3c5cd610b6039ce26ec357bf6/lib/utils/logger.coffee | 51 | 73 |
nevir/groc:lib/utils/logger.coffee:2:completion | completion | do (name) =>
@[name.toLowerCase()] = (args...) ->
@emit name, args...
emit: (levelName, args...) ->
if @LEVELS[levelName] >= @minLevel
output = CompatibilityHelpers.format args...
# * We like nicely indented output
output = output.split(/\r?\n/).join('\n ') | @LEVEL_STREAMS[levelName] colors[@LEVEL_COLORS[levelName]] "#{@LEVEL_PREFIXES[levelName]}#{output}"
output
# * Sometimes we just want one-off logging
globalLogger = new Logger Logger::LEVELS.TRACE
for level of globalLogger.LEVELS
do (level) ->
Logger[level.toLowerCase()] = (args...) -> globalLogger[level... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/logger.coffee | MIT | 0baa87b0141f11a3c5cd610b6039ce26ec357bf6 | 579 | https://github.com/nevir/groc/blob/0baa87b0141f11a3c5cd610b6039ce26ec357bf6/lib/utils/logger.coffee | 51 | 73 |
jianliaoim/talk-os:talk-web/test/spec/util/textarea.spec.coffee:1:raw_corpus | raw_corpus | describe 'util: textarea', ->
beforeEach ->
@textarea = require 'util/textarea'
describe 'function: getTrigger', ->
specials = ['@', '#']
it 'should handle normal text', ->
expect(@textarea.getTrigger('test', specials)).toBeNull()
it 'should handle text with specials', ->
expect(@tex... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/util/textarea.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/textarea.spec.coffee | 1 | 39 | ||
jianliaoim/talk-os:talk-web/test/spec/util/textarea.spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'util: textarea', ->
beforeEach ->
@textarea = require 'util/textarea'
describe 'function: getTrigger', ->
specials = ['@', '#']
it 'should handle normal text', ->
expect(@textarea.getTrigger('test', specials)).toBeNull()
it... | describe('util: textarea', function() {
beforeEach(function() {
return this.textarea = require('util/textarea');
});
describe('function: getTrigger', function() {
var specials;
specials = ['@', '#'];
it('should handle normal text', function() {
return expect(this.textarea.getTrigger('test', ... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/test/spec/util/textarea.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/textarea.spec.coffee | 1 | 39 |
jianliaoim/talk-os:talk-web/test/spec/util/textarea.spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('util: textarea', function() {
beforeEach(function() {
return this.textarea = require('util/textarea');
});
describe('function: getTrigger', function() {
var specials;
specials = ['@', '#'];
it('should handle normal text', function() ... | describe 'util: textarea', ->
beforeEach ->
@textarea = require 'util/textarea'
describe 'function: getTrigger', ->
specials = ['@', '#']
it 'should handle normal text', ->
expect(@textarea.getTrigger('test', specials)).toBeNull()
it 'should handle text with specials', ->
expect(@tex... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/util/textarea.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/textarea.spec.coffee | 1 | 39 |
jianliaoim/talk-os:talk-web/test/spec/util/textarea.spec.coffee:1:completion | completion | describe 'util: textarea', ->
beforeEach ->
@textarea = require 'util/textarea'
describe 'function: getTrigger', ->
specials = ['@', '#']
it 'should handle normal text', ->
expect(@textarea.getTrigger('test', specials)).toBeNull()
it 'should handle text with specials', ->
expect(@tex... | describe 'function: getQuery', ->
it 'should get the query', ->
expect(@textarea.getQuery('@test', '@')).toBe 'test'
expect(@textarea.getQuery('#test', '#')).toBe 'test'
expect(@textarea.getQuery('@test test', '@')).toBe 'test test'
it 'should handle text in front of the special', ->
ex... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/util/textarea.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/textarea.spec.coffee | 1 | 39 |
jianliaoim/talk-os:talk-account/client/app/bind-thirdparty.coffee:1:raw_corpus | raw_corpus | module.exports = React.createClass
displayName: 'bind-thirdparty'
propTypes:
store: React.PropTypes.instanceOf(Immutable.Map).isRequired
getInitialState: ->
showForceBind: false
bindCode: null
showname: null
error: null
componentDidMount: ->
if @getAction() is 'bind'
@bindUnion(... | CoffeeScript | jianliaoim/talk-os | talk-account/client/app/bind-thirdparty.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/bind-thirdparty.coffee | 13 | 62 | ||
jianliaoim/talk-os:talk-account/client/app/bind-thirdparty.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = React.createClass
displayName: 'bind-thirdparty'
propTypes:
store: React.PropTypes.instanceOf(Immutable.Map).isRequired
getInitialState: ->
showForceBind: false
bindCode: null
showname: null
error: null
componentDid... | module.exports = React.createClass({
displayName: 'bind-thirdparty',
propTypes: {
store: React.PropTypes.instanceOf(Immutable.Map).isRequired
},
getInitialState: function() {
return {
showForceBind: false,
bindCode: null,
showname: null,
error: null
};
},
componentDidMoun... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/client/app/bind-thirdparty.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/bind-thirdparty.coffee | 13 | 62 |
jianliaoim/talk-os:talk-account/client/app/bind-thirdparty.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = React.createClass({
displayName: 'bind-thirdparty',
propTypes: {
store: React.PropTypes.instanceOf(Immutable.Map).isRequired
},
getInitialState: function() {
return {
showForceBind: false,
bindCode: null,
showname:... | module.exports = React.createClass
displayName: 'bind-thirdparty'
propTypes:
store: React.PropTypes.instanceOf(Immutable.Map).isRequired
getInitialState: ->
showForceBind: false
bindCode: null
showname: null
error: null
componentDidMount: ->
if @getAction() is 'bind'
@bindUnion(... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/client/app/bind-thirdparty.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/bind-thirdparty.coffee | 13 | 62 |
jianliaoim/talk-os:talk-account/client/app/bind-thirdparty.coffee:1:completion | completion | module.exports = React.createClass
displayName: 'bind-thirdparty'
propTypes:
store: React.PropTypes.instanceOf(Immutable.Map).isRequired
getInitialState: ->
showForceBind: false
bindCode: null
showname: null
error: null
componentDidMount: ->
if @getAction() is 'bind'
@bindUnion(... | @props.store.getIn(['router', 'query'])
getRefer: ->
@props.store.getIn(['router', 'data', 'refer'])
isLoading: ->
@props.store.getIn(['client', 'isLoading'])
signIn: ->
ajax.unionSiginIn
refer: @getRefer()
data: @getQuery().toJS()
success: (resp) =>
controllers.signInRedi... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/client/app/bind-thirdparty.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/bind-thirdparty.coffee | 13 | 62 |
jianliaoim/talk-os:talk-account/client/app/bind-thirdparty.coffee:2:raw_corpus | raw_corpus | error = JSON.parse err.response
if error.code is 230
@setState
showForceBind: true, bindCode: error.data.bindCode
showname: error.data.showname
else
@setState error: error.message
renderForceBind: ->
ForcebindThirdparty
bindCode: @state.bindCode, ... | CoffeeScript | jianliaoim/talk-os | talk-account/client/app/bind-thirdparty.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/bind-thirdparty.coffee | 63 | 85 | ||
jianliaoim/talk-os:talk-account/client/app/bind-thirdparty.coffee:2:completion | completion | error = JSON.parse err.response
if error.code is 230
@setState
showForceBind: true, bindCode: error.data.bindCode
showname: error.data.showname
else
@setState error: error.message
renderForceBind: ->
ForcebindThirdparty
bindCode: @state.bindCode, ... | showname: @state.showname
render: ->
div className: 'bind-thirdparty control-panel',
if @state.showForceBind
@renderForceBind()
else
div className: 'as-line-centered',
if @state.error?
span className: 'hint-error', @state.error
else
span cla... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/client/app/bind-thirdparty.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/bind-thirdparty.coffee | 63 | 85 |
meltingice/psd.js:lib/psd/nodes/root.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
Node = require '../node.coffee'
Group = require './group.coffee'
Layer = require './layer.coffee'
module.exports = class Root extends Node
@layerForPsd: (psd) ->
layer = {}
layer[prop] = null for prop in Node.PROPERTIES
layer.top = 0
layer.left = 0
layer.right = psd.hea... | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/nodes/root.coffee | 1 | 50 | ||
meltingice/psd.js:lib/psd/nodes/root.coffee:1:completion | completion | _ = require 'lodash'
Node = require '../node.coffee'
Group = require './group.coffee'
Layer = require './layer.coffee'
module.exports = class Root extends Node
@layerForPsd: (psd) ->
layer = {}
layer[prop] = null for prop in Node.PROPERTIES
layer.top = 0
layer.left = 0
layer.right = psd.hea... | ]
depth: -> 0
opacity: -> 255
fillOpacity: -> 255
export: ->
children: @_children.map((c) -> c.export())
document:
width: @width
height: @height
resources:
layerComps: @psd.resources.resource('layerComps')?.export() or []
resolutionInfo: @psd.resources.resource('resol... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/nodes/root.coffee | 1 | 50 |
meltingice/psd.js:lib/psd/nodes/root.coffee:2:raw_corpus | raw_corpus | currentGroup = new Group(layer, _.last(parseStack))
else if layer.isFolderEnd()
parent = parseStack.pop()
parent.children().push currentGroup
currentGroup = parent
else
currentGroup.children().push new Layer(layer, currentGroup)
@updateDimensions() | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/nodes/root.coffee | 51 | 59 | ||
meltingice/psd.js:lib/psd/nodes/root.coffee:2:completion | completion | currentGroup = new Group(layer, _.last(parseStack))
else if layer.isFolderEnd()
parent = parseStack.pop()
parent.children().push currentGroup | currentGroup = parent
else
currentGroup.children().push new Layer(layer, currentGroup)
@updateDimensions() | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/nodes/root.coffee | 51 | 59 |
meltingice/psd.js:lib/psd/nodes/root.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
Node = require '../node.coffee'
Group = require './group.coffee'
Layer = require './layer.coffee'
module.exports = class Root extends Node
@layerForPsd: (psd) ->
layer = {}
layer[prop] = null for prop in Node.PROPERTIES
layer.top = 0
layer.left = 0
layer.right = psd.hea... | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | 0530d3767a6bf58bc5d53e097aa9b4eae471b800 | 2,846 | https://github.com/meltingice/psd.js/blob/0530d3767a6bf58bc5d53e097aa9b4eae471b800/lib/psd/nodes/root.coffee | 1 | 50 | ||
meltingice/psd.js:lib/psd/nodes/root.coffee:1:completion | completion | _ = require 'lodash'
Node = require '../node.coffee'
Group = require './group.coffee'
Layer = require './layer.coffee'
module.exports = class Root extends Node
@layerForPsd: (psd) ->
layer = {}
layer[prop] = null for prop in Node.PROPERTIES
layer.top = 0
layer.left = 0
layer.right = psd.hea... | ]
depth: -> 0
opacity: -> 255
fillOpacity: -> 255
export: ->
children: @_children.map((c) -> c.export())
document:
width: @width
height: @height
resources:
layerComps: @psd.resources.resource('layerComps')?.export() or []
resolutionInfo: @psd.resources.resource('resol... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | 0530d3767a6bf58bc5d53e097aa9b4eae471b800 | 2,846 | https://github.com/meltingice/psd.js/blob/0530d3767a6bf58bc5d53e097aa9b4eae471b800/lib/psd/nodes/root.coffee | 1 | 50 |
meltingice/psd.js:lib/psd/nodes/root.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
Node = require '../node.coffee'
Group = require './group.coffee'
Layer = require './layer.coffee'
module.exports = class Root extends Node
@layerForPsd: (psd) ->
layer = {}
layer[prop] = null for prop in Node.PROPERTIES
layer.top = 0
layer.left = 0
layer.right = psd.hea... | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | 000d034ade89d70ed53f5313e0e534b57d7d3a55 | 2,846 | https://github.com/meltingice/psd.js/blob/000d034ade89d70ed53f5313e0e534b57d7d3a55/lib/psd/nodes/root.coffee | 1 | 50 | ||
meltingice/psd.js:lib/psd/nodes/root.coffee:1:completion | completion | _ = require 'lodash'
Node = require '../node.coffee'
Group = require './group.coffee'
Layer = require './layer.coffee'
module.exports = class Root extends Node
@layerForPsd: (psd) ->
layer = {}
layer[prop] = null for prop in Node.PROPERTIES
layer.top = 0
layer.left = 0
layer.right = psd.hea... | ]
depth: -> 0
opacity: -> 255
fillOpacity: -> 255
export: ->
children: @_children.map((c) -> c.export())
document:
width: @width
height: @height
resources:
layerComps: @psd.resources.resource('layerComps')?.export() or []
guides: []
slices: []
buildHeirarc... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | 000d034ade89d70ed53f5313e0e534b57d7d3a55 | 2,846 | https://github.com/meltingice/psd.js/blob/000d034ade89d70ed53f5313e0e534b57d7d3a55/lib/psd/nodes/root.coffee | 1 | 50 |
meltingice/psd.js:lib/psd/nodes/root.coffee:2:raw_corpus | raw_corpus | else if layer.isFolderEnd()
parent = parseStack.pop()
parent.children().push currentGroup
currentGroup = parent
else
currentGroup.children().push new Layer(layer, currentGroup)
@updateDimensions() | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | 000d034ade89d70ed53f5313e0e534b57d7d3a55 | 2,846 | https://github.com/meltingice/psd.js/blob/000d034ade89d70ed53f5313e0e534b57d7d3a55/lib/psd/nodes/root.coffee | 51 | 58 | ||
meltingice/psd.js:lib/psd/nodes/root.coffee:2:completion | completion | else if layer.isFolderEnd()
parent = parseStack.pop()
parent.children().push currentGroup
currentGroup = parent | else
currentGroup.children().push new Layer(layer, currentGroup)
@updateDimensions() | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | 000d034ade89d70ed53f5313e0e534b57d7d3a55 | 2,846 | https://github.com/meltingice/psd.js/blob/000d034ade89d70ed53f5313e0e534b57d7d3a55/lib/psd/nodes/root.coffee | 51 | 58 |
meltingice/psd.js:lib/psd/nodes/root.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
Node = require '../node.coffee'
Group = require './group.coffee'
Layer = require './layer.coffee'
module.exports = class Root extends Node
@layerForPsd: (psd) ->
layer = {}
layer[prop] = null for prop in Node.PROPERTIES
layer.top = 0
layer.left = 0
layer.right = psd.hea... | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | 7b0442b02937ada2ca2d46ac7a2fb3ad6ec67167 | 2,846 | https://github.com/meltingice/psd.js/blob/7b0442b02937ada2ca2d46ac7a2fb3ad6ec67167/lib/psd/nodes/root.coffee | 1 | 50 | ||
meltingice/psd.js:lib/psd/nodes/root.coffee:1:completion | completion | _ = require 'lodash'
Node = require '../node.coffee'
Group = require './group.coffee'
Layer = require './layer.coffee'
module.exports = class Root extends Node
@layerForPsd: (psd) ->
layer = {}
layer[prop] = null for prop in Node.PROPERTIES
layer.top = 0
layer.left = 0
layer.right = psd.hea... | ]
depth: -> 0
opacity: -> 255
fillOpacity: -> 255
export: ->
children: @_children.map((c) -> c.export())
document:
width: @width
height: @height
resources:
layerComps: @psd.resources.resource('layerComps').export()
guides: []
slices: []
buildHeirarchy: ->
... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | 7b0442b02937ada2ca2d46ac7a2fb3ad6ec67167 | 2,846 | https://github.com/meltingice/psd.js/blob/7b0442b02937ada2ca2d46ac7a2fb3ad6ec67167/lib/psd/nodes/root.coffee | 1 | 50 |
meltingice/psd.js:lib/psd/nodes/root.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
Node = require '../node.coffee'
Group = require './group.coffee'
Layer = require './layer.coffee'
module.exports = class Root extends Node
@layerForPsd: (psd) ->
layer = {}
layer[prop] = null for prop in Node.PROPERTIES
layer.top = 0
layer.left = 0
layer.right = psd.hea... | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | ad21712fd68b99cacb607911177f73b729d5504e | 2,846 | https://github.com/meltingice/psd.js/blob/ad21712fd68b99cacb607911177f73b729d5504e/lib/psd/nodes/root.coffee | 1 | 50 | ||
meltingice/psd.js:lib/psd/nodes/root.coffee:1:completion | completion | _ = require 'lodash'
Node = require '../node.coffee'
Group = require './group.coffee'
Layer = require './layer.coffee'
module.exports = class Root extends Node
@layerForPsd: (psd) ->
layer = {}
layer[prop] = null for prop in Node.PROPERTIES
layer.top = 0
layer.left = 0
layer.right = psd.hea... | ]
depth: -> 0
opacity: -> 255
fillOpacity: -> 255
export: ->
children: @_children.map((c) -> c.export())
document:
width: @width
height: @height
resources:
layerComps: []
guides: []
slices: []
buildHeirarchy: ->
currentGroup = @
parseStack = []
... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | ad21712fd68b99cacb607911177f73b729d5504e | 2,846 | https://github.com/meltingice/psd.js/blob/ad21712fd68b99cacb607911177f73b729d5504e/lib/psd/nodes/root.coffee | 1 | 50 |
meltingice/psd.js:lib/psd/nodes/root.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
Node = require '../node.coffee'
Group = require './group.coffee'
Layer = require './layer.coffee'
module.exports = class Root extends Node
@layerForPsd: (psd) ->
layer = {}
layer[prop] = null for prop in Node.PROPERTIES
layer.top = 0
layer.left = 0
layer.right = psd.hea... | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | b2a661b5e744c0f78172c8efeec6017b98477512 | 2,846 | https://github.com/meltingice/psd.js/blob/b2a661b5e744c0f78172c8efeec6017b98477512/lib/psd/nodes/root.coffee | 1 | 50 | ||
meltingice/psd.js:lib/psd/nodes/root.coffee:1:completion | completion | _ = require 'lodash'
Node = require '../node.coffee'
Group = require './group.coffee'
Layer = require './layer.coffee'
module.exports = class Root extends Node
@layerForPsd: (psd) ->
layer = {}
layer[prop] = null for prop in Node.PROPERTIES
layer.top = 0
layer.left = 0
layer.right = psd.hea... | ]
depth: -> 0
opacity: -> 255
fillOpacity: -> 255
export: ->
children: @children.map((c) -> c.export())
document:
width: @width
height: @height
resources:
layerComps: []
guides: []
slices: []
buildHeirarchy: ->
currentGroup = @
parseStack = []
... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | b2a661b5e744c0f78172c8efeec6017b98477512 | 2,846 | https://github.com/meltingice/psd.js/blob/b2a661b5e744c0f78172c8efeec6017b98477512/lib/psd/nodes/root.coffee | 1 | 50 |
meltingice/psd.js:lib/psd/nodes/root.coffee:2:raw_corpus | raw_corpus | else if layer.isFolderEnd()
parent = parseStack.pop()
parent.children.push currentGroup
currentGroup = parent
else
currentGroup.children.push new Layer(layer, currentGroup)
@updateDimensions() | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | b2a661b5e744c0f78172c8efeec6017b98477512 | 2,846 | https://github.com/meltingice/psd.js/blob/b2a661b5e744c0f78172c8efeec6017b98477512/lib/psd/nodes/root.coffee | 51 | 58 | ||
meltingice/psd.js:lib/psd/nodes/root.coffee:2:completion | completion | else if layer.isFolderEnd()
parent = parseStack.pop()
parent.children.push currentGroup
currentGroup = parent | else
currentGroup.children.push new Layer(layer, currentGroup)
@updateDimensions() | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | b2a661b5e744c0f78172c8efeec6017b98477512 | 2,846 | https://github.com/meltingice/psd.js/blob/b2a661b5e744c0f78172c8efeec6017b98477512/lib/psd/nodes/root.coffee | 51 | 58 |
meltingice/psd.js:lib/psd/nodes/root.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
Node = require '../node.coffee'
Group = require './group.coffee'
Layer = require './layer.coffee'
module.exports = class Root extends Node
@layerForPsd: (psd) ->
layer = {}
layer[prop] = null for prop in Node.PROPERTIES
layer.top = 0
layer.left = 0
layer.right = psd.hea... | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | aabb6de133eab9ae0a16981d0706fb83ce69fdba | 2,846 | https://github.com/meltingice/psd.js/blob/aabb6de133eab9ae0a16981d0706fb83ce69fdba/lib/psd/nodes/root.coffee | 1 | 50 | ||
meltingice/psd.js:lib/psd/nodes/root.coffee:1:completion | completion | _ = require 'lodash'
Node = require '../node.coffee'
Group = require './group.coffee'
Layer = require './layer.coffee'
module.exports = class Root extends Node
@layerForPsd: (psd) ->
layer = {}
layer[prop] = null for prop in Node.PROPERTIES
layer.top = 0
layer.left = 0
layer.right = psd.hea... | @documentHeight()
]
depth: -> 0
opacity: -> 255
fillOpacity: -> 255
export: ->
children: @children.map((c) -> c.export())
buildHeirarchy: ->
currentGroup = @
parseStack = []
for layer in @psd.layers
if layer.isFolder()
parseStack.push currentGroup
currentGroup = ne... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/nodes/root.coffee | MIT | aabb6de133eab9ae0a16981d0706fb83ce69fdba | 2,846 | https://github.com/meltingice/psd.js/blob/aabb6de133eab9ae0a16981d0706fb83ce69fdba/lib/psd/nodes/root.coffee | 1 | 50 |
Nedomas/databound:spec/spec_helper.coffee:1:raw_corpus | raw_corpus | global._ = require('lodash')
global.mockDOM = (fn) ->
jsdom = require('jsdom')
jsdom.env(
html: "<html><body></body></html>"
scripts: ['../bower_components/jquery/dist/jquery.min.js']
done: (err, window) ->
if err
console.log(err)
global.window = window
global.chai = require ... | CoffeeScript | Nedomas/databound | spec/spec_helper.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/spec/spec_helper.coffee | 1 | 46 | ||
Nedomas/databound:spec/spec_helper.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
global._ = require('lodash')
global.mockDOM = (fn) ->
jsdom = require('jsdom')
jsdom.env(
html: "<html><body></body></html>"
scripts: ['../bower_components/jquery/dist/jquery.min.js']
done: (err, window) ->
if err
console.log(err)
... | var stringify;
global._ = require('lodash');
global.mockDOM = function(fn) {
var jsdom;
jsdom = require('jsdom');
return jsdom.env({
html: "<html><body></body></html>",
scripts: ['../bower_components/jquery/dist/jquery.min.js'],
done: function(err, window) {
var Databound;
if (err) {
... | CoffeeScript | JavaScript | Nedomas/databound | spec/spec_helper.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/spec/spec_helper.coffee | 1 | 46 |
Nedomas/databound:spec/spec_helper.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var stringify;
global._ = require('lodash');
global.mockDOM = function(fn) {
var jsdom;
jsdom = require('jsdom');
return jsdom.env({
html: "<html><body></body></html>",
scripts: ['../bower_components/jquery/dist/jquery.min.js'],
done: function(e... | global._ = require('lodash')
global.mockDOM = (fn) ->
jsdom = require('jsdom')
jsdom.env(
html: "<html><body></body></html>"
scripts: ['../bower_components/jquery/dist/jquery.min.js']
done: (err, window) ->
if err
console.log(err)
global.window = window
global.chai = require ... | JavaScript | CoffeeScript | Nedomas/databound | spec/spec_helper.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/spec/spec_helper.coffee | 1 | 46 |
Nedomas/databound:spec/spec_helper.coffee:1:completion | completion | global._ = require('lodash')
global.mockDOM = (fn) ->
jsdom = require('jsdom')
jsdom.env(
html: "<html><body></body></html>"
scripts: ['../bower_components/jquery/dist/jquery.min.js']
done: (err, window) ->
if err
console.log(err)
global.window = window
global.chai = require ... | global.stubResponse = (resp, fn, type = 'resolve') ->
mockDOM ->
sinon = require('sinon')
_.each ['records', 'scoped_records'], stringify(resp)
jQuery = require 'jquery'
stub = sinon.stub jQuery, 'post', ->
deferred = jQuery.Deferred()
deferred[type](resp)
deferred.promise()
t... | CoffeeScript | CoffeeScript | Nedomas/databound | spec/spec_helper.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/spec/spec_helper.coffee | 1 | 46 |
Nedomas/databound:spec/spec_helper.coffee:1:raw_corpus | raw_corpus | global._ = require('lodash')
global.mockDOM = (fn) ->
jsdom = require('jsdom')
jsdom.env(
html: "<html><body></body></html>"
scripts: ['../bower_components/jquery/dist/jquery.min.js']
done: (err, window) ->
if err
console.log(err)
global.window = window
global._ = require('lo... | CoffeeScript | Nedomas/databound | spec/spec_helper.coffee | MIT | e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e | 452 | https://github.com/Nedomas/databound/blob/e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e/spec/spec_helper.coffee | 1 | 44 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.