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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
yakyak/yakyak:src/ui/models/menuhandler.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{ Menu } = require('electron')
menuaction = (mainWindow, it) ->
if it.action.params?
params = it.action.params.map (p) ->
if p is ':checked'
it.checked
if p is ':value'
it.value
else... | var Menu, menuaction, processMenu;
({Menu} = require('electron'));
menuaction = function(mainWindow, it) {
var params;
if (it.action.params != null) {
params = it.action.params.map(function(p) {
if (p === ':checked') {
it.checked;
}
if (p === ':value') {
return it.value;
... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/models/menuhandler.coffee | MIT | 8292038b149cf25da2c85c9e263a8a773848d3cc | 3,762 | https://github.com/yakyak/yakyak/blob/8292038b149cf25da2c85c9e263a8a773848d3cc/src/ui/models/menuhandler.coffee | 1 | 34 |
yakyak/yakyak:src/ui/models/menuhandler.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Menu, menuaction, processMenu;
({Menu} = require('electron'));
menuaction = function(mainWindow, it) {
var params;
if (it.action.params != null) {
params = it.action.params.map(function(p) {
if (p === ':checked') {
it.checked;
}
... | { Menu } = require('electron')
menuaction = (mainWindow, it) ->
if it.action.params?
params = it.action.params.map (p) ->
if p is ':checked'
it.checked
if p is ':value'
it.value
else
p
console.error('menuaction', i... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/models/menuhandler.coffee | MIT | 8292038b149cf25da2c85c9e263a8a773848d3cc | 3,762 | https://github.com/yakyak/yakyak/blob/8292038b149cf25da2c85c9e263a8a773848d3cc/src/ui/models/menuhandler.coffee | 1 | 34 |
yakyak/yakyak:src/ui/models/menuhandler.coffee:1:completion | completion | { Menu } = require('electron')
menuaction = (mainWindow, it) ->
if it.action.params?
params = it.action.params.map (p) ->
if p is ':checked'
it.checked
if p is ':value'
it.value
else
p
console.error('menuaction', i... | processMenu = (mainWindow, template) =>
(template ? []).forEach (e) ->
if e.submenu?
processMenu mainWindow, e.submenu
return
if not e.action?
return
e.click = (it) ->
menuaction mainWindow, it
module.exports = (mainWindow, template) ->
... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/models/menuhandler.coffee | MIT | 8292038b149cf25da2c85c9e263a8a773848d3cc | 3,762 | https://github.com/yakyak/yakyak/blob/8292038b149cf25da2c85c9e263a8a773848d3cc/src/ui/models/menuhandler.coffee | 1 | 34 |
yakyak/yakyak:src/ui/models/menuhandler.coffee:1:raw_corpus | raw_corpus | { Menu } = require('electron')
menuaction = (mainWindow, it) ->
if it.action.params?
it.action.params.forEach (p) ->
p = it.checked if p is ':checked'
p = it.value if p is ':value'
mainWindow.webContents.send 'menuaction', it.action.name, ...it.action.params
else
... | CoffeeScript | yakyak/yakyak | src/ui/models/menuhandler.coffee | MIT | f0a73b9c4ed321304a5a20deca5d72cacef50bea | 3,762 | https://github.com/yakyak/yakyak/blob/f0a73b9c4ed321304a5a20deca5d72cacef50bea/src/ui/models/menuhandler.coffee | 1 | 28 | ||
yakyak/yakyak:src/ui/models/menuhandler.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{ Menu } = require('electron')
menuaction = (mainWindow, it) ->
if it.action.params?
it.action.params.forEach (p) ->
p = it.checked if p is ':checked'
p = it.value if p is ':value'
mainWindow.webContents.send 'menuact... | var Menu, menuaction, processMenu;
({Menu} = require('electron'));
menuaction = function(mainWindow, it) {
if (it.action.params != null) {
it.action.params.forEach(function(p) {
if (p === ':checked') {
p = it.checked;
}
if (p === ':value') {
return p = it.value;
}
});... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/models/menuhandler.coffee | MIT | f0a73b9c4ed321304a5a20deca5d72cacef50bea | 3,762 | https://github.com/yakyak/yakyak/blob/f0a73b9c4ed321304a5a20deca5d72cacef50bea/src/ui/models/menuhandler.coffee | 1 | 28 |
yakyak/yakyak:src/ui/models/menuhandler.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Menu, menuaction, processMenu;
({Menu} = require('electron'));
menuaction = function(mainWindow, it) {
if (it.action.params != null) {
it.action.params.forEach(function(p) {
if (p === ':checked') {
p = it.checked;
}
if (p === '... | { Menu } = require('electron')
menuaction = (mainWindow, it) ->
if it.action.params?
it.action.params.forEach (p) ->
p = it.checked if p is ':checked'
p = it.value if p is ':value'
mainWindow.webContents.send 'menuaction', it.action.name, ...it.action.params
else
... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/models/menuhandler.coffee | MIT | f0a73b9c4ed321304a5a20deca5d72cacef50bea | 3,762 | https://github.com/yakyak/yakyak/blob/f0a73b9c4ed321304a5a20deca5d72cacef50bea/src/ui/models/menuhandler.coffee | 1 | 28 |
yakyak/yakyak:src/ui/models/menuhandler.coffee:1:completion | completion | { Menu } = require('electron')
menuaction = (mainWindow, it) ->
if it.action.params?
it.action.params.forEach (p) ->
p = it.checked if p is ':checked'
p = it.value if p is ':value'
mainWindow.webContents.send 'menuaction', it.action.name, ...it.action.params
else
... | if e.submenu?
processMenu mainWindow, e.submenu
return
if not e.action?
return
e.click = (it) ->
menuaction mainWindow, it
module.exports = (mainWindow, template) ->
processMenu mainWindow, template
Menu.buildFromTemplate template | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/models/menuhandler.coffee | MIT | f0a73b9c4ed321304a5a20deca5d72cacef50bea | 3,762 | https://github.com/yakyak/yakyak/blob/f0a73b9c4ed321304a5a20deca5d72cacef50bea/src/ui/models/menuhandler.coffee | 1 | 28 |
jianliaoim/talk-os:talk-api2x/mshells/cleanup-fans-team.coffee:1:raw_corpus | raw_corpus | # 清空发烧友不活跃用户
today = ISODate().getTime()
_teamId = ObjectId('544f9896480ab1825e6a1fc3')
members = db.members.find({team: _teamId})
memberCount = db.members.count({team: _teamId})
_roomIds = db.rooms.find({team: _teamId}).map (room) -> room._id
robotIds = db.users.find({isRobot: true}).map (robot) -> "#{robot._id}"
pri... | CoffeeScript | jianliaoim/talk-os | talk-api2x/mshells/cleanup-fans-team.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/mshells/cleanup-fans-team.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-api2x/mshells/cleanup-fans-team.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# 清空发烧友不活跃用户
today = ISODate().getTime()
_teamId = ObjectId('544f9896480ab1825e6a1fc3')
members = db.members.find({team: _teamId})
memberCount = db.members.count({team: _teamId})
_roomIds = db.rooms.find({team: _teamId}).map (room) -> room._id
robotIds = db.users... | // 清空发烧友不活跃用户
var _roomIds, _teamId, memberCount, members, oldUserNum, remove, removedNum, robotIds, skip, skippedNum, today,
indexOf = [].indexOf;
today = ISODate().getTime();
_teamId = ObjectId('544f9896480ab1825e6a1fc3');
members = db.members.find({
team: _teamId
});
memberCount = db.members.count({
team: ... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/mshells/cleanup-fans-team.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/mshells/cleanup-fans-team.coffee | 1 | 50 |
jianliaoim/talk-os:talk-api2x/mshells/cleanup-fans-team.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// 清空发烧友不活跃用户
var _roomIds, _teamId, memberCount, members, oldUserNum, remove, removedNum, robotIds, skip, skippedNum, today,
indexOf = [].indexOf;
today = ISODate().getTime();
_teamId = ObjectId('544f9896480ab1825e6a1fc3');
members = db.members.find({
team:... | # 清空发烧友不活跃用户
today = ISODate().getTime()
_teamId = ObjectId('544f9896480ab1825e6a1fc3')
members = db.members.find({team: _teamId})
memberCount = db.members.count({team: _teamId})
_roomIds = db.rooms.find({team: _teamId}).map (room) -> room._id
robotIds = db.users.find({isRobot: true}).map (robot) -> "#{robot._id}"
pri... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/mshells/cleanup-fans-team.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/mshells/cleanup-fans-team.coffee | 1 | 50 |
jianliaoim/talk-os:talk-api2x/mshells/cleanup-fans-team.coffee:1:completion | completion | # 清空发烧友不活跃用户
today = ISODate().getTime()
_teamId = ObjectId('544f9896480ab1825e6a1fc3')
members = db.members.find({team: _teamId})
memberCount = db.members.count({team: _teamId})
_roomIds = db.rooms.find({team: _teamId}).map (room) -> room._id
robotIds = db.users.find({isRobot: true}).map (robot) -> "#{robot._id}"
pri... | print "移除 #{member.user} 移除话题 #{remRoom.nRemoved}"
members.forEach (member) ->
if member.isQuit
return remove member
if member.createdAt > today - 86400000 * 7
# 跳过最近一周内加入成员
return skip member
if "#{member.user}" in robotIds
# 跳过机器人
return skip member
if member.role in ['admin', 'owner']
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/mshells/cleanup-fans-team.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/mshells/cleanup-fans-team.coffee | 1 | 50 |
jianliaoim/talk-os:talk-api2x/server/observers/team.coffee:1:raw_corpus | raw_corpus | limbo = require 'limbo'
Promise = require 'bluebird'
Err = require 'err1st'
serviceLoader = require 'talk-services'
{
TeamModel
} = limbo.use 'talk'
_initNewTeam = (callback) ->
team = this
RoomModel = @model 'Room'
MemberModel = @model 'Member'
# Save general room
room = new RoomModel
team: team._id... | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/observers/team.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/observers/team.coffee | 1 | 48 | ||
jianliaoim/talk-os:talk-api2x/server/observers/team.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
limbo = require 'limbo'
Promise = require 'bluebird'
Err = require 'err1st'
serviceLoader = require 'talk-services'
{
TeamModel
} = limbo.use 'talk'
_initNewTeam = (callback) ->
team = this
RoomModel = @model 'Room'
MemberModel = @model 'Member'
# Sa... | var Err, Promise, TeamModel, TeamSchema, _initNewTeam, limbo, serviceLoader;
limbo = require('limbo');
Promise = require('bluebird');
Err = require('err1st');
serviceLoader = require('talk-services');
({TeamModel} = limbo.use('talk'));
_initNewTeam = function(callback) {
var $ownerMember, $room, $talkai, Member... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/server/observers/team.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/observers/team.coffee | 1 | 48 |
jianliaoim/talk-os:talk-api2x/server/observers/team.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Err, Promise, TeamModel, TeamSchema, _initNewTeam, limbo, serviceLoader;
limbo = require('limbo');
Promise = require('bluebird');
Err = require('err1st');
serviceLoader = require('talk-services');
({TeamModel} = limbo.use('talk'));
_initNewTeam = function... | limbo = require 'limbo'
Promise = require 'bluebird'
Err = require 'err1st'
serviceLoader = require 'talk-services'
{
TeamModel
} = limbo.use 'talk'
_initNewTeam = (callback) ->
team = this
RoomModel = @model 'Room'
MemberModel = @model 'Member'
# Save general room
room = new RoomModel
team: team._id... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/observers/team.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/observers/team.coffee | 1 | 48 |
jianliaoim/talk-os:talk-api2x/server/observers/team.coffee:1:completion | completion | limbo = require 'limbo'
Promise = require 'bluebird'
Err = require 'err1st'
serviceLoader = require 'talk-services'
{
TeamModel
} = limbo.use 'talk'
_initNewTeam = (callback) ->
team = this
RoomModel = @model 'Room'
MemberModel = @model 'Member'
# Save general room
room = new RoomModel
team: team._id... | ownerMember = new MemberModel
user: team._creatorId
team: team._id
joinAt: new Date
role: 'owner'
$ownerMember = ownerMember.$save()
# Add talkai after general room created
$talkai = serviceLoader.getRobotOf 'talkai'
$talkai = Promise.all [$talkai, $room]
.spread (talkai, room) -> team.addM... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/observers/team.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/observers/team.coffee | 1 | 48 |
abe33/atom-pigments:lib/color-search.coffee:2:raw_corpus | raw_corpus | class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{@sourceNames, ignoredNames: @ignoredNameSources, @context, @project} = @options
{Emitter} = require 'atom' unless Emitter?
@emitter = new Emitter
if @project?
@init()
else
subsc... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4 | 518 | https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/color-search.coffee | 4 | 53 | ||
abe33/atom-pigments:lib/color-search.coffee:2:completion | completion | class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{@sourceNames, ignoredNames: @ignoredNameSources, @context, @project} = @options
{Emitter} = require 'atom' unless Emitter?
@emitter = new Emitter
if @project?
@init()
else
subsc... | @sourceNames ?= []
@ignoredNameSources ?= []
@ignoredNames = []
for ignore in @ignoredNameSources when ignore?
try
@ignoredNames.push(new Minimatch(ignore, matchBase: true, dot: true))
catch error
console.warn "Error parsing ignore pattern (#{ignore}): #{error.message}"
@se... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4 | 518 | https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/color-search.coffee | 4 | 53 |
abe33/atom-pigments:lib/color-search.coffee:3:raw_corpus | raw_corpus | unless @project?
@searchRequested = true
return
re = new RegExp @project.getColorExpressionsRegistry().getRegExp()
results = []
promise = atom.workspace.scan re, paths: @sourceNames, (m) =>
relativePath = atom.project.relativize(m.filePath)
scope = @project.scopeFromFileName(relati... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4 | 518 | https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/color-search.coffee | 54 | 102 | ||
abe33/atom-pigments:lib/color-search.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
unless @project?
@searchRequested = true
return
re = new RegExp @project.getColorExpressionsRegistry().getRegExp()
results = []
promise = atom.workspace.scan re, paths: @sourceNames, (m) =>
relativePath = atom.project.relativize(m.... | var promise, re, results;
if (this.project == null) {
this.searchRequested = true;
return;
}
re = new RegExp(this.project.getColorExpressionsRegistry().getRegExp());
results = [];
promise = atom.workspace.scan(re, {
paths: this.sourceNames
}, (m) => {
var i, len, newMatches, ref, ref1, relativePath, result,... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4 | 518 | https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/color-search.coffee | 54 | 102 |
abe33/atom-pigments:lib/color-search.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var promise, re, results;
if (this.project == null) {
this.searchRequested = true;
return;
}
re = new RegExp(this.project.getColorExpressionsRegistry().getRegExp());
results = [];
promise = atom.workspace.scan(re, {
paths: this.sourceNames
}, (m) => {
v... | unless @project?
@searchRequested = true
return
re = new RegExp @project.getColorExpressionsRegistry().getRegExp()
results = []
promise = atom.workspace.scan re, paths: @sourceNames, (m) =>
relativePath = atom.project.relativize(m.filePath)
scope = @project.scopeFromFileName(relati... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4 | 518 | https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/color-search.coffee | 54 | 102 |
abe33/atom-pigments:lib/color-search.coffee:3:completion | completion | unless @project?
@searchRequested = true
return
re = new RegExp @project.getColorExpressionsRegistry().getRegExp()
results = []
promise = atom.workspace.scan re, paths: @sourceNames, (m) =>
relativePath = atom.project.relativize(m.filePath)
scope = @project.scopeFromFileName(relati... | result.matchText = result.color.colorExpression
results.push result
newMatches.push result
m.matches = newMatches
@emitter.emit 'did-find-matches', m if m.matches.length > 0
promise.then =>
@results = results
@emitter.emit 'did-complete-search', results
isIgnored: (rel... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4 | 518 | https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/color-search.coffee | 54 | 102 |
abe33/atom-pigments:lib/color-search.coffee:2:raw_corpus | raw_corpus | class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{@sourceNames, ignoredNames: @ignoredNameSources, @context, @project} = @options
{Emitter} = require 'atom' unless Emitter?
@emitter = new Emitter
if @project?
@init()
else
atom.... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | ab002ebd26b8b5c0c0f03dfece379908d080e5a6 | 518 | https://github.com/abe33/atom-pigments/blob/ab002ebd26b8b5c0c0f03dfece379908d080e5a6/lib/color-search.coffee | 4 | 53 | ||
abe33/atom-pigments:lib/color-search.coffee:2:completion | completion | class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{@sourceNames, ignoredNames: @ignoredNameSources, @context, @project} = @options
{Emitter} = require 'atom' unless Emitter?
@emitter = new Emitter
if @project?
@init()
else
atom.... | @ignoredNameSources ?= []
@ignoredNames = []
for ignore in @ignoredNameSources when ignore?
try
@ignoredNames.push(new Minimatch(ignore, matchBase: true, dot: true))
catch error
console.warn "Error parsing ignore pattern (#{ignore}): #{error.message}"
@search() if @searchReques... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | ab002ebd26b8b5c0c0f03dfece379908d080e5a6 | 518 | https://github.com/abe33/atom-pigments/blob/ab002ebd26b8b5c0c0f03dfece379908d080e5a6/lib/color-search.coffee | 4 | 53 |
abe33/atom-pigments:lib/color-search.coffee:3:raw_corpus | raw_corpus | @searchRequested = true
return
re = new RegExp @project.getColorExpressionsRegistry().getRegExp()
results = []
promise = atom.workspace.scan re, paths: @sourceNames, (m) =>
relativePath = atom.project.relativize(m.filePath)
scope = @project.scopeFromFileName(relativePath)
return if... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | ab002ebd26b8b5c0c0f03dfece379908d080e5a6 | 518 | https://github.com/abe33/atom-pigments/blob/ab002ebd26b8b5c0c0f03dfece379908d080e5a6/lib/color-search.coffee | 54 | 101 | ||
abe33/atom-pigments:lib/color-search.coffee:3:completion | completion | @searchRequested = true
return
re = new RegExp @project.getColorExpressionsRegistry().getRegExp()
results = []
promise = atom.workspace.scan re, paths: @sourceNames, (m) =>
relativePath = atom.project.relativize(m.filePath)
scope = @project.scopeFromFileName(relativePath)
return if... | results.push result
newMatches.push result
m.matches = newMatches
@emitter.emit 'did-find-matches', m if m.matches.length > 0
promise.then =>
@results = results
@emitter.emit 'did-complete-search', results
isIgnored: (relativePath) ->
for ignoredName in @ignoredNames
... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | ab002ebd26b8b5c0c0f03dfece379908d080e5a6 | 518 | https://github.com/abe33/atom-pigments/blob/ab002ebd26b8b5c0c0f03dfece379908d080e5a6/lib/color-search.coffee | 54 | 101 |
abe33/atom-pigments:lib/color-search.coffee:2:raw_corpus | raw_corpus | class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{Emitter} = require 'atom' unless Emitter?
{Minimatch} = require 'minimatch' unless Minimatch?
ColorContext ?= require './color-context'
registry ?= require './color-expressions'
{@sourceNam... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8 | 518 | https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/color-search.coffee | 4 | 53 | ||
abe33/atom-pigments:lib/color-search.coffee:2:completion | completion | class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{Emitter} = require 'atom' unless Emitter?
{Minimatch} = require 'minimatch' unless Minimatch?
ColorContext ?= require './color-context'
registry ?= require './color-expressions'
{@sourceNam... | getURI: -> 'pigments://search'
getIconName: -> "pigments"
onDidFindMatches: (callback) ->
@emitter.on 'did-find-matches', callback
onDidCompleteSearch: (callback) ->
@emitter.on 'did-complete-search', callback
search: ->
registry ?= require './color-expressions'
re = new RegExp registry.get... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8 | 518 | https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/color-search.coffee | 4 | 53 |
abe33/atom-pigments:lib/color-search.coffee:3:raw_corpus | raw_corpus | # FIXME it should be handled way before, but it'll need a change
# in how we test if a variable is a color.
continue unless result.color?.isValid()
# FIXME Seems like, sometime the range of the result is undefined,
# we'll ignore that for now and log the faulting result.
unless r... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8 | 518 | https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/color-search.coffee | 54 | 84 | ||
abe33/atom-pigments:lib/color-search.coffee:3:completion | completion | # FIXME it should be handled way before, but it'll need a change
# in how we test if a variable is a color.
continue unless result.color?.isValid()
# FIXME Seems like, sometime the range of the result is undefined,
# we'll ignore that for now and log the faulting result.
unless r... | @emitter.emit 'did-find-matches', m if m.matches.length > 0
promise.then =>
@results = results
@emitter.emit 'did-complete-search', results
isIgnored: (relativePath) ->
for ignoredName in @ignoredNames
return true if ignoredName.match(relativePath)
serialize: ->
{
deserializer... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8 | 518 | https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/color-search.coffee | 54 | 84 |
abe33/atom-pigments:lib/color-search.coffee:2:raw_corpus | raw_corpus | class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{@sourceNames, ignoredNames, @context, @project} = @options
@emitter = new Emitter
@context ?= new ColorContext({registry})
@parser = @context.parser
@variables = @context.getVariables()
... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 2033ef1f546c3f2c8ef97686070d0a8a5c9a4efb | 518 | https://github.com/abe33/atom-pigments/blob/2033ef1f546c3f2c8ef97686070d0a8a5c9a4efb/lib/color-search.coffee | 8 | 57 | ||
abe33/atom-pigments:lib/color-search.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{@sourceNames, ignoredNames, @context, @project} = @options
@emitter = new Emitter
@context ?= new ColorContext({registry})
@parser = @con... | var ColorSearch;
ColorSearch = class ColorSearch {
static deserialize(state) {
return new ColorSearch(state.options);
}
constructor(options = {}) {
var error, i, ignore, ignoredNames, len;
this.options = options;
({sourceNames: this.sourceNames, ignoredNames, context: this.context, project: this... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 2033ef1f546c3f2c8ef97686070d0a8a5c9a4efb | 518 | https://github.com/abe33/atom-pigments/blob/2033ef1f546c3f2c8ef97686070d0a8a5c9a4efb/lib/color-search.coffee | 8 | 57 |
abe33/atom-pigments:lib/color-search.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ColorSearch;
ColorSearch = class ColorSearch {
static deserialize(state) {
return new ColorSearch(state.options);
}
constructor(options = {}) {
var error, i, ignore, ignoredNames, len;
this.options = options;
({sourceNames: this.sourceNa... | class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{@sourceNames, ignoredNames, @context, @project} = @options
@emitter = new Emitter
@context ?= new ColorContext({registry})
@parser = @context.parser
@variables = @context.getVariables()
... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 2033ef1f546c3f2c8ef97686070d0a8a5c9a4efb | 518 | https://github.com/abe33/atom-pigments/blob/2033ef1f546c3f2c8ef97686070d0a8a5c9a4efb/lib/color-search.coffee | 8 | 57 |
abe33/atom-pigments:lib/color-search.coffee:2:completion | completion | class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{@sourceNames, ignoredNames, @context, @project} = @options
@emitter = new Emitter
@context ?= new ColorContext({registry})
@parser = @context.parser
@variables = @context.getVariables()
... | onDidFindMatches: (callback) ->
@emitter.on 'did-find-matches', callback
onDidCompleteSearch: (callback) ->
@emitter.on 'did-complete-search', callback
search: ->
re = new RegExp registry.getRegExp()
results = []
promise = atom.workspace.scan re, paths: @sourceNames, (m) =>
relativePath... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 2033ef1f546c3f2c8ef97686070d0a8a5c9a4efb | 518 | https://github.com/abe33/atom-pigments/blob/2033ef1f546c3f2c8ef97686070d0a8a5c9a4efb/lib/color-search.coffee | 8 | 57 |
abe33/atom-pigments:lib/color-search.coffee:3:raw_corpus | raw_corpus | continue
result.range[0][1] += result.matchText.indexOf(result.color.colorExpression)
result.matchText = result.color.colorExpression
results.push result
newMatches.push result
m.matches = newMatches
@emitter.emit 'did-find-matches', m if m.matches.length > 0
promise.... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 2033ef1f546c3f2c8ef97686070d0a8a5c9a4efb | 518 | https://github.com/abe33/atom-pigments/blob/2033ef1f546c3f2c8ef97686070d0a8a5c9a4efb/lib/color-search.coffee | 58 | 81 | ||
abe33/atom-pigments:lib/color-search.coffee:3:completion | completion | continue
result.range[0][1] += result.matchText.indexOf(result.color.colorExpression)
result.matchText = result.color.colorExpression
results.push result
newMatches.push result
m.matches = newMatches
@emitter.emit 'did-find-matches', m if m.matches.length > 0
promise.... | @results = results
@emitter.emit 'did-complete-search', results
isIgnored: (relativePath) ->
for ignoredName in @ignoredNames
return true if ignoredName.match(relativePath)
serialize: ->
{
deserializer: 'ColorSearch'
@options
} | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 2033ef1f546c3f2c8ef97686070d0a8a5c9a4efb | 518 | https://github.com/abe33/atom-pigments/blob/2033ef1f546c3f2c8ef97686070d0a8a5c9a4efb/lib/color-search.coffee | 58 | 81 |
abe33/atom-pigments:lib/color-search.coffee:2:raw_corpus | raw_corpus | class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{@sourceNames, ignoredNames, @context} = @options
@emitter = new Emitter
@context ?= new ColorContext({registry})
@parser = @context.parser
@variables = @context.getVariables()
@sourceNam... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 36f562cc2c51fe076f776f2e84d707d978a9e906 | 518 | https://github.com/abe33/atom-pigments/blob/36f562cc2c51fe076f776f2e84d707d978a9e906/lib/color-search.coffee | 9 | 58 | ||
abe33/atom-pigments:lib/color-search.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{@sourceNames, ignoredNames, @context} = @options
@emitter = new Emitter
@context ?= new ColorContext({registry})
@parser = @context.parse... | var ColorSearch;
ColorSearch = class ColorSearch {
static deserialize(state) {
return new ColorSearch(state.options);
}
constructor(options = {}) {
var error, i, ignore, ignoredNames, len;
this.options = options;
({sourceNames: this.sourceNames, ignoredNames, context: this.context} = this.option... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 36f562cc2c51fe076f776f2e84d707d978a9e906 | 518 | https://github.com/abe33/atom-pigments/blob/36f562cc2c51fe076f776f2e84d707d978a9e906/lib/color-search.coffee | 9 | 58 |
abe33/atom-pigments:lib/color-search.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ColorSearch;
ColorSearch = class ColorSearch {
static deserialize(state) {
return new ColorSearch(state.options);
}
constructor(options = {}) {
var error, i, ignore, ignoredNames, len;
this.options = options;
({sourceNames: this.sourceNa... | class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{@sourceNames, ignoredNames, @context} = @options
@emitter = new Emitter
@context ?= new ColorContext({registry})
@parser = @context.parser
@variables = @context.getVariables()
@sourceNam... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 36f562cc2c51fe076f776f2e84d707d978a9e906 | 518 | https://github.com/abe33/atom-pigments/blob/36f562cc2c51fe076f776f2e84d707d978a9e906/lib/color-search.coffee | 9 | 58 |
abe33/atom-pigments:lib/color-search.coffee:2:completion | completion | class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{@sourceNames, ignoredNames, @context} = @options
@emitter = new Emitter
@context ?= new ColorContext({registry})
@parser = @context.parser
@variables = @context.getVariables()
@sourceNam... | onDidFindMatches: (callback) ->
@emitter.on 'did-find-matches', callback
onDidCompleteSearch: (callback) ->
@emitter.on 'did-complete-search', callback
search: ->
re = new RegExp registry.getRegExp()
results = []
promise = atom.workspace.scan re, paths: @sourceNames, (m) =>
relativePath... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 36f562cc2c51fe076f776f2e84d707d978a9e906 | 518 | https://github.com/abe33/atom-pigments/blob/36f562cc2c51fe076f776f2e84d707d978a9e906/lib/color-search.coffee | 9 | 58 |
abe33/atom-pigments:lib/color-search.coffee:2:raw_corpus | raw_corpus | class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{@sourceNames, ignoredNames, @context} = @options
@emitter = new Emitter
@context ?= new ColorContext({registry})
@parser = @context.parser
@variables = @context.getVariables()
@sourceNam... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 0d39d82c192a24bbc3558fc10b9e3f04f79122c5 | 518 | https://github.com/abe33/atom-pigments/blob/0d39d82c192a24bbc3558fc10b9e3f04f79122c5/lib/color-search.coffee | 9 | 58 | ||
abe33/atom-pigments:lib/color-search.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{@sourceNames, ignoredNames, @context} = @options
@emitter = new Emitter
@context ?= new ColorContext({registry})
@parser = @context.parse... | var ColorSearch;
ColorSearch = class ColorSearch {
static deserialize(state) {
return new ColorSearch(state.options);
}
constructor(options = {}) {
var error, i, ignore, ignoredNames, len;
this.options = options;
({sourceNames: this.sourceNames, ignoredNames, context: this.context} = this.option... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 0d39d82c192a24bbc3558fc10b9e3f04f79122c5 | 518 | https://github.com/abe33/atom-pigments/blob/0d39d82c192a24bbc3558fc10b9e3f04f79122c5/lib/color-search.coffee | 9 | 58 |
abe33/atom-pigments:lib/color-search.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ColorSearch;
ColorSearch = class ColorSearch {
static deserialize(state) {
return new ColorSearch(state.options);
}
constructor(options = {}) {
var error, i, ignore, ignoredNames, len;
this.options = options;
({sourceNames: this.sourceNa... | class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{@sourceNames, ignoredNames, @context} = @options
@emitter = new Emitter
@context ?= new ColorContext({registry})
@parser = @context.parser
@variables = @context.getVariables()
@sourceNam... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 0d39d82c192a24bbc3558fc10b9e3f04f79122c5 | 518 | https://github.com/abe33/atom-pigments/blob/0d39d82c192a24bbc3558fc10b9e3f04f79122c5/lib/color-search.coffee | 9 | 58 |
abe33/atom-pigments:lib/color-search.coffee:2:completion | completion | class ColorSearch
@deserialize: (state) -> new ColorSearch(state.options)
constructor: (@options={}) ->
{@sourceNames, ignoredNames, @context} = @options
@emitter = new Emitter
@context ?= new ColorContext({registry})
@parser = @context.parser
@variables = @context.getVariables()
@sourceNam... | onDidFindMatches: (callback) ->
@emitter.on 'did-find-matches', callback
onDidCompleteSearch: (callback) ->
@emitter.on 'did-complete-search', callback
search: ->
re = new RegExp registry.getRegExp()
results = []
promise = atom.workspace.scan re, paths: @sourceNames, (m) =>
relativePath... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 0d39d82c192a24bbc3558fc10b9e3f04f79122c5 | 518 | https://github.com/abe33/atom-pigments/blob/0d39d82c192a24bbc3558fc10b9e3f04f79122c5/lib/color-search.coffee | 9 | 58 |
abe33/atom-pigments:lib/color-search.coffee:1:raw_corpus | raw_corpus | path = require 'path'
{Emitter} = require 'atom'
{Minimatch} = require 'minimatch'
registry = require './color-expressions'
ColorParser = require './color-parser'
ColorContext = require './color-context'
module.exports =
class ColorSearch
constructor: (options={}) ->
{@sourceNames, ignoredNames, @context} = opti... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | b8918c7ec066777bd5243c753779e638b7238887 | 518 | https://github.com/abe33/atom-pigments/blob/b8918c7ec066777bd5243c753779e638b7238887/lib/color-search.coffee | 1 | 50 | ||
abe33/atom-pigments:lib/color-search.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
path = require 'path'
{Emitter} = require 'atom'
{Minimatch} = require 'minimatch'
registry = require './color-expressions'
ColorParser = require './color-parser'
ColorContext = require './color-context'
module.exports =
class ColorSearch
constructor: (options... | var ColorContext, ColorParser, ColorSearch, Emitter, Minimatch, path, registry;
path = require('path');
({Emitter} = require('atom'));
({Minimatch} = require('minimatch'));
registry = require('./color-expressions');
ColorParser = require('./color-parser');
ColorContext = require('./color-context');
module.export... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/color-search.coffee | MIT | b8918c7ec066777bd5243c753779e638b7238887 | 518 | https://github.com/abe33/atom-pigments/blob/b8918c7ec066777bd5243c753779e638b7238887/lib/color-search.coffee | 1 | 50 |
abe33/atom-pigments:lib/color-search.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ColorContext, ColorParser, ColorSearch, Emitter, Minimatch, path, registry;
path = require('path');
({Emitter} = require('atom'));
({Minimatch} = require('minimatch'));
registry = require('./color-expressions');
ColorParser = require('./color-parser');
Co... | path = require 'path'
{Emitter} = require 'atom'
{Minimatch} = require 'minimatch'
registry = require './color-expressions'
ColorParser = require './color-parser'
ColorContext = require './color-context'
module.exports =
class ColorSearch
constructor: (options={}) ->
{@sourceNames, ignoredNames, @context} = opti... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | b8918c7ec066777bd5243c753779e638b7238887 | 518 | https://github.com/abe33/atom-pigments/blob/b8918c7ec066777bd5243c753779e638b7238887/lib/color-search.coffee | 1 | 50 |
abe33/atom-pigments:lib/color-search.coffee:1:completion | completion | path = require 'path'
{Emitter} = require 'atom'
{Minimatch} = require 'minimatch'
registry = require './color-expressions'
ColorParser = require './color-parser'
ColorContext = require './color-context'
module.exports =
class ColorSearch
constructor: (options={}) ->
{@sourceNames, ignoredNames, @context} = opti... | onDidFindMatches: (callback) ->
@emitter.on 'did-find-matches', callback
onDidCompleteSearch: (callback) ->
@emitter.on 'did-complete-search', callback
search: ->
re = new RegExp registry.getRegExp()
results = []
promise = atom.workspace.scan re, paths: @sourceNames, (m) =>
relativePath... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | b8918c7ec066777bd5243c753779e638b7238887 | 518 | https://github.com/abe33/atom-pigments/blob/b8918c7ec066777bd5243c753779e638b7238887/lib/color-search.coffee | 1 | 50 |
abe33/atom-pigments:lib/color-search.coffee:2:raw_corpus | raw_corpus | continue
result.range[0][1] += result.matchText.indexOf(result.color.colorExpression)
result.matchText = result.color.colorExpression
results.push result
newMatches.push result
m.matches = newMatches
@emitter.emit 'did-find-matches', m if m.matches.length > 0
promise.... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | b8918c7ec066777bd5243c753779e638b7238887 | 518 | https://github.com/abe33/atom-pigments/blob/b8918c7ec066777bd5243c753779e638b7238887/lib/color-search.coffee | 51 | 68 | ||
abe33/atom-pigments:lib/color-search.coffee:2:completion | completion | continue
result.range[0][1] += result.matchText.indexOf(result.color.colorExpression)
result.matchText = result.color.colorExpression
results.push result
newMatches.push result
m.matches = newMatches | @emitter.emit 'did-find-matches', m if m.matches.length > 0
promise.then =>
@results = results
@emitter.emit 'did-complete-search', results
isIgnored: (relativePath) ->
for ignoredName in @ignoredNames
return true if ignoredName.match(relativePath) | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | b8918c7ec066777bd5243c753779e638b7238887 | 518 | https://github.com/abe33/atom-pigments/blob/b8918c7ec066777bd5243c753779e638b7238887/lib/color-search.coffee | 51 | 68 |
abe33/atom-pigments:lib/color-search.coffee:1:raw_corpus | raw_corpus | {Emitter} = require 'atom'
{Minimatch} = require 'minimatch'
registry = require './color-expressions'
ColorParser = require './color-parser'
ColorContext = require './color-context'
module.exports =
class ColorSearch
constructor: (options={}) ->
{@sourceNames, ignoredNames, @context} = options
@emitter = new... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 0e8beec6811008c88c57feb7ecfc2794f2e9559f | 518 | https://github.com/abe33/atom-pigments/blob/0e8beec6811008c88c57feb7ecfc2794f2e9559f/lib/color-search.coffee | 1 | 50 | ||
abe33/atom-pigments:lib/color-search.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{Emitter} = require 'atom'
{Minimatch} = require 'minimatch'
registry = require './color-expressions'
ColorParser = require './color-parser'
ColorContext = require './color-context'
module.exports =
class ColorSearch
constructor: (options={}) ->
{@sourceNa... | var ColorContext, ColorParser, ColorSearch, Emitter, Minimatch, registry;
({Emitter} = require('atom'));
({Minimatch} = require('minimatch'));
registry = require('./color-expressions');
ColorParser = require('./color-parser');
ColorContext = require('./color-context');
module.exports = ColorSearch = class ColorSe... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 0e8beec6811008c88c57feb7ecfc2794f2e9559f | 518 | https://github.com/abe33/atom-pigments/blob/0e8beec6811008c88c57feb7ecfc2794f2e9559f/lib/color-search.coffee | 1 | 50 |
abe33/atom-pigments:lib/color-search.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ColorContext, ColorParser, ColorSearch, Emitter, Minimatch, registry;
({Emitter} = require('atom'));
({Minimatch} = require('minimatch'));
registry = require('./color-expressions');
ColorParser = require('./color-parser');
ColorContext = require('./color-c... | {Emitter} = require 'atom'
{Minimatch} = require 'minimatch'
registry = require './color-expressions'
ColorParser = require './color-parser'
ColorContext = require './color-context'
module.exports =
class ColorSearch
constructor: (options={}) ->
{@sourceNames, ignoredNames, @context} = options
@emitter = new... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 0e8beec6811008c88c57feb7ecfc2794f2e9559f | 518 | https://github.com/abe33/atom-pigments/blob/0e8beec6811008c88c57feb7ecfc2794f2e9559f/lib/color-search.coffee | 1 | 50 |
abe33/atom-pigments:lib/color-search.coffee:1:completion | completion | {Emitter} = require 'atom'
{Minimatch} = require 'minimatch'
registry = require './color-expressions'
ColorParser = require './color-parser'
ColorContext = require './color-context'
module.exports =
class ColorSearch
constructor: (options={}) ->
{@sourceNames, ignoredNames, @context} = options
@emitter = new... | @emitter.on 'did-find-matches', callback
onDidCompleteSearch: (callback) ->
@emitter.on 'did-complete-search', callback
search: ->
re = new RegExp registry.getRegExp()
results = []
promise = atom.workspace.scan re, paths: @sourceNames, (m) =>
relativePath = atom.project.relativize(m.filePat... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 0e8beec6811008c88c57feb7ecfc2794f2e9559f | 518 | https://github.com/abe33/atom-pigments/blob/0e8beec6811008c88c57feb7ecfc2794f2e9559f/lib/color-search.coffee | 1 | 50 |
abe33/atom-pigments:lib/color-search.coffee:2:raw_corpus | raw_corpus | result.matchText = result.color.colorExpression
results.push result
newMatches.push result
m.matches = newMatches
@emitter.emit 'did-find-matches', m if m.matches.length > 0
promise.then =>
@results = results
@emitter.emit 'did-complete-search', results
isIgnored: (rel... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 0e8beec6811008c88c57feb7ecfc2794f2e9559f | 518 | https://github.com/abe33/atom-pigments/blob/0e8beec6811008c88c57feb7ecfc2794f2e9559f/lib/color-search.coffee | 51 | 66 | ||
abe33/atom-pigments:lib/color-search.coffee:2:completion | completion | result.matchText = result.color.colorExpression
results.push result
newMatches.push result
m.matches = newMatches
@emitter.emit 'did-find-matches', m if m.matches.length > 0 | promise.then =>
@results = results
@emitter.emit 'did-complete-search', results
isIgnored: (relativePath) ->
for ignoredName in @ignoredNames
return true if ignoredName.match(relativePath) | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 0e8beec6811008c88c57feb7ecfc2794f2e9559f | 518 | https://github.com/abe33/atom-pigments/blob/0e8beec6811008c88c57feb7ecfc2794f2e9559f/lib/color-search.coffee | 51 | 66 |
abe33/atom-pigments:lib/color-search.coffee:1:raw_corpus | raw_corpus | {Emitter} = require 'atom'
{Minimatch} = require 'minimatch'
registry = require './color-expressions'
ColorParser = require './color-parser'
ColorContext = require './color-context'
module.exports =
class ColorSearch
constructor: (options={}) ->
{@sourceNames, ignoredNames, @context} = options
@emitter = new... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 85cec032e06bb0e06b45873652cd0627c90189d7 | 518 | https://github.com/abe33/atom-pigments/blob/85cec032e06bb0e06b45873652cd0627c90189d7/lib/color-search.coffee | 1 | 50 | ||
abe33/atom-pigments:lib/color-search.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{Emitter} = require 'atom'
{Minimatch} = require 'minimatch'
registry = require './color-expressions'
ColorParser = require './color-parser'
ColorContext = require './color-context'
module.exports =
class ColorSearch
constructor: (options={}) ->
{@sourceNa... | var ColorContext, ColorParser, ColorSearch, Emitter, Minimatch, registry;
({Emitter} = require('atom'));
({Minimatch} = require('minimatch'));
registry = require('./color-expressions');
ColorParser = require('./color-parser');
ColorContext = require('./color-context');
module.exports = ColorSearch = class ColorSe... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 85cec032e06bb0e06b45873652cd0627c90189d7 | 518 | https://github.com/abe33/atom-pigments/blob/85cec032e06bb0e06b45873652cd0627c90189d7/lib/color-search.coffee | 1 | 50 |
abe33/atom-pigments:lib/color-search.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ColorContext, ColorParser, ColorSearch, Emitter, Minimatch, registry;
({Emitter} = require('atom'));
({Minimatch} = require('minimatch'));
registry = require('./color-expressions');
ColorParser = require('./color-parser');
ColorContext = require('./color-c... | {Emitter} = require 'atom'
{Minimatch} = require 'minimatch'
registry = require './color-expressions'
ColorParser = require './color-parser'
ColorContext = require './color-context'
module.exports =
class ColorSearch
constructor: (options={}) ->
{@sourceNames, ignoredNames, @context} = options
@emitter = new... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 85cec032e06bb0e06b45873652cd0627c90189d7 | 518 | https://github.com/abe33/atom-pigments/blob/85cec032e06bb0e06b45873652cd0627c90189d7/lib/color-search.coffee | 1 | 50 |
abe33/atom-pigments:lib/color-search.coffee:1:completion | completion | {Emitter} = require 'atom'
{Minimatch} = require 'minimatch'
registry = require './color-expressions'
ColorParser = require './color-parser'
ColorContext = require './color-context'
module.exports =
class ColorSearch
constructor: (options={}) ->
{@sourceNames, ignoredNames, @context} = options
@emitter = new... | onDidFindMatches: (callback) ->
@emitter.on 'did-find-matches', callback
onDidCompleteSearch: (callback) ->
@emitter.on 'did-complete-search', callback
search: ->
re = new RegExp registry.getRegExp()
results = []
promise = atom.workspace.scan re, paths: @sourceNames, (m) =>
relativePath... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 85cec032e06bb0e06b45873652cd0627c90189d7 | 518 | https://github.com/abe33/atom-pigments/blob/85cec032e06bb0e06b45873652cd0627c90189d7/lib/color-search.coffee | 1 | 50 |
abe33/atom-pigments:lib/color-search.coffee:2:raw_corpus | raw_corpus | result.range[0][1] += result.matchText.indexOf(result.color.colorExpression)
result.matchText = result.color.colorExpression
results.push result
newMatches.push result
m.matches = newMatches
@emitter.emit 'did-find-matches', m if m.matches.length > 0
promise.then =>
@re... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 85cec032e06bb0e06b45873652cd0627c90189d7 | 518 | https://github.com/abe33/atom-pigments/blob/85cec032e06bb0e06b45873652cd0627c90189d7/lib/color-search.coffee | 51 | 67 | ||
abe33/atom-pigments:lib/color-search.coffee:2:completion | completion | result.range[0][1] += result.matchText.indexOf(result.color.colorExpression)
result.matchText = result.color.colorExpression
results.push result
newMatches.push result
m.matches = newMatches | @emitter.emit 'did-find-matches', m if m.matches.length > 0
promise.then =>
@results = results
@emitter.emit 'did-complete-search', results
isIgnored: (relativePath) ->
for ignoredName in @ignoredNames
return true if ignoredName.match(relativePath) | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 85cec032e06bb0e06b45873652cd0627c90189d7 | 518 | https://github.com/abe33/atom-pigments/blob/85cec032e06bb0e06b45873652cd0627c90189d7/lib/color-search.coffee | 51 | 67 |
abe33/atom-pigments:lib/color-search.coffee:1:raw_corpus | raw_corpus | {Emitter} = require 'atom'
{Minimatch} = require 'minimatch'
{getRegistry} = require './color-expressions'
ColorParser = require './color-parser'
ColorContext = require './color-context'
module.exports =
class ColorSearch
constructor: (options={}) ->
{@sourceNames, ignoredNames, @context} = options
@emitter ... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-search.coffee | 1 | 50 | ||
abe33/atom-pigments:lib/color-search.coffee:1:completion | completion | {Emitter} = require 'atom'
{Minimatch} = require 'minimatch'
{getRegistry} = require './color-expressions'
ColorParser = require './color-parser'
ColorContext = require './color-context'
module.exports =
class ColorSearch
constructor: (options={}) ->
{@sourceNames, ignoredNames, @context} = options
@emitter ... | onDidFindMatches: (callback) ->
@emitter.on 'did-find-matches', callback
onDidCompleteSearch: (callback) ->
@emitter.on 'did-complete-search', callback
search: ->
registry = getRegistry(@context)
re = new RegExp registry.getRegExp()
results = []
promise = atom.workspace.scan re, paths: @... | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-search.coffee | 1 | 50 |
abe33/atom-pigments:lib/color-search.coffee:2:raw_corpus | raw_corpus | console.warn "Color search returned a result with an invalid range", result
continue
result.range[0][1] += result.matchText.indexOf(result.color.colorExpression)
result.matchText = result.color.colorExpression
results.push result
newMatches.push result
m.matches = newMa... | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-search.coffee | 51 | 69 | ||
abe33/atom-pigments:lib/color-search.coffee:2:completion | completion | console.warn "Color search returned a result with an invalid range", result
continue
result.range[0][1] += result.matchText.indexOf(result.color.colorExpression)
result.matchText = result.color.colorExpression
results.push result
newMatches.push result
m.matches = newMa... | @emitter.emit 'did-find-matches', m if m.matches.length > 0
promise.then =>
@results = results
@emitter.emit 'did-complete-search', results
isIgnored: (relativePath) ->
for ignoredName in @ignoredNames
return true if ignoredName.match(relativePath) | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/color-search.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-search.coffee | 51 | 69 |
CaryLandholt/AngularFun:scripts/controllers/gitHubController.coffee:1:raw_corpus | raw_corpus | ###global define###
define ['angular', 'controllers/controllers', 'services/gitHubService'], (angular, controllers) ->
'use strict'
controllers.controller 'gitHubController', ['$scope', '$location', 'gitHubService', ($scope, $location, gitHubService) ->
$scope.searchTerm = ''
$scope.repos = {}
$scope.search ... | CoffeeScript | CaryLandholt/AngularFun | scripts/controllers/gitHubController.coffee | MIT | d1cdd10b75a390445a1180aeef6460f89f7bfedb | 672 | https://github.com/CaryLandholt/AngularFun/blob/d1cdd10b75a390445a1180aeef6460f89f7bfedb/scripts/controllers/gitHubController.coffee | 1 | 21 | ||
CaryLandholt/AngularFun:scripts/controllers/gitHubController.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###global define###
define ['angular', 'controllers/controllers', 'services/gitHubService'], (angular, controllers) ->
'use strict'
controllers.controller 'gitHubController', ['$scope', '$location', 'gitHubService', ($scope, $location, gitHubService) ->
$sc... | /*global define*/
define(['angular', 'controllers/controllers', 'services/gitHubService'], function(angular, controllers) {
'use strict';
return controllers.controller('gitHubController', [
'$scope',
'$location',
'gitHubService',
function($scope,
$location,
gitHubService) {
$scope.sear... | CoffeeScript | JavaScript | CaryLandholt/AngularFun | scripts/controllers/gitHubController.coffee | MIT | d1cdd10b75a390445a1180aeef6460f89f7bfedb | 672 | https://github.com/CaryLandholt/AngularFun/blob/d1cdd10b75a390445a1180aeef6460f89f7bfedb/scripts/controllers/gitHubController.coffee | 1 | 21 |
CaryLandholt/AngularFun:scripts/controllers/gitHubController.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*global define*/
define(['angular', 'controllers/controllers', 'services/gitHubService'], function(angular, controllers) {
'use strict';
return controllers.controller('gitHubController', [
'$scope',
'$location',
'gitHubService',
function($scope... | ###global define###
define ['angular', 'controllers/controllers', 'services/gitHubService'], (angular, controllers) ->
'use strict'
controllers.controller 'gitHubController', ['$scope', '$location', 'gitHubService', ($scope, $location, gitHubService) ->
$scope.searchTerm = ''
$scope.repos = {}
$scope.search ... | JavaScript | CoffeeScript | CaryLandholt/AngularFun | scripts/controllers/gitHubController.coffee | MIT | d1cdd10b75a390445a1180aeef6460f89f7bfedb | 672 | https://github.com/CaryLandholt/AngularFun/blob/d1cdd10b75a390445a1180aeef6460f89f7bfedb/scripts/controllers/gitHubController.coffee | 1 | 21 |
CaryLandholt/AngularFun:scripts/controllers/gitHubController.coffee:1:completion | completion | ###global define###
define ['angular', 'controllers/controllers', 'services/gitHubService'], (angular, controllers) ->
'use strict'
controllers.controller 'gitHubController', ['$scope', '$location', 'gitHubService', ($scope, $location, gitHubService) ->
$scope.searchTerm = ''
$scope.repos = {}
$scope.search ... | $location.path "/github/#{searchTerm}"
$scope.$on '$afterRouteChange', (event, currentRoute, priorRoute) ->
return if not currentRoute or not currentRoute.$route or not currentRoute.$route.controller or currentRoute.$route.controller isnt 'gitHubController'
searchTerm = currentRoute.params.searchTerm
if s... | CoffeeScript | CoffeeScript | CaryLandholt/AngularFun | scripts/controllers/gitHubController.coffee | MIT | d1cdd10b75a390445a1180aeef6460f89f7bfedb | 672 | https://github.com/CaryLandholt/AngularFun/blob/d1cdd10b75a390445a1180aeef6460f89f7bfedb/scripts/controllers/gitHubController.coffee | 1 | 21 |
CaryLandholt/AngularFun:scripts/controllers/gitHubController.coffee:1:raw_corpus | raw_corpus | ###global define###
define ['use!angular', 'controllers/controllers', 'services/gitHubService'], (angular, controllers) ->
'use strict'
controllers.controller 'gitHubController', ['$scope', '$location', 'gitHubService', ($scope, $location, gitHubService) ->
$scope.searchTerm = ''
$scope.repos = {}
$scope.sea... | CoffeeScript | CaryLandholt/AngularFun | scripts/controllers/gitHubController.coffee | MIT | dfe4d72aa6e3e26fbc3001a210b6c4e4e937d851 | 672 | https://github.com/CaryLandholt/AngularFun/blob/dfe4d72aa6e3e26fbc3001a210b6c4e4e937d851/scripts/controllers/gitHubController.coffee | 1 | 21 | ||
CaryLandholt/AngularFun:scripts/controllers/gitHubController.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###global define###
define ['use!angular', 'controllers/controllers', 'services/gitHubService'], (angular, controllers) ->
'use strict'
controllers.controller 'gitHubController', ['$scope', '$location', 'gitHubService', ($scope, $location, gitHubService) ->
... | /*global define*/
define(['use!angular', 'controllers/controllers', 'services/gitHubService'], function(angular, controllers) {
'use strict';
return controllers.controller('gitHubController', [
'$scope',
'$location',
'gitHubService',
function($scope,
$location,
gitHubService) {
$scope.... | CoffeeScript | JavaScript | CaryLandholt/AngularFun | scripts/controllers/gitHubController.coffee | MIT | dfe4d72aa6e3e26fbc3001a210b6c4e4e937d851 | 672 | https://github.com/CaryLandholt/AngularFun/blob/dfe4d72aa6e3e26fbc3001a210b6c4e4e937d851/scripts/controllers/gitHubController.coffee | 1 | 21 |
CaryLandholt/AngularFun:scripts/controllers/gitHubController.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*global define*/
define(['use!angular', 'controllers/controllers', 'services/gitHubService'], function(angular, controllers) {
'use strict';
return controllers.controller('gitHubController', [
'$scope',
'$location',
'gitHubService',
function($s... | ###global define###
define ['use!angular', 'controllers/controllers', 'services/gitHubService'], (angular, controllers) ->
'use strict'
controllers.controller 'gitHubController', ['$scope', '$location', 'gitHubService', ($scope, $location, gitHubService) ->
$scope.searchTerm = ''
$scope.repos = {}
$scope.sea... | JavaScript | CoffeeScript | CaryLandholt/AngularFun | scripts/controllers/gitHubController.coffee | MIT | dfe4d72aa6e3e26fbc3001a210b6c4e4e937d851 | 672 | https://github.com/CaryLandholt/AngularFun/blob/dfe4d72aa6e3e26fbc3001a210b6c4e4e937d851/scripts/controllers/gitHubController.coffee | 1 | 21 |
CaryLandholt/AngularFun:scripts/controllers/gitHubController.coffee:1:completion | completion | ###global define###
define ['use!angular', 'controllers/controllers', 'services/gitHubService'], (angular, controllers) ->
'use strict'
controllers.controller 'gitHubController', ['$scope', '$location', 'gitHubService', ($scope, $location, gitHubService) ->
$scope.searchTerm = ''
$scope.repos = {}
$scope.sea... | $location.path "/github/#{searchTerm}"
$scope.$on '$afterRouteChange', (event, currentRoute, priorRoute) ->
return if not currentRoute or not currentRoute.$route or not currentRoute.$route.controller or currentRoute.$route.controller isnt 'gitHubController'
searchTerm = currentRoute.params.searchTerm
if s... | CoffeeScript | CoffeeScript | CaryLandholt/AngularFun | scripts/controllers/gitHubController.coffee | MIT | dfe4d72aa6e3e26fbc3001a210b6c4e4e937d851 | 672 | https://github.com/CaryLandholt/AngularFun/blob/dfe4d72aa6e3e26fbc3001a210b6c4e4e937d851/scripts/controllers/gitHubController.coffee | 1 | 21 |
soulwire/Coffee-Physics:source/behaviour/Wander.coffee:1:raw_corpus | raw_corpus | ### Wander Behaviour ###
class Wander extends Behaviour
constructor: (@jitter = 0.5, @radius = 100, @strength = 1.0) ->
@theta = Math.random() * Math.PI * 2
super
apply: (p, dt, index) ->
#super p, dt, index
@theta += (Math.random() - 0.5) * @jitter * Math.PI * 2
p.acc.x += Math.cos(@theta) * @radiu... | CoffeeScript | soulwire/Coffee-Physics | source/behaviour/Wander.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/behaviour/Wander.coffee | 1 | 18 | ||
soulwire/Coffee-Physics:source/behaviour/Wander.coffee:1:completion | completion | ### Wander Behaviour ###
class Wander extends Behaviour
constructor: (@jitter = 0.5, @radius = 100, @strength = 1.0) ->
@theta = Math.random() * Math.PI * 2
super | apply: (p, dt, index) ->
#super p, dt, index
@theta += (Math.random() - 0.5) * @jitter * Math.PI * 2
p.acc.x += Math.cos(@theta) * @radius * @strength
p.acc.y += Math.sin(@theta) * @radius * @strength | CoffeeScript | CoffeeScript | soulwire/Coffee-Physics | source/behaviour/Wander.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/behaviour/Wander.coffee | 1 | 18 |
cdglabs/apparatus:src/Model/Element.coffee:1:raw_corpus | raw_corpus | module.exports = Element = Node.createVariant
constructor: ->
# Call "super" constructor
Node.constructor.apply(this, arguments)
# Because the expanded properly is not inherited, it is initialized in
# the constructor for every Element.
@expanded = false
# These methods need to be cells beca... | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 75dc1a1148dcb755fb461a3d189accc66c7e4404 | 1,052 | https://github.com/cdglabs/apparatus/blob/75dc1a1148dcb755fb461a3d189accc66c7e4404/src/Model/Element.coffee | 9 | 58 | ||
cdglabs/apparatus:src/Model/Element.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = Element = Node.createVariant
constructor: ->
# Call "super" constructor
Node.constructor.apply(this, arguments)
# Because the expanded properly is not inherited, it is initialized in
# the constructor for every Element.
@ex... | var Element;
module.exports = Element = Node.createVariant({
constructor: function() {
var i, len, prop, propsToCellify, results;
// Call "super" constructor
Node.constructor.apply(this, arguments);
// Because the expanded properly is not inherited, it is initialized in
// the constructor for eve... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 75dc1a1148dcb755fb461a3d189accc66c7e4404 | 1,052 | https://github.com/cdglabs/apparatus/blob/75dc1a1148dcb755fb461a3d189accc66c7e4404/src/Model/Element.coffee | 9 | 58 |
cdglabs/apparatus:src/Model/Element.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Element;
module.exports = Element = Node.createVariant({
constructor: function() {
var i, len, prop, propsToCellify, results;
// Call "super" constructor
Node.constructor.apply(this, arguments);
// Because the expanded properly is not inherit... | module.exports = Element = Node.createVariant
constructor: ->
# Call "super" constructor
Node.constructor.apply(this, arguments)
# Because the expanded properly is not inherited, it is initialized in
# the constructor for every Element.
@expanded = false
# These methods need to be cells beca... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 75dc1a1148dcb755fb461a3d189accc66c7e4404 | 1,052 | https://github.com/cdglabs/apparatus/blob/75dc1a1148dcb755fb461a3d189accc66c7e4404/src/Model/Element.coffee | 9 | 58 |
cdglabs/apparatus:src/Model/Element.coffee:1:completion | completion | module.exports = Element = Node.createVariant
constructor: ->
# Call "super" constructor
Node.constructor.apply(this, arguments)
# Because the expanded properly is not inherited, it is initialized in
# the constructor for every Element.
@expanded = false
# These methods need to be cells beca... | # ===========================================================================
# Getters
# ===========================================================================
childElements: -> @childrenOfType(Element)
variables: -> @childrenOfType(Model.Variable)
components: -> @childrenOfType(Model.Component)
a... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 75dc1a1148dcb755fb461a3d189accc66c7e4404 | 1,052 | https://github.com/cdglabs/apparatus/blob/75dc1a1148dcb755fb461a3d189accc66c7e4404/src/Model/Element.coffee | 9 | 58 |
cdglabs/apparatus:src/Model/Element.coffee:2:raw_corpus | raw_corpus | for childElement in @childElements()
result.push(childElement.descendantElements()...)
return result
descendantAttributes: ->
result = []
for element in @descendantElements()
result.push(element.attributes()...)
return result
# =========================================================... | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 75dc1a1148dcb755fb461a3d189accc66c7e4404 | 1,052 | https://github.com/cdglabs/apparatus/blob/75dc1a1148dcb755fb461a3d189accc66c7e4404/src/Model/Element.coffee | 59 | 108 | ||
cdglabs/apparatus:src/Model/Element.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
for childElement in @childElements()
result.push(childElement.descendantElements()...)
return result
descendantAttributes: ->
result = []
for element in @descendantElements()
result.push(element.attributes()...)
return result
# ... | var childElement, i, len, ref;
ref = this.childElements();
for (i = 0, len = ref.length; i < len; i++) {
childElement = ref[i];
result.push(...childElement.descendantElements());
}
return result;
({
descendantAttributes: function() {
var element, j, len1, ref1, result;
result = [];
ref1 = this.desc... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 75dc1a1148dcb755fb461a3d189accc66c7e4404 | 1,052 | https://github.com/cdglabs/apparatus/blob/75dc1a1148dcb755fb461a3d189accc66c7e4404/src/Model/Element.coffee | 59 | 108 |
cdglabs/apparatus:src/Model/Element.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var childElement, i, len, ref;
ref = this.childElements();
for (i = 0, len = ref.length; i < len; i++) {
childElement = ref[i];
result.push(...childElement.descendantElements());
}
return result;
({
descendantAttributes: function() {
var element, j, le... | for childElement in @childElements()
result.push(childElement.descendantElements()...)
return result
descendantAttributes: ->
result = []
for element in @descendantElements()
result.push(element.attributes()...)
return result
# =========================================================... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 75dc1a1148dcb755fb461a3d189accc66c7e4404 | 1,052 | https://github.com/cdglabs/apparatus/blob/75dc1a1148dcb755fb461a3d189accc66c7e4404/src/Model/Element.coffee | 59 | 108 |
cdglabs/apparatus:src/Model/Element.coffee:2:completion | completion | for childElement in @childElements()
result.push(childElement.descendantElements()...)
return result
descendantAttributes: ->
result = []
for element in @descendantElements()
result.push(element.attributes()...)
return result
# =========================================================... | controlledAttributes: ->
controlledAttributes = []
for controlledAttributeLink in @childrenOfType(Model.ControlledAttributeLink)
attribute = controlledAttributeLink.target()
controlledAttributes.push(attribute)
return controlledAttributes
addControlledAttribute: (attributeToAdd) ->
contro... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 75dc1a1148dcb755fb461a3d189accc66c7e4404 | 1,052 | https://github.com/cdglabs/apparatus/blob/75dc1a1148dcb755fb461a3d189accc66c7e4404/src/Model/Element.coffee | 59 | 108 |
cdglabs/apparatus:src/Model/Element.coffee:3:raw_corpus | raw_corpus | result = []
controlledAttributes = @controlledAttributes()
for attribute in controlledAttributes
result.push(attribute)
result.push(attribute.dependencies()...)
result = _.unique(result)
return result
# A controllable attribute is one which, if changed, would affect my
# geometry. Thus ... | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 75dc1a1148dcb755fb461a3d189accc66c7e4404 | 1,052 | https://github.com/cdglabs/apparatus/blob/75dc1a1148dcb755fb461a3d189accc66c7e4404/src/Model/Element.coffee | 109 | 158 | ||
cdglabs/apparatus:src/Model/Element.coffee:3:completion | completion | result = []
controlledAttributes = @controlledAttributes()
for attribute in controlledAttributes
result.push(attribute)
result.push(attribute.dependencies()...)
result = _.unique(result)
return result
# A controllable attribute is one which, if changed, would affect my
# geometry. Thus ... | # ===========================================================================
# Attributes to change
# ===========================================================================
attributesToChange: ->
attributesToChange = @implicitlyControlledAttributes()
if attributesToChange.length == 0
attribut... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 75dc1a1148dcb755fb461a3d189accc66c7e4404 | 1,052 | https://github.com/cdglabs/apparatus/blob/75dc1a1148dcb755fb461a3d189accc66c7e4404/src/Model/Element.coffee | 109 | 158 |
cdglabs/apparatus:src/Model/Element.coffee:4:raw_corpus | raw_corpus | # ===========================================================================
matrix: ->
matrix = new Util.Matrix()
for transform in @childrenOfType(Model.Transform)
matrix = matrix.compose(transform.matrix())
return matrix
_contextMatrix: ->
parent = @parent()
if parent and parent.isVar... | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 75dc1a1148dcb755fb461a3d189accc66c7e4404 | 1,052 | https://github.com/cdglabs/apparatus/blob/75dc1a1148dcb755fb461a3d189accc66c7e4404/src/Model/Element.coffee | 159 | 204 | ||
cdglabs/apparatus:src/Model/Element.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# ===========================================================================
matrix: ->
matrix = new Util.Matrix()
for transform in @childrenOfType(Model.Transform)
matrix = matrix.compose(transform.matrix())
return matrix
_contextMatrix:... | // ===========================================================================
({
matrix: function() {
var i, len, matrix, ref, transform;
matrix = new Util.Matrix();
ref = this.childrenOfType(Model.Transform);
for (i = 0, len = ref.length; i < len; i++) {
transform = ref[i];
matrix = matr... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 75dc1a1148dcb755fb461a3d189accc66c7e4404 | 1,052 | https://github.com/cdglabs/apparatus/blob/75dc1a1148dcb755fb461a3d189accc66c7e4404/src/Model/Element.coffee | 159 | 204 |
cdglabs/apparatus:src/Model/Element.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// ===========================================================================
({
matrix: function() {
var i, len, matrix, ref, transform;
matrix = new Util.Matrix();
ref = this.childrenOfType(Model.Transform);
for (i = 0, len = ref.length; i < le... | # ===========================================================================
matrix: ->
matrix = new Util.Matrix()
for transform in @childrenOfType(Model.Transform)
matrix = matrix.compose(transform.matrix())
return matrix
_contextMatrix: ->
parent = @parent()
if parent and parent.isVar... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 75dc1a1148dcb755fb461a3d189accc66c7e4404 | 1,052 | https://github.com/cdglabs/apparatus/blob/75dc1a1148dcb755fb461a3d189accc66c7e4404/src/Model/Element.coffee | 159 | 204 |
cdglabs/apparatus:src/Model/Element.coffee:4:completion | completion | # ===========================================================================
matrix: ->
matrix = new Util.Matrix()
for transform in @childrenOfType(Model.Transform)
matrix = matrix.compose(transform.matrix())
return matrix
_contextMatrix: ->
parent = @parent()
if parent and parent.isVar... | _graphic: ->
graphic = new @graphicClass()
spreadEnv = Dataflow.currentSpreadEnv()
graphic.particularElement = new Model.ParticularElement(this, spreadEnv)
graphic.matrix = @accumulatedMatrix()
graphic.components = _.map @components(), (component) ->
component.graphic()
graphic.childGr... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 75dc1a1148dcb755fb461a3d189accc66c7e4404 | 1,052 | https://github.com/cdglabs/apparatus/blob/75dc1a1148dcb755fb461a3d189accc66c7e4404/src/Model/Element.coffee | 159 | 204 |
cdglabs/apparatus:src/Model/Element.coffee:1:raw_corpus | raw_corpus | module.exports = Element = Node.createVariant
constructor: ->
# Call "super" constructor
Node.constructor.apply(this, arguments)
# Because the expanded properly is not inherited, it is initialized in
# this constructor for every Element.
@expanded = false
# TODO: Should more methods be cell'... | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5 | 1,052 | https://github.com/cdglabs/apparatus/blob/6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5/src/Model/Element.coffee | 9 | 58 | ||
cdglabs/apparatus:src/Model/Element.coffee:1:completion | completion | module.exports = Element = Node.createVariant
constructor: ->
# Call "super" constructor
Node.constructor.apply(this, arguments)
# Because the expanded properly is not inherited, it is initialized in
# this constructor for every Element.
@expanded = false
# TODO: Should more methods be cell'... | variables: -> @childrenOfType(Model.Variable)
components: -> @childrenOfType(Model.Component)
attributes: ->
result = []
for variable in @variables()
result.push(variable)
for component in @components()
for attribute in component.attributes()
result.push(attribute)
return resul... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5 | 1,052 | https://github.com/cdglabs/apparatus/blob/6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5/src/Model/Element.coffee | 9 | 58 |
cdglabs/apparatus:src/Model/Element.coffee:2:raw_corpus | raw_corpus | result.push(element.attributes()...)
return result
# ===========================================================================
# Actions
# ===========================================================================
addVariable: ->
variable = Model.Variable.createVariant()
variable.setExpression... | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5 | 1,052 | https://github.com/cdglabs/apparatus/blob/6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5/src/Model/Element.coffee | 59 | 108 | ||
cdglabs/apparatus:src/Model/Element.coffee:2:completion | completion | result.push(element.attributes()...)
return result
# ===========================================================================
# Actions
# ===========================================================================
addVariable: ->
variable = Model.Variable.createVariant()
variable.setExpression... | addControlledAttribute: (attributeToAdd) ->
controlledAttributeLink = Model.ControlledAttributeLink.createVariant()
controlledAttributeLink.setTarget(attributeToAdd)
@addChild(controlledAttributeLink)
removeControlledAttribute: (attributeToRemove) ->
for controlledAttributeLink in @childrenOfType(Mod... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5 | 1,052 | https://github.com/cdglabs/apparatus/blob/6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5/src/Model/Element.coffee | 59 | 108 |
cdglabs/apparatus:src/Model/Element.coffee:3:raw_corpus | raw_corpus | # A controllable attribute is one which, if changed, would affect my
# geometry. Thus all attributes within Transform components, their
# dependencies, as well as all controllable attributes up my parent chain.
controllableAttributes: ->
_.unique(@_controllableAttributes())
_controllableAttributes: ->
r... | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5 | 1,052 | https://github.com/cdglabs/apparatus/blob/6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5/src/Model/Element.coffee | 109 | 158 | ||
cdglabs/apparatus:src/Model/Element.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# A controllable attribute is one which, if changed, would affect my
# geometry. Thus all attributes within Transform components, their
# dependencies, as well as all controllable attributes up my parent chain.
controllableAttributes: ->
_.unique(@_cont... | // A controllable attribute is one which, if changed, would affect my
// geometry. Thus all attributes within Transform components, their
// dependencies, as well as all controllable attributes up my parent chain.
({
controllableAttributes: function() {
return _.unique(this._controllableAttributes());
},
_con... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5 | 1,052 | https://github.com/cdglabs/apparatus/blob/6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5/src/Model/Element.coffee | 109 | 158 |
cdglabs/apparatus:src/Model/Element.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// A controllable attribute is one which, if changed, would affect my
// geometry. Thus all attributes within Transform components, their
// dependencies, as well as all controllable attributes up my parent chain.
({
controllableAttributes: function() {
retur... | # A controllable attribute is one which, if changed, would affect my
# geometry. Thus all attributes within Transform components, their
# dependencies, as well as all controllable attributes up my parent chain.
controllableAttributes: ->
_.unique(@_controllableAttributes())
_controllableAttributes: ->
r... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5 | 1,052 | https://github.com/cdglabs/apparatus/blob/6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5/src/Model/Element.coffee | 109 | 158 |
cdglabs/apparatus:src/Model/Element.coffee:3:completion | completion | # A controllable attribute is one which, if changed, would affect my
# geometry. Thus all attributes within Transform components, their
# dependencies, as well as all controllable attributes up my parent chain.
controllableAttributes: ->
_.unique(@_controllableAttributes())
_controllableAttributes: ->
r... | attributesToChange = @defaultAttributesToChange()
# We can only change numbers.
attributesToChange = _.filter attributesToChange, (attribute) ->
attribute.isNumber()
return attributesToChange
defaultAttributesToChange: ->
result = []
for component in @components()
continue unless co... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5 | 1,052 | https://github.com/cdglabs/apparatus/blob/6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5/src/Model/Element.coffee | 109 | 158 |
cdglabs/apparatus:src/Model/Element.coffee:4:raw_corpus | raw_corpus | _contextMatrix: ->
parent = @parent()
if parent and parent.isVariantOf(Element)
return parent.accumulatedMatrix()
else
return new Util.Matrix()
_accumulatedMatrix: ->
return @contextMatrix().compose(@matrix())
# =========================================================================... | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5 | 1,052 | https://github.com/cdglabs/apparatus/blob/6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5/src/Model/Element.coffee | 159 | 197 | ||
cdglabs/apparatus:src/Model/Element.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_contextMatrix: ->
parent = @parent()
if parent and parent.isVariantOf(Element)
return parent.accumulatedMatrix()
else
return new Util.Matrix()
_accumulatedMatrix: ->
return @contextMatrix().compose(@matrix())
# ================... | ({
_contextMatrix: function() {
var parent;
parent = this.parent();
if (parent && parent.isVariantOf(Element)) {
return parent.accumulatedMatrix();
} else {
return new Util.Matrix();
}
},
_accumulatedMatrix: function() {
return this.contextMatrix().compose(this.matrix());
},
... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5 | 1,052 | https://github.com/cdglabs/apparatus/blob/6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5/src/Model/Element.coffee | 159 | 197 |
cdglabs/apparatus:src/Model/Element.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
_contextMatrix: function() {
var parent;
parent = this.parent();
if (parent && parent.isVariantOf(Element)) {
return parent.accumulatedMatrix();
} else {
return new Util.Matrix();
}
},
_accumulatedMatrix: function() {
re... | _contextMatrix: ->
parent = @parent()
if parent and parent.isVariantOf(Element)
return parent.accumulatedMatrix()
else
return new Util.Matrix()
_accumulatedMatrix: ->
return @contextMatrix().compose(@matrix())
# =========================================================================... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Model/Element.coffee | MIT | 6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5 | 1,052 | https://github.com/cdglabs/apparatus/blob/6e10d01af5d5b37efae0a6e6e3229b87c3ec7de5/src/Model/Element.coffee | 159 | 197 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.