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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:1:completion | completion | picker = angular.module('daterangepicker', [])
picker.value('dateRangePickerConfig',
separator: ' - '
format: 'YYYY-MM-DD'
)
picker.directive('dateRangePicker', ['$compile', '$timeout', '$parse', 'dateRangePickerConfig', ($compile, $timeout, $parse, defaults) ->
require: 'ngModel'
restrict: 'A'
sc... | f = (date) ->
if not moment.isMoment(date)
return moment(date).format(opts.format)
return date.format(opts.format)
[f(viewVal.startDate), f(viewVal.endDate)].join(opts.separator)
_validateMin = (min, start) ->
min = moment(min)
... | CoffeeScript | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | 569217d5d05c4bfdde1f08c2170ccbfe86d5cab1 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/569217d5d05c4bfdde1f08c2170ccbfe86d5cab1/coffee/angular-daterangepicker.coffee | 1 | 40 |
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:4:raw_corpus | raw_corpus | if attrs.max
$scope.$watch('dateMax', (date) ->
if date
if not modelCtrl.$isEmpty(modelCtrl.$viewValue)
_validateMax(date, modelCtrl.$viewValue.endDate)
opts['maxDate'] = moment(date)
else
op... | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | 569217d5d05c4bfdde1f08c2170ccbfe86d5cab1 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/569217d5d05c4bfdde1f08c2170ccbfe86d5cab1/coffee/angular-daterangepicker.coffee | 125 | 143 | ||
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:4:completion | completion | if attrs.max
$scope.$watch('dateMax', (date) ->
if date
if not modelCtrl.$isEmpty(modelCtrl.$viewValue)
_validateMax(date, modelCtrl.$viewValue.endDate)
opts['maxDate'] = moment(date)
else
op... | _init()
)
if attrs.options
$scope.$watch('opts', (newOpts) ->
opts = angular.extend(opts, newOpts)
_init()
)
]) | CoffeeScript | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | 569217d5d05c4bfdde1f08c2170ccbfe86d5cab1 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/569217d5d05c4bfdde1f08c2170ccbfe86d5cab1/coffee/angular-daterangepicker.coffee | 125 | 143 |
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:2:raw_corpus | raw_corpus | modelCtrl.$formatters.unshift((val) ->
if val and val.startDate and val.endDate
# Update datepicker dates according to val before rendering.
picker = _getPicker()
picker.setStartDate(val.startDate)
picker.setEndDate(val.endDate)
... | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | b3db169b108d10fb75a38e6af62ebd778d5c423b | 517 | https://github.com/fragaria/angular-daterangepicker/blob/b3db169b108d10fb75a38e6af62ebd778d5c423b/coffee/angular-daterangepicker.coffee | 42 | 80 | ||
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:2:completion | completion | modelCtrl.$formatters.unshift((val) ->
if val and val.startDate and val.endDate
# Update datepicker dates according to val before rendering.
picker = _getPicker()
picker.setStartDate(val.startDate)
picker.setEndDate(val.endDate)
... | modelCtrl.$setValidity('min', true)
if $scope.dateMax and val.endDate
_validateMax($scope.dateMax, val.endDate)
else
modelCtrl.$setValidity('max', true)
return val
)
modelCtrl.$isEmpty = (val) ->
# modelCtrl is empty if v... | CoffeeScript | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | b3db169b108d10fb75a38e6af62ebd778d5c423b | 517 | https://github.com/fragaria/angular-daterangepicker/blob/b3db169b108d10fb75a38e6af62ebd778d5c423b/coffee/angular-daterangepicker.coffee | 42 | 80 |
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:3:raw_corpus | raw_corpus | return el.val(_formatted(modelCtrl.$viewValue))
_init = ->
el.daterangepicker(opts)
_getPicker = ->
el.data('daterangepicker')
_init()
el.on('apply.daterangepicker', (ev, picker) ->
$timeout(-> $scope.$apply(->
modelCtrl.$setViewVa... | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | 57dc48d0f8cc71ed26cf7cc5b63af9bfebc62838 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/57dc48d0f8cc71ed26cf7cc5b63af9bfebc62838/coffee/angular-daterangepicker.coffee | 82 | 125 | ||
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:3:completion | completion | return el.val(_formatted(modelCtrl.$viewValue))
_init = ->
el.daterangepicker(opts)
_getPicker = ->
el.data('daterangepicker')
_init()
el.on('apply.daterangepicker', (ev, picker) ->
$timeout(-> $scope.$apply(->
modelCtrl.$setViewVa... | el.change(() ->
if $.trim(el.val()) == ''
$timeout(->
$scope.$apply(->
modelCtrl.$setViewValue(
startDate: null
endDate: null
)
))
)
... | CoffeeScript | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | 57dc48d0f8cc71ed26cf7cc5b63af9bfebc62838 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/57dc48d0f8cc71ed26cf7cc5b63af9bfebc62838/coffee/angular-daterangepicker.coffee | 82 | 125 |
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:3:raw_corpus | raw_corpus | return el.val(_formatted(modelCtrl.$viewValue))
_init = ->
el.daterangepicker(opts, (start, end, label) ->
$timeout(->
$scope.$apply(->
modelCtrl.$setViewValue(
startDate: start.toDate()
endDa... | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | ca4fbb6140443bfcf9cd9b09a0a6c3f933032829 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/ca4fbb6140443bfcf9cd9b09a0a6c3f933032829/coffee/angular-daterangepicker.coffee | 82 | 122 | ||
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:3:completion | completion | return el.val(_formatted(modelCtrl.$viewValue))
_init = ->
el.daterangepicker(opts, (start, end, label) ->
$timeout(->
$scope.$apply(->
modelCtrl.$setViewValue(
startDate: start.toDate()
endDa... | el.on('apply.daterangepicker', (ev, picker) ->
$timeout(-> $scope.$apply(->
modelCtrl.$setViewValue(
startDate: picker.startDate.toDate()
endDate: picker.endDate.toDate()
)
modelCtrl.$render()
))
)
... | CoffeeScript | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | ca4fbb6140443bfcf9cd9b09a0a6c3f933032829 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/ca4fbb6140443bfcf9cd9b09a0a6c3f933032829/coffee/angular-daterangepicker.coffee | 82 | 122 |
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:4:raw_corpus | raw_corpus | if attrs.min
$scope.$watch('dateMin', (date) ->
if date
if not modelCtrl.$isEmpty(modelCtrl.$viewValue)
_validateMin(date, modelCtrl.$viewValue.startDate)
opts['minDate'] = moment(date)
else
... | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | ca4fbb6140443bfcf9cd9b09a0a6c3f933032829 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/ca4fbb6140443bfcf9cd9b09a0a6c3f933032829/coffee/angular-daterangepicker.coffee | 124 | 154 | ||
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:4:completion | completion | if attrs.min
$scope.$watch('dateMin', (date) ->
if date
if not modelCtrl.$isEmpty(modelCtrl.$viewValue)
_validateMin(date, modelCtrl.$viewValue.startDate)
opts['minDate'] = moment(date)
else
... | if not modelCtrl.$isEmpty(modelCtrl.$viewValue)
_validateMax(date, modelCtrl.$viewValue.endDate)
opts['maxDate'] = moment(date)
else
opts['maxDate'] = false
_init()
)
if attrs.options
$scop... | CoffeeScript | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | ca4fbb6140443bfcf9cd9b09a0a6c3f933032829 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/ca4fbb6140443bfcf9cd9b09a0a6c3f933032829/coffee/angular-daterangepicker.coffee | 124 | 154 |
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:3:raw_corpus | raw_corpus | return el.val(_formatted(modelCtrl.$viewValue))
_init = ->
el.daterangepicker(opts, (start, end, label) ->
$timeout(->
$scope.$apply(->
modelCtrl.$setViewValue(
startDate: start.toDate()
endDa... | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | e446f7ba800c0eecf5c0e959ae741e4efcd95222 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/e446f7ba800c0eecf5c0e959ae741e4efcd95222/coffee/angular-daterangepicker.coffee | 82 | 124 | ||
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:3:completion | completion | return el.val(_formatted(modelCtrl.$viewValue))
_init = ->
el.daterangepicker(opts, (start, end, label) ->
$timeout(->
$scope.$apply(->
modelCtrl.$setViewValue(
startDate: start.toDate()
endDa... | el.change(() ->
if $.trim(el.val()) == ''
$timeout(->
$scope.$apply(->
modelCtrl.$setViewValue(
startDate: null
endDate: null
)
))
)
... | CoffeeScript | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | e446f7ba800c0eecf5c0e959ae741e4efcd95222 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/e446f7ba800c0eecf5c0e959ae741e4efcd95222/coffee/angular-daterangepicker.coffee | 82 | 124 |
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:1:raw_corpus | raw_corpus | picker = angular.module('daterangepicker', [])
picker.directive('dateRangePicker', ['$compile', '$timeout', ($compile, $timeout) ->
require: 'ngModel'
restrict: 'A'
scope:
dateMin: '=min'
dateMax: '=max'
opts: '=options'
link: ($scope, element, attrs, modelCtrl) ->
el = ... | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | b50ffdc5741cfe0fe0ac260b512ed697de1bbb48 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/b50ffdc5741cfe0fe0ac260b512ed697de1bbb48/coffee/angular-daterangepicker.coffee | 1 | 46 | ||
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:1:completion | completion | picker = angular.module('daterangepicker', [])
picker.directive('dateRangePicker', ['$compile', '$timeout', ($compile, $timeout) ->
require: 'ngModel'
restrict: 'A'
scope:
dateMin: '=min'
dateMax: '=max'
opts: '=options'
link: ($scope, element, attrs, modelCtrl) ->
el = ... | _validateMin = (min, start) ->
min = moment(min)
start = moment(start)
valid = min.isBefore(start) or min.isSame(start, 'day')
modelCtrl.$setValidity('min', valid)
return valid
_validateMax = (max, end) ->
max = moment(max)
end... | CoffeeScript | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | b50ffdc5741cfe0fe0ac260b512ed697de1bbb48 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/b50ffdc5741cfe0fe0ac260b512ed697de1bbb48/coffee/angular-daterangepicker.coffee | 1 | 46 |
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:2:raw_corpus | raw_corpus | modelCtrl.$parsers.unshift((val) ->
# Check if input is valid.
if not angular.isObject(val) or not (val.hasOwnProperty('startDate') and val.hasOwnProperty('endDate'))
return modelCtrl.$modelValue
# If min-max set, validate as well.
if $scope.dateMin and v... | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | b50ffdc5741cfe0fe0ac260b512ed697de1bbb48 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/b50ffdc5741cfe0fe0ac260b512ed697de1bbb48/coffee/angular-daterangepicker.coffee | 48 | 91 | ||
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:2:completion | completion | modelCtrl.$parsers.unshift((val) ->
# Check if input is valid.
if not angular.isObject(val) or not (val.hasOwnProperty('startDate') and val.hasOwnProperty('endDate'))
return modelCtrl.$modelValue
# If min-max set, validate as well.
if $scope.dateMin and v... | modelCtrl.$render = ->
if not modelCtrl.$viewValue
return el.val('')
if modelCtrl.$viewValue.startDate == null
return el.val('')
return el.val(_formatted(modelCtrl.$viewValue))
_init = ->
el.daterangepicker(opts, (start, end, la... | CoffeeScript | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | b50ffdc5741cfe0fe0ac260b512ed697de1bbb48 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/b50ffdc5741cfe0fe0ac260b512ed697de1bbb48/coffee/angular-daterangepicker.coffee | 48 | 91 |
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:3:raw_corpus | raw_corpus | _getPicker = ->
el.data('daterangepicker')
_init()
# If input is cleared manually, set dates to null.
el.change(() ->
if $.trim(el.val()) == ''
$timeout(->
$scope.$apply(->
modelCtrl.$setViewValue(
... | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | b50ffdc5741cfe0fe0ac260b512ed697de1bbb48 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/b50ffdc5741cfe0fe0ac260b512ed697de1bbb48/coffee/angular-daterangepicker.coffee | 93 | 133 | ||
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:3:completion | completion | _getPicker = ->
el.data('daterangepicker')
_init()
# If input is cleared manually, set dates to null.
el.change(() ->
if $.trim(el.val()) == ''
$timeout(->
$scope.$apply(->
modelCtrl.$setViewValue(
... | if not modelCtrl.$isEmpty(modelCtrl.$viewValue)
_validateMin(date, modelCtrl.$viewValue.startDate)
opts['minDate'] = moment(date)
else
opts['minDate'] = false
_init()
)
if attrs.max
$scope.$... | CoffeeScript | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | b50ffdc5741cfe0fe0ac260b512ed697de1bbb48 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/b50ffdc5741cfe0fe0ac260b512ed697de1bbb48/coffee/angular-daterangepicker.coffee | 93 | 133 |
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:4:raw_corpus | raw_corpus | if attrs.options
$scope.$watch('opts', (newOpts) ->
opts = angular.extend(opts, newOpts)
_init()
)
]) | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | b50ffdc5741cfe0fe0ac260b512ed697de1bbb48 | 517 | https://github.com/fragaria/angular-daterangepicker/blob/b50ffdc5741cfe0fe0ac260b512ed697de1bbb48/coffee/angular-daterangepicker.coffee | 135 | 140 | ||
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:2:raw_corpus | raw_corpus | modelCtrl.$parsers.unshift((val) ->
# Check if input is valid.
if not angular.isObject(val) or not (val.hasOwnProperty('startDate') and val.hasOwnProperty('endDate'))
return modelCtrl.$modelValue
# If min-max set, validate as well.
if $scope.dateMin and v... | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | 452176c580b0fa77e6d7c9b254951c1480c9e1da | 517 | https://github.com/fragaria/angular-daterangepicker/blob/452176c580b0fa77e6d7c9b254951c1480c9e1da/coffee/angular-daterangepicker.coffee | 48 | 86 | ||
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:2:completion | completion | modelCtrl.$parsers.unshift((val) ->
# Check if input is valid.
if not angular.isObject(val) or not (val.hasOwnProperty('startDate') and val.hasOwnProperty('endDate'))
return modelCtrl.$modelValue
# If min-max set, validate as well.
if $scope.dateMin and v... | modelCtrl.$isEmpty = (val) ->
# modelCtrl is empty if val is invalid or any of the ranges are not set.
not val or (val.startDate == null or val.endDate == null)
modelCtrl.$render = ->
if not modelCtrl.$viewValue
return el.val('')
if modelCtrl.$vi... | CoffeeScript | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | 452176c580b0fa77e6d7c9b254951c1480c9e1da | 517 | https://github.com/fragaria/angular-daterangepicker/blob/452176c580b0fa77e6d7c9b254951c1480c9e1da/coffee/angular-daterangepicker.coffee | 48 | 86 |
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:3:raw_corpus | raw_corpus | el.on('apply.daterangepicker', (ev, picker) ->
$timeout(->
$scope.$apply(->
modelCtrl.$setViewValue(
startDate: picker.startDate.toDate()
endDate: picker.endDate.toDate()
)
modelCtrl.$... | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | 452176c580b0fa77e6d7c9b254951c1480c9e1da | 517 | https://github.com/fragaria/angular-daterangepicker/blob/452176c580b0fa77e6d7c9b254951c1480c9e1da/coffee/angular-daterangepicker.coffee | 88 | 127 | ||
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:3:completion | completion | el.on('apply.daterangepicker', (ev, picker) ->
$timeout(->
$scope.$apply(->
modelCtrl.$setViewValue(
startDate: picker.startDate.toDate()
endDate: picker.endDate.toDate()
)
modelCtrl.$... | ))
)
if attrs.min
$scope.$watch('dateMin', (date) ->
if date
if not modelCtrl.$isEmpty(modelCtrl.$viewValue)
_validateMin(date, modelCtrl.$viewValue.startDate)
opts['minDate'] = moment(date)
els... | CoffeeScript | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | 452176c580b0fa77e6d7c9b254951c1480c9e1da | 517 | https://github.com/fragaria/angular-daterangepicker/blob/452176c580b0fa77e6d7c9b254951c1480c9e1da/coffee/angular-daterangepicker.coffee | 88 | 127 |
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:4:raw_corpus | raw_corpus | opts['maxDate'] = moment(date)
else
opts['maxDate'] = false
_init()
)
if attrs.options
$scope.$watch('opts', (newOpts) ->
opts = angular.extend(opts, newOpts)
_init()
)
]) | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | 452176c580b0fa77e6d7c9b254951c1480c9e1da | 517 | https://github.com/fragaria/angular-daterangepicker/blob/452176c580b0fa77e6d7c9b254951c1480c9e1da/coffee/angular-daterangepicker.coffee | 129 | 141 | ||
fragaria/angular-daterangepicker:coffee/angular-daterangepicker.coffee:4:completion | completion | opts['maxDate'] = moment(date)
else
opts['maxDate'] = false
_init()
) | if attrs.options
$scope.$watch('opts', (newOpts) ->
opts = angular.extend(opts, newOpts)
_init()
)
]) | CoffeeScript | CoffeeScript | fragaria/angular-daterangepicker | coffee/angular-daterangepicker.coffee | MIT | 452176c580b0fa77e6d7c9b254951c1480c9e1da | 517 | https://github.com/fragaria/angular-daterangepicker/blob/452176c580b0fa77e6d7c9b254951c1480c9e1da/coffee/angular-daterangepicker.coffee | 129 | 141 |
linemanjs/lineman:tasks/common.coffee:1:raw_corpus | raw_corpus | ###
Task: common
Description: runs linemans common lifecycle tasks
Dependencies: grunt
Contributor: @davemo
###
gatherTasks = require("./../lib/gather-tasks")
module.exports = (grunt) ->
grunt.registerTask "common", "runs linemans common lifecycle tasks", ->
grunt.task.run(gatherTasks("common")) | CoffeeScript | linemanjs/lineman | tasks/common.coffee | MIT | 61d681532d9621e578d319c279006bbb728ece4b | 1,168 | https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/tasks/common.coffee | 1 | 12 | ||
linemanjs/lineman:tasks/common.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
Task: common
Description: runs linemans common lifecycle tasks
Dependencies: grunt
Contributor: @davemo
###
gatherTasks = require("./../lib/gather-tasks")
module.exports = (grunt) ->
grunt.registerTask "common", "runs linemans common lifecycle tasks", ->
... | /*
Task: common
Description: runs linemans common lifecycle tasks
Dependencies: grunt
Contributor: @davemo
*/
var gatherTasks;
gatherTasks = require("./../lib/gather-tasks");
module.exports = function(grunt) {
return grunt.registerTask("common", "runs linemans common lifecycle tasks", function() {
return grunt.... | CoffeeScript | JavaScript | linemanjs/lineman | tasks/common.coffee | MIT | 61d681532d9621e578d319c279006bbb728ece4b | 1,168 | https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/tasks/common.coffee | 1 | 12 |
linemanjs/lineman:tasks/common.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
Task: common
Description: runs linemans common lifecycle tasks
Dependencies: grunt
Contributor: @davemo
*/
var gatherTasks;
gatherTasks = require("./../lib/gather-tasks");
module.exports = function(grunt) {
return grunt.registerTask("common", "runs linemans ... | ###
Task: common
Description: runs linemans common lifecycle tasks
Dependencies: grunt
Contributor: @davemo
###
gatherTasks = require("./../lib/gather-tasks")
module.exports = (grunt) ->
grunt.registerTask "common", "runs linemans common lifecycle tasks", ->
grunt.task.run(gatherTasks("common")) | JavaScript | CoffeeScript | linemanjs/lineman | tasks/common.coffee | MIT | 61d681532d9621e578d319c279006bbb728ece4b | 1,168 | https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/tasks/common.coffee | 1 | 12 |
linemanjs/lineman:tasks/common.coffee:1:completion | completion | ###
Task: common
Description: runs linemans common lifecycle tasks
Dependencies: grunt
Contributor: @davemo
### | gatherTasks = require("./../lib/gather-tasks")
module.exports = (grunt) ->
grunt.registerTask "common", "runs linemans common lifecycle tasks", ->
grunt.task.run(gatherTasks("common")) | CoffeeScript | CoffeeScript | linemanjs/lineman | tasks/common.coffee | MIT | 61d681532d9621e578d319c279006bbb728ece4b | 1,168 | https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/tasks/common.coffee | 1 | 12 |
jianliaoim/talk-os:talk-api2x/server/searchers/story.coffee:1:raw_corpus | raw_corpus | _buildQuery = (req) ->
{
_teamId
keyword
category
sort
_sessionUserId
limit
page
_creatorId
_creatorIds
fileCategory
} = req.get()
limit or= 10
page = parseInt page
page or= 1
keyword = keyword?.trim()
keyword = keyword[..20] if keyword?.length > 20
return Prom... | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/searchers/story.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/searchers/story.coffee | 11 | 60 | ||
jianliaoim/talk-os:talk-api2x/server/searchers/story.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_buildQuery = (req) ->
{
_teamId
keyword
category
sort
_sessionUserId
limit
page
_creatorId
_creatorIds
fileCategory
} = req.get()
limit or= 10
page = parseInt page
page or= 1
keyword = keyword?.trim()
keywo... | var _buildQuery;
_buildQuery = function(req) {
var $filter, _creatorId, _creatorIds, _sessionUserId, _teamId, category, fileCategories, fileCategory, keyword, limit, page, sort;
({_teamId, keyword, category, sort, _sessionUserId, limit, page, _creatorId, _creatorIds, fileCategory} = req.get());
limit || (limit =... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/server/searchers/story.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/searchers/story.coffee | 11 | 60 |
jianliaoim/talk-os:talk-api2x/server/searchers/story.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _buildQuery;
_buildQuery = function(req) {
var $filter, _creatorId, _creatorIds, _sessionUserId, _teamId, category, fileCategories, fileCategory, keyword, limit, page, sort;
({_teamId, keyword, category, sort, _sessionUserId, limit, page, _creatorId, _crea... | _buildQuery = (req) ->
{
_teamId
keyword
category
sort
_sessionUserId
limit
page
_creatorId
_creatorIds
fileCategory
} = req.get()
limit or= 10
page = parseInt page
page or= 1
keyword = keyword?.trim()
keyword = keyword[..20] if keyword?.length > 20
return Prom... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/searchers/story.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/searchers/story.coffee | 11 | 60 |
jianliaoim/talk-os:talk-api2x/server/searchers/story.coffee:1:completion | completion | _buildQuery = (req) ->
{
_teamId
keyword
category
sort
_sessionUserId
limit
page
_creatorId
_creatorIds
fileCategory
} = req.get()
limit or= 10
page = parseInt page
page or= 1
keyword = keyword?.trim()
keyword = keyword[..20] if keyword?.length > 20
return Prom... | must: [
term: _teamId: _teamId
,
term: _memberIds: _sessionUserId
]
if _creatorId
$filter = $filter.then (filter) ->
filter.bool.must.push term: _creatorId: _creatorId
filter
else if _creatorIds
$filter = $filter.then (filter) ->
filter.bool.must.push terms: _... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/searchers/story.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/searchers/story.coffee | 11 | 60 |
jianliaoim/talk-os:talk-api2x/server/searchers/story.coffee:2:raw_corpus | raw_corpus | when 'other' then fileCategories = ['application', 'font']
if fileCategories
$filter = $filter.then (filter) ->
filter.bool.must.push term: category: 'file'
filter.bool.must.push terms: 'data.fileCategory': fileCategories
filter
$query = $filter.then (filter) ->
query =
size: limit... | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/searchers/story.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/searchers/story.coffee | 61 | 92 | ||
jianliaoim/talk-os:talk-api2x/server/searchers/story.coffee:2:completion | completion | when 'other' then fileCategories = ['application', 'font']
if fileCategories
$filter = $filter.then (filter) ->
filter.bool.must.push term: category: 'file'
filter.bool.must.push terms: 'data.fileCategory': fileCategories
filter
$query = $filter.then (filter) ->
query =
size: limit... | 'data.text': {}
'data.fileName': {}
query:
filtered:
filter: filter
query:
query_string:
fields: [
'data.url'
'data.title'
'data.text'
'data.fileName'
]
query... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/searchers/story.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/searchers/story.coffee | 61 | 92 |
jianliaoim/talk-os:talk-api2x/server/searchers/story.coffee:3:raw_corpus | raw_corpus | exports.search = (req, res, callback) ->
$query = _buildQuery req
$result = $query.then (query) ->
SearchStoryModel.searchAsync query.query, query
.then (result) ->
throw new Err('SEARCH_FAILED') unless result?.hits?.hits
result
$total = $result.then (result) -> result.hits.total
$stories = $r... | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/searchers/story.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/searchers/story.coffee | 94 | 129 | ||
jianliaoim/talk-os:talk-api2x/server/searchers/story.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.search = (req, res, callback) ->
$query = _buildQuery req
$result = $query.then (query) ->
SearchStoryModel.searchAsync query.query, query
.then (result) ->
throw new Err('SEARCH_FAILED') unless result?.hits?.hits
result
$total = $r... | exports.search = function(req, res, callback) {
var $query, $result, $stories, $total;
$query = _buildQuery(req);
$result = $query.then(function(query) {
return SearchStoryModel.searchAsync(query.query, query);
}).then(function(result) {
var ref;
if (!(result != null ? (ref = result.hits) != null ? ... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/server/searchers/story.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/searchers/story.coffee | 94 | 129 |
jianliaoim/talk-os:talk-api2x/server/searchers/story.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.search = function(req, res, callback) {
var $query, $result, $stories, $total;
$query = _buildQuery(req);
$result = $query.then(function(query) {
return SearchStoryModel.searchAsync(query.query, query);
}).then(function(result) {
var ref;
... | exports.search = (req, res, callback) ->
$query = _buildQuery req
$result = $query.then (query) ->
SearchStoryModel.searchAsync query.query, query
.then (result) ->
throw new Err('SEARCH_FAILED') unless result?.hits?.hits
result
$total = $result.then (result) -> result.hits.total
$stories = $r... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/searchers/story.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/searchers/story.coffee | 94 | 129 |
jianliaoim/talk-os:talk-api2x/server/searchers/story.coffee:3:completion | completion | exports.search = (req, res, callback) ->
$query = _buildQuery req
$result = $query.then (query) ->
SearchStoryModel.searchAsync query.query, query
.then (result) ->
throw new Err('SEARCH_FAILED') unless result?.hits?.hits
result
$total = $result.then (result) -> result.hits.total
$stories = $r... | .map (story) ->
storyMap["#{story._id}"] = story.toJSON()
.then ->
stories = result.hits.hits.map (hit) ->
return false unless storyMap[hit._id]
story = storyMap[hit._id]
story.highlight = hit.highlight
story._score = hit._score
story
.filter (story) -> st... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/searchers/story.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/searchers/story.coffee | 94 | 129 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:raw_corpus | raw_corpus | async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
VariableExpression = require '../variable-expression'
ExpressionsRegistry = require '../expressions-registry'
class PathScanner
constructor: (@filePath, scope, registry) ->
@scanner = new VariableScanner({registry, scope})
... | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4 | 518 | https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/tasks/scan-paths-handler.coffee | 1 | 50 | ||
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
VariableExpression = require '../variable-expression'
ExpressionsRegistry = require '../expressions-registry'
class PathScanner
constructor: (@filePath, scope, registry) ... | var ExpressionsRegistry, PathScanner, VariableExpression, VariableScanner, async, fs;
async = require('async');
fs = require('fs');
VariableScanner = require('../variable-scanner');
VariableExpression = require('../variable-expression');
ExpressionsRegistry = require('../expressions-registry');
PathScanner = clas... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4 | 518 | https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/tasks/scan-paths-handler.coffee | 1 | 50 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ExpressionsRegistry, PathScanner, VariableExpression, VariableScanner, async, fs;
async = require('async');
fs = require('fs');
VariableScanner = require('../variable-scanner');
VariableExpression = require('../variable-expression');
ExpressionsRegistry = ... | async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
VariableExpression = require '../variable-expression'
ExpressionsRegistry = require '../expressions-registry'
class PathScanner
constructor: (@filePath, scope, registry) ->
@scanner = new VariableScanner({registry, scope})
... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4 | 518 | https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/tasks/scan-paths-handler.coffee | 1 | 50 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:completion | completion | async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
VariableExpression = require '../variable-expression'
ExpressionsRegistry = require '../expressions-registry'
class PathScanner
constructor: (@filePath, scope, registry) ->
@scanner = new VariableScanner({registry, scope})
... | while result = @scanner.search(currentChunk, lastIndex)
result.range[0] += index
result.range[1] += index
for v in result
v.path = @filePath
v.range[0] += index
v.range[1] += index
v.definitionRange = result.range
v.line += line
lastLi... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4 | 518 | https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/tasks/scan-paths-handler.coffee | 1 | 50 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:2:raw_corpus | raw_corpus | registry = ExpressionsRegistry.deserialize(registry, VariableExpression)
async.each(
paths,
([p, s], next) ->
new PathScanner(p, s, registry).load(next)
@async()
) | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4 | 518 | https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/tasks/scan-paths-handler.coffee | 51 | 57 | ||
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:2:completion | completion | registry = ExpressionsRegistry.deserialize(registry, VariableExpression)
async.each(
paths, | ([p, s], next) ->
new PathScanner(p, s, registry).load(next)
@async()
) | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4 | 518 | https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/tasks/scan-paths-handler.coffee | 51 | 57 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:raw_corpus | raw_corpus | async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
VariableExpression = require '../variable-expression'
ExpressionsRegistry = require '../expressions-registry'
scopeFromFileName = require '../scope-from-file-name'
class PathScanner
constructor: (@filePath, registry) ->
sco... | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 36f562cc2c51fe076f776f2e84d707d978a9e906 | 518 | https://github.com/abe33/atom-pigments/blob/36f562cc2c51fe076f776f2e84d707d978a9e906/lib/tasks/scan-paths-handler.coffee | 1 | 50 | ||
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
VariableExpression = require '../variable-expression'
ExpressionsRegistry = require '../expressions-registry'
scopeFromFileName = require '../scope-from-file-name'
class Pa... | var ExpressionsRegistry, PathScanner, VariableExpression, VariableScanner, async, fs, scopeFromFileName;
async = require('async');
fs = require('fs');
VariableScanner = require('../variable-scanner');
VariableExpression = require('../variable-expression');
ExpressionsRegistry = require('../expressions-registry');
... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 36f562cc2c51fe076f776f2e84d707d978a9e906 | 518 | https://github.com/abe33/atom-pigments/blob/36f562cc2c51fe076f776f2e84d707d978a9e906/lib/tasks/scan-paths-handler.coffee | 1 | 50 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ExpressionsRegistry, PathScanner, VariableExpression, VariableScanner, async, fs, scopeFromFileName;
async = require('async');
fs = require('fs');
VariableScanner = require('../variable-scanner');
VariableExpression = require('../variable-expression');
Exp... | async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
VariableExpression = require '../variable-expression'
ExpressionsRegistry = require '../expressions-registry'
scopeFromFileName = require '../scope-from-file-name'
class PathScanner
constructor: (@filePath, registry) ->
sco... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 36f562cc2c51fe076f776f2e84d707d978a9e906 | 518 | https://github.com/abe33/atom-pigments/blob/36f562cc2c51fe076f776f2e84d707d978a9e906/lib/tasks/scan-paths-handler.coffee | 1 | 50 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:completion | completion | async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
VariableExpression = require '../variable-expression'
ExpressionsRegistry = require '../expressions-registry'
scopeFromFileName = require '../scope-from-file-name'
class PathScanner
constructor: (@filePath, registry) ->
sco... | index = lastIndex
while result = @scanner.search(currentChunk, lastIndex)
result.range[0] += index
result.range[1] += index
for v in result
v.path = @filePath
v.range[0] += index
v.range[1] += index
v.definitionRange = result.range
v.line... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 36f562cc2c51fe076f776f2e84d707d978a9e906 | 518 | https://github.com/abe33/atom-pigments/blob/36f562cc2c51fe076f776f2e84d707d978a9e906/lib/tasks/scan-paths-handler.coffee | 1 | 50 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:2:raw_corpus | raw_corpus | module.exports = ([paths, registry]) ->
registry = ExpressionsRegistry.deserialize(registry, VariableExpression)
async.each(
paths,
(p, next) ->
new PathScanner(p, registry).load(next)
@async()
) | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 36f562cc2c51fe076f776f2e84d707d978a9e906 | 518 | https://github.com/abe33/atom-pigments/blob/36f562cc2c51fe076f776f2e84d707d978a9e906/lib/tasks/scan-paths-handler.coffee | 51 | 59 | ||
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = ([paths, registry]) ->
registry = ExpressionsRegistry.deserialize(registry, VariableExpression)
async.each(
paths,
(p, next) ->
new PathScanner(p, registry).load(next)
@async()
)
``` | module.exports = function([paths, registry]) {
registry = ExpressionsRegistry.deserialize(registry, VariableExpression);
return async.each(paths, function(p, next) {
return new PathScanner(p, registry).load(next);
}, this.async());
}; | CoffeeScript | JavaScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 36f562cc2c51fe076f776f2e84d707d978a9e906 | 518 | https://github.com/abe33/atom-pigments/blob/36f562cc2c51fe076f776f2e84d707d978a9e906/lib/tasks/scan-paths-handler.coffee | 51 | 59 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = function([paths, registry]) {
registry = ExpressionsRegistry.deserialize(registry, VariableExpression);
return async.each(paths, function(p, next) {
return new PathScanner(p, registry).load(next);
}, this.async());
};
``` | module.exports = ([paths, registry]) ->
registry = ExpressionsRegistry.deserialize(registry, VariableExpression)
async.each(
paths,
(p, next) ->
new PathScanner(p, registry).load(next)
@async()
) | JavaScript | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 36f562cc2c51fe076f776f2e84d707d978a9e906 | 518 | https://github.com/abe33/atom-pigments/blob/36f562cc2c51fe076f776f2e84d707d978a9e906/lib/tasks/scan-paths-handler.coffee | 51 | 59 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:2:completion | completion | module.exports = ([paths, registry]) ->
registry = ExpressionsRegistry.deserialize(registry, VariableExpression)
async.each(
paths, | (p, next) ->
new PathScanner(p, registry).load(next)
@async()
) | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 36f562cc2c51fe076f776f2e84d707d978a9e906 | 518 | https://github.com/abe33/atom-pigments/blob/36f562cc2c51fe076f776f2e84d707d978a9e906/lib/tasks/scan-paths-handler.coffee | 51 | 59 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:raw_corpus | raw_corpus | async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
VariableExpression = require '../variable-expression'
ExpressionsRegistry = require '../expressions-registry'
class PathScanner
constructor: (@path, registry) ->
@scanner = new VariableScanner({registry})
load: (done) ->... | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 5de42ccee66d85444fe32c70d7dd5dae7725fa6d | 518 | https://github.com/abe33/atom-pigments/blob/5de42ccee66d85444fe32c70d7dd5dae7725fa6d/lib/tasks/scan-paths-handler.coffee | 1 | 50 | ||
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
VariableExpression = require '../variable-expression'
ExpressionsRegistry = require '../expressions-registry'
class PathScanner
constructor: (@path, registry) ->
@sca... | var ExpressionsRegistry, PathScanner, VariableExpression, VariableScanner, async, fs;
async = require('async');
fs = require('fs');
VariableScanner = require('../variable-scanner');
VariableExpression = require('../variable-expression');
ExpressionsRegistry = require('../expressions-registry');
PathScanner = clas... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 5de42ccee66d85444fe32c70d7dd5dae7725fa6d | 518 | https://github.com/abe33/atom-pigments/blob/5de42ccee66d85444fe32c70d7dd5dae7725fa6d/lib/tasks/scan-paths-handler.coffee | 1 | 50 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ExpressionsRegistry, PathScanner, VariableExpression, VariableScanner, async, fs;
async = require('async');
fs = require('fs');
VariableScanner = require('../variable-scanner');
VariableExpression = require('../variable-expression');
ExpressionsRegistry = ... | async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
VariableExpression = require '../variable-expression'
ExpressionsRegistry = require '../expressions-registry'
class PathScanner
constructor: (@path, registry) ->
@scanner = new VariableScanner({registry})
load: (done) ->... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 5de42ccee66d85444fe32c70d7dd5dae7725fa6d | 518 | https://github.com/abe33/atom-pigments/blob/5de42ccee66d85444fe32c70d7dd5dae7725fa6d/lib/tasks/scan-paths-handler.coffee | 1 | 50 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:completion | completion | async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
VariableExpression = require '../variable-expression'
ExpressionsRegistry = require '../expressions-registry'
class PathScanner
constructor: (@path, registry) ->
@scanner = new VariableScanner({registry})
load: (done) ->... | while result = @scanner.search(currentChunk, lastIndex)
result.range[0] += index
result.range[1] += index
for v in result
v.path = @path
v.range[0] += index
v.range[1] += index
v.definitionRange = result.range
v.line += line
lastLine =... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 5de42ccee66d85444fe32c70d7dd5dae7725fa6d | 518 | https://github.com/abe33/atom-pigments/blob/5de42ccee66d85444fe32c70d7dd5dae7725fa6d/lib/tasks/scan-paths-handler.coffee | 1 | 50 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:2:raw_corpus | raw_corpus | registry = ExpressionsRegistry.deserialize(registry, VariableExpression)
async.each(
paths,
(path, next) ->
new PathScanner(path, registry).load(next)
@async()
) | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 5de42ccee66d85444fe32c70d7dd5dae7725fa6d | 518 | https://github.com/abe33/atom-pigments/blob/5de42ccee66d85444fe32c70d7dd5dae7725fa6d/lib/tasks/scan-paths-handler.coffee | 51 | 57 | ||
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:2:completion | completion | registry = ExpressionsRegistry.deserialize(registry, VariableExpression)
async.each(
paths, | (path, next) ->
new PathScanner(path, registry).load(next)
@async()
) | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 5de42ccee66d85444fe32c70d7dd5dae7725fa6d | 518 | https://github.com/abe33/atom-pigments/blob/5de42ccee66d85444fe32c70d7dd5dae7725fa6d/lib/tasks/scan-paths-handler.coffee | 51 | 57 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:raw_corpus | raw_corpus | async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
VariableExpression = require '../variable-expression'
ExpressionsRegistry = require '../expressions-registry'
class PathScanner
constructor: (@path, registry) ->
@scanner = new VariableScanner(registry)
load: (done) ->
... | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | ff6d0f5a491eed88feb63cac42c973352448b000 | 518 | https://github.com/abe33/atom-pigments/blob/ff6d0f5a491eed88feb63cac42c973352448b000/lib/tasks/scan-paths-handler.coffee | 1 | 50 | ||
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
VariableExpression = require '../variable-expression'
ExpressionsRegistry = require '../expressions-registry'
class PathScanner
constructor: (@path, registry) ->
@sca... | var ExpressionsRegistry, PathScanner, VariableExpression, VariableScanner, async, fs;
async = require('async');
fs = require('fs');
VariableScanner = require('../variable-scanner');
VariableExpression = require('../variable-expression');
ExpressionsRegistry = require('../expressions-registry');
PathScanner = clas... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | ff6d0f5a491eed88feb63cac42c973352448b000 | 518 | https://github.com/abe33/atom-pigments/blob/ff6d0f5a491eed88feb63cac42c973352448b000/lib/tasks/scan-paths-handler.coffee | 1 | 50 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ExpressionsRegistry, PathScanner, VariableExpression, VariableScanner, async, fs;
async = require('async');
fs = require('fs');
VariableScanner = require('../variable-scanner');
VariableExpression = require('../variable-expression');
ExpressionsRegistry = ... | async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
VariableExpression = require '../variable-expression'
ExpressionsRegistry = require '../expressions-registry'
class PathScanner
constructor: (@path, registry) ->
@scanner = new VariableScanner(registry)
load: (done) ->
... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | ff6d0f5a491eed88feb63cac42c973352448b000 | 518 | https://github.com/abe33/atom-pigments/blob/ff6d0f5a491eed88feb63cac42c973352448b000/lib/tasks/scan-paths-handler.coffee | 1 | 50 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:completion | completion | async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
VariableExpression = require '../variable-expression'
ExpressionsRegistry = require '../expressions-registry'
class PathScanner
constructor: (@path, registry) ->
@scanner = new VariableScanner(registry)
load: (done) ->
... | while result = @scanner.search(currentChunk, lastIndex)
result.range[0] += index
result.range[1] += index
for v in result
v.path = @path
v.range[0] += index
v.range[1] += index
v.definitionRange = result.range
v.line += line
lastLine =... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | ff6d0f5a491eed88feb63cac42c973352448b000 | 518 | https://github.com/abe33/atom-pigments/blob/ff6d0f5a491eed88feb63cac42c973352448b000/lib/tasks/scan-paths-handler.coffee | 1 | 50 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:raw_corpus | raw_corpus | async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
class PathScanner
constructor: (@path) ->
@scanner = new VariableScanner
load: (done) ->
currentChunk = ''
currentLine = 0
currentOffset = 0
lastIndex = 0
line = 0
results = []
readStream = f... | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/tasks/scan-paths-handler.coffee | 1 | 50 | ||
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:1:completion | completion | async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
class PathScanner
constructor: (@path) ->
@scanner = new VariableScanner
load: (done) ->
currentChunk = ''
currentLine = 0
currentOffset = 0
lastIndex = 0
line = 0
results = []
readStream = f... | result.range[1] += index
for v in result
v.path = @path
v.range[0] += index
v.range[1] += index
v.definitionRange = result.range
v.line += line
lastLine = v.line
results = results.concat(result)
{lastIndex} = result
if result?
... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/tasks/scan-paths-handler.coffee | 1 | 50 |
abe33/atom-pigments:lib/tasks/scan-paths-handler.coffee:2:raw_corpus | raw_corpus | (path, next) ->
new PathScanner(path).load(next)
@async()
) | CoffeeScript | abe33/atom-pigments | lib/tasks/scan-paths-handler.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/tasks/scan-paths-handler.coffee | 51 | 54 | ||
cdglabs/apparatus:src/Graphic/Graphic.coffee:2:raw_corpus | raw_corpus | class Graphic.Element
###
Each Graphic.Element must have these properties:
particularElement: The ParticularElement that generated the graphic. This is
used for "back tracing" what part of the model generated this graphic, e.g.
to implement selection when you click a shape on the canvas.
matrix: a Util.M... | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 10 | 59 | ||
cdglabs/apparatus:src/Graphic/Graphic.coffee:2:completion | completion | class Graphic.Element
###
Each Graphic.Element must have these properties:
particularElement: The ParticularElement that generated the graphic. This is
used for "back tracing" what part of the model generated this graphic, e.g.
to implement selection when you click a shape on the canvas.
matrix: a Util.M... | viewMatrix:
highlight(graphic): A function that takes in a graphic and returns either
a color or null.
###
throw "Not implemented"
hitDetect: (opts) ->
###
Given (x,y), returns null if there is nothing under (x,y), that is (x,y)
is a background pixel. Otherwise returns a list of Partic... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 10 | 59 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:3:raw_corpus | raw_corpus | ###
throw "Not implemented"
# ===========================================================================
# Helpers
# ===========================================================================
componentOfType: (type) ->
_.find @components, (component) -> component instanceof type
componentsOfType... | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 60 | 77 | ||
cdglabs/apparatus:src/Graphic/Graphic.coffee:3:completion | completion | ###
throw "Not implemented"
# ===========================================================================
# Helpers
# ===========================================================================
componentOfType: (type) -> | _.find @components, (component) -> component instanceof type
componentsOfType: (type) ->
_.filter @components, (component) -> component instanceof type
# =============================================================================
# Elements
# ==================================================================... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 60 | 77 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:4:raw_corpus | raw_corpus | class Graphic.Group extends Graphic.Element
render: (opts) ->
for childGraphic in @childGraphics
childGraphic.render(opts)
hitDetect: (opts) ->
# TODO: test
latestHit = null
for childGraphic in @childGraphics
latestHit = childGraphic.hitDetect(opts) ? latestHit
if latestHit
re... | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 79 | 92 | ||
cdglabs/apparatus:src/Graphic/Graphic.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Graphic.Group extends Graphic.Element
render: (opts) ->
for childGraphic in @childGraphics
childGraphic.render(opts)
hitDetect: (opts) ->
# TODO: test
latestHit = null
for childGraphic in @childGraphics
latestHit = childGrap... | Graphic.Group = class Group extends Graphic.Element {
render(opts) {
var childGraphic, i, len, ref, results;
ref = this.childGraphics;
results = [];
for (i = 0, len = ref.length; i < len; i++) {
childGraphic = ref[i];
results.push(childGraphic.render(opts));
}
return results;
}
... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 79 | 92 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Graphic.Group = class Group extends Graphic.Element {
render(opts) {
var childGraphic, i, len, ref, results;
ref = this.childGraphics;
results = [];
for (i = 0, len = ref.length; i < len; i++) {
childGraphic = ref[i];
results.push(chil... | class Graphic.Group extends Graphic.Element
render: (opts) ->
for childGraphic in @childGraphics
childGraphic.render(opts)
hitDetect: (opts) ->
# TODO: test
latestHit = null
for childGraphic in @childGraphics
latestHit = childGraphic.hitDetect(opts) ? latestHit
if latestHit
re... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 79 | 92 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:4:completion | completion | class Graphic.Group extends Graphic.Element
render: (opts) ->
for childGraphic in @childGraphics
childGraphic.render(opts)
hitDetect: (opts) ->
# TODO: test | latestHit = null
for childGraphic in @childGraphics
latestHit = childGraphic.hitDetect(opts) ? latestHit
if latestHit
return latestHit.concat(@particularElement)
else
return null | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 79 | 92 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:6:raw_corpus | raw_corpus | class Graphic.Path extends Graphic.Element
render: (opts) ->
@buildPath(opts)
@performPaintOps(opts)
@highlightIfNecessary(opts)
hitDetect: (opts) ->
opts.ctx = getDummyCanvasCtx()
{ctx, x, y} = opts
@buildPath(opts)
if ctx.isPointInPath(x, y)
return [@particularElement]
else
... | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 101 | 150 | ||
cdglabs/apparatus:src/Graphic/Graphic.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Graphic.Path extends Graphic.Element
render: (opts) ->
@buildPath(opts)
@performPaintOps(opts)
@highlightIfNecessary(opts)
hitDetect: (opts) ->
opts.ctx = getDummyCanvasCtx()
{ctx, x, y} = opts
@buildPath(opts)
if ctx.isPoin... | Graphic.Path = class Path extends Graphic.Element {
render(opts) {
this.buildPath(opts);
this.performPaintOps(opts);
return this.highlightIfNecessary(opts);
}
hitDetect(opts) {
var ctx, x, y;
opts.ctx = getDummyCanvasCtx();
({ctx, x, y} = opts);
this.buildPath(opts);
if (ctx.isPoi... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 101 | 150 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Graphic.Path = class Path extends Graphic.Element {
render(opts) {
this.buildPath(opts);
this.performPaintOps(opts);
return this.highlightIfNecessary(opts);
}
hitDetect(opts) {
var ctx, x, y;
opts.ctx = getDummyCanvasCtx();
({ctx, x, ... | class Graphic.Path extends Graphic.Element
render: (opts) ->
@buildPath(opts)
@performPaintOps(opts)
@highlightIfNecessary(opts)
hitDetect: (opts) ->
opts.ctx = getDummyCanvasCtx()
{ctx, x, y} = opts
@buildPath(opts)
if ctx.isPointInPath(x, y)
return [@particularElement]
else
... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 101 | 150 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:6:completion | completion | class Graphic.Path extends Graphic.Element
render: (opts) ->
@buildPath(opts)
@performPaintOps(opts)
@highlightIfNecessary(opts)
hitDetect: (opts) ->
opts.ctx = getDummyCanvasCtx()
{ctx, x, y} = opts
@buildPath(opts)
if ctx.isPointInPath(x, y)
return [@particularElement]
else
... | ctx.lineWidth = highlightSpec.lineWidth
ctx.stroke()
ctx.restore()
buildPath: ({ctx, viewMatrix}) ->
ctx.beginPath()
anchors = @collectAnchors()
for anchor in anchors
[x, y] = viewMatrix.compose(anchor.matrix).origin()
ctx.lineTo(x, y)
if @isClosed()
ctx.closePath()
... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 101 | 150 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:7:raw_corpus | raw_corpus | return anchors
isClosed: ->
pathComponent = @componentOfType(Graphic.PathComponent)
return pathComponent.closed | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 151 | 155 | ||
cdglabs/apparatus:src/Graphic/Graphic.coffee:7:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return anchors
isClosed: ->
pathComponent = @componentOfType(Graphic.PathComponent)
return pathComponent.closed
``` | return anchors({
isClosed: function() {
var pathComponent;
pathComponent = this.componentOfType(Graphic.PathComponent);
return pathComponent.closed;
}
}); | CoffeeScript | JavaScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 151 | 155 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:7:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
return anchors({
isClosed: function() {
var pathComponent;
pathComponent = this.componentOfType(Graphic.PathComponent);
return pathComponent.closed;
}
});
``` | return anchors
isClosed: ->
pathComponent = @componentOfType(Graphic.PathComponent)
return pathComponent.closed | JavaScript | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 151 | 155 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:8:raw_corpus | raw_corpus | class Graphic.Circle extends Graphic.Path
buildPath: ({ctx, viewMatrix}) ->
ctx.beginPath()
ctx.save()
matrix = viewMatrix.compose(@matrix)
matrix.canvasTransform(ctx)
ctx.arc(0, 0, 1, 0, 2 * Math.PI, false)
ctx.restore()
# ====================================================================... | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 158 | 170 | ||
cdglabs/apparatus:src/Graphic/Graphic.coffee:8:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Graphic.Circle extends Graphic.Path
buildPath: ({ctx, viewMatrix}) ->
ctx.beginPath()
ctx.save()
matrix = viewMatrix.compose(@matrix)
matrix.canvasTransform(ctx)
ctx.arc(0, 0, 1, 0, 2 * Math.PI, false)
ctx.restore()
# ===========... | Graphic.Circle = class Circle extends Graphic.Path {
buildPath({ctx, viewMatrix}) {
var matrix;
ctx.beginPath();
ctx.save();
matrix = viewMatrix.compose(this.matrix);
matrix.canvasTransform(ctx);
ctx.arc(0, 0, 1, 0, 2 * Math.PI, false);
return ctx.restore();
}
};
// ===================... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 158 | 170 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:8:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Graphic.Circle = class Circle extends Graphic.Path {
buildPath({ctx, viewMatrix}) {
var matrix;
ctx.beginPath();
ctx.save();
matrix = viewMatrix.compose(this.matrix);
matrix.canvasTransform(ctx);
ctx.arc(0, 0, 1, 0, 2 * Math.PI, false);
... | class Graphic.Circle extends Graphic.Path
buildPath: ({ctx, viewMatrix}) ->
ctx.beginPath()
ctx.save()
matrix = viewMatrix.compose(@matrix)
matrix.canvasTransform(ctx)
ctx.arc(0, 0, 1, 0, 2 * Math.PI, false)
ctx.restore()
# ====================================================================... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 158 | 170 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:8:completion | completion | class Graphic.Circle extends Graphic.Path
buildPath: ({ctx, viewMatrix}) ->
ctx.beginPath()
ctx.save()
matrix = viewMatrix.compose(@matrix)
matrix.canvasTransform(ctx) | ctx.arc(0, 0, 1, 0, 2 * Math.PI, false)
ctx.restore()
# =============================================================================
# Components
# ============================================================================= | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 158 | 170 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:11:raw_corpus | raw_corpus | class Graphic.Fill extends Graphic.PaintOp
paint: (ctx) ->
ctx.save()
ctx.fillStyle = @color
ctx.fill()
ctx.restore() | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 176 | 181 | ||
cdglabs/apparatus:src/Graphic/Graphic.coffee:11:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Graphic.Fill extends Graphic.PaintOp
paint: (ctx) ->
ctx.save()
ctx.fillStyle = @color
ctx.fill()
ctx.restore()
``` | Graphic.Fill = class Fill extends Graphic.PaintOp {
paint(ctx) {
ctx.save();
ctx.fillStyle = this.color;
ctx.fill();
return ctx.restore();
}
}; | CoffeeScript | JavaScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 176 | 181 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:11:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Graphic.Fill = class Fill extends Graphic.PaintOp {
paint(ctx) {
ctx.save();
ctx.fillStyle = this.color;
ctx.fill();
return ctx.restore();
}
};
``` | class Graphic.Fill extends Graphic.PaintOp
paint: (ctx) ->
ctx.save()
ctx.fillStyle = @color
ctx.fill()
ctx.restore() | JavaScript | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 176 | 181 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:11:completion | completion | class Graphic.Fill extends Graphic.PaintOp
paint: (ctx) ->
ctx.save() | ctx.fillStyle = @color
ctx.fill()
ctx.restore() | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 176 | 181 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:12:raw_corpus | raw_corpus | class Graphic.Stroke extends Graphic.PaintOp
paint: (ctx) ->
return if @lineWidth <= 0
ctx.save()
ctx.strokeStyle = @color
ctx.lineWidth = @lineWidth
ctx.stroke()
ctx.restore() | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 183 | 190 | ||
cdglabs/apparatus:src/Graphic/Graphic.coffee:12:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Graphic.Stroke extends Graphic.PaintOp
paint: (ctx) ->
return if @lineWidth <= 0
ctx.save()
ctx.strokeStyle = @color
ctx.lineWidth = @lineWidth
ctx.stroke()
ctx.restore()
``` | Graphic.Stroke = class Stroke extends Graphic.PaintOp {
paint(ctx) {
if (this.lineWidth <= 0) {
return;
}
ctx.save();
ctx.strokeStyle = this.color;
ctx.lineWidth = this.lineWidth;
ctx.stroke();
return ctx.restore();
}
}; | CoffeeScript | JavaScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 183 | 190 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:12:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Graphic.Stroke = class Stroke extends Graphic.PaintOp {
paint(ctx) {
if (this.lineWidth <= 0) {
return;
}
ctx.save();
ctx.strokeStyle = this.color;
ctx.lineWidth = this.lineWidth;
ctx.stroke();
return ctx.restore();
}
};
``` | class Graphic.Stroke extends Graphic.PaintOp
paint: (ctx) ->
return if @lineWidth <= 0
ctx.save()
ctx.strokeStyle = @color
ctx.lineWidth = @lineWidth
ctx.stroke()
ctx.restore() | JavaScript | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 183 | 190 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:12:completion | completion | class Graphic.Stroke extends Graphic.PaintOp
paint: (ctx) ->
return if @lineWidth <= 0
ctx.save() | ctx.strokeStyle = @color
ctx.lineWidth = @lineWidth
ctx.stroke()
ctx.restore() | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 183 | 190 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:14:raw_corpus | raw_corpus | class Graphic.TextComponent extends Graphic.Component
# =============================================================================
# Dummy Canvas
# =============================================================================
# This dummy canvas is used to perform isPointInPath for hit detection.
dummyCanvasCtx =... | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 194 | 202 | ||
cdglabs/apparatus:src/Graphic/Graphic.coffee:14:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Graphic.TextComponent extends Graphic.Component
# =============================================================================
# Dummy Canvas
# =============================================================================
# This dummy canvas is used to p... | var dummyCanvasCtx;
Graphic.TextComponent = class TextComponent extends Graphic.Component {};
// =============================================================================
// Dummy Canvas
// =============================================================================
// This dummy canvas is used to perform isPoi... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 194 | 202 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:14:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var dummyCanvasCtx;
Graphic.TextComponent = class TextComponent extends Graphic.Component {};
// =============================================================================
// Dummy Canvas
// =====================================================================... | class Graphic.TextComponent extends Graphic.Component
# =============================================================================
# Dummy Canvas
# =============================================================================
# This dummy canvas is used to perform isPointInPath for hit detection.
dummyCanvasCtx =... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 194 | 202 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:14:completion | completion | class Graphic.TextComponent extends Graphic.Component
# =============================================================================
# Dummy Canvas | # =============================================================================
# This dummy canvas is used to perform isPointInPath for hit detection.
dummyCanvasCtx = null | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 194 | 202 |
cdglabs/apparatus:src/Graphic/Graphic.coffee:15:raw_corpus | raw_corpus | getDummyCanvasCtx = ->
return dummyCanvasCtx if dummyCanvasCtx
dummyCanvas = document.createElement("canvas")
return dummyCanvasCtx = dummyCanvas.getContext("2d") | CoffeeScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 203 | 206 | ||
cdglabs/apparatus:src/Graphic/Graphic.coffee:15:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
getDummyCanvasCtx = ->
return dummyCanvasCtx if dummyCanvasCtx
dummyCanvas = document.createElement("canvas")
return dummyCanvasCtx = dummyCanvas.getContext("2d")
``` | var getDummyCanvasCtx;
getDummyCanvasCtx = function() {
var dummyCanvas, dummyCanvasCtx;
if (dummyCanvasCtx) {
return dummyCanvasCtx;
}
dummyCanvas = document.createElement("canvas");
return dummyCanvasCtx = dummyCanvas.getContext("2d");
}; | CoffeeScript | JavaScript | cdglabs/apparatus | src/Graphic/Graphic.coffee | MIT | 369fbd92d91fa1bfca8d44494fd3e5aac1da82fe | 1,052 | https://github.com/cdglabs/apparatus/blob/369fbd92d91fa1bfca8d44494fd3e5aac1da82fe/src/Graphic/Graphic.coffee | 203 | 206 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.