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
jianliaoim/talk-os:talk-web/client/handlers/topic.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript exports.leave = function(leaveEvent) { var _contactId, _roomId, _teamId, _userId, currentRoomId, currentTeamId, generalRoom, roomData, routerData, store, warningText; _teamId = leaveEvent.get('_teamId'); _roomId = leaveEvent.get('_roomId'); _contactId = lea...
exports.leave = (leaveEvent) -> _teamId = leaveEvent.get('_teamId') _roomId = leaveEvent.get('_roomId') _contactId = leaveEvent.get('_userId') store = recorder.getState() _userId = store.getIn ['user', '_id'] routerData = store.getIn ['router', 'data'] roomData = query.topicsByOne(store, _teamId, _roomId...
JavaScript
CoffeeScript
jianliaoim/talk-os
talk-web/client/handlers/topic.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/topic.coffee
33
59
jianliaoim/talk-os:talk-web/client/handlers/topic.coffee:2:completion
completion
exports.leave = (leaveEvent) -> _teamId = leaveEvent.get('_teamId') _roomId = leaveEvent.get('_roomId') _contactId = leaveEvent.get('_userId') store = recorder.getState() _userId = store.getIn ['user', '_id'] routerData = store.getIn ['router', 'data'] roomData = query.topicsByOne(store, _teamId, _roomId...
warningText = lang.getText('removed-from-topic-%s') .replace '%s', roomData.get('topic') notifyActions.warn warningText if roomData.get('isPrivate') and _roomId is currentRoomId generalRoom = query.topicsByOne store, currentTeamId routerHanlders.room currentTeamId, generalRoom.get('_id') # d...
CoffeeScript
CoffeeScript
jianliaoim/talk-os
talk-web/client/handlers/topic.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/topic.coffee
33
59
jianliaoim/talk-os:talk-web/client/handlers/topic.coffee:3:raw_corpus
raw_corpus
exports.archive = (roomData) -> _teamId = roomData.get('_teamId') _roomId = roomData.get('_id') store = recorder.getState() routerData = store.getIn ['router', 'data'] currentTeamId = routerData.get('_teamId') currentRoomId = routerData.get('_roomId') if roomData.get('isArchived') and _teamId is current...
CoffeeScript
jianliaoim/talk-os
talk-web/client/handlers/topic.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/topic.coffee
60
82
jianliaoim/talk-os:talk-web/client/handlers/topic.coffee:3:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript exports.archive = (roomData) -> _teamId = roomData.get('_teamId') _roomId = roomData.get('_id') store = recorder.getState() routerData = store.getIn ['router', 'data'] currentTeamId = routerData.get('_teamId') currentRoomId = routerData.get('_roomId'...
exports.archive = function(roomData) { var _roomId, _teamId, currentRoomId, currentTeamId, generalRoom, routerData, store, warningText; _teamId = roomData.get('_teamId'); _roomId = roomData.get('_id'); store = recorder.getState(); routerData = store.getIn(['router', 'data']); currentTeamId = routerData.get(...
CoffeeScript
JavaScript
jianliaoim/talk-os
talk-web/client/handlers/topic.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/topic.coffee
60
82
jianliaoim/talk-os:talk-web/client/handlers/topic.coffee:3:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript exports.archive = function(roomData) { var _roomId, _teamId, currentRoomId, currentTeamId, generalRoom, routerData, store, warningText; _teamId = roomData.get('_teamId'); _roomId = roomData.get('_id'); store = recorder.getState(); routerData = store.getIn...
exports.archive = (roomData) -> _teamId = roomData.get('_teamId') _roomId = roomData.get('_id') store = recorder.getState() routerData = store.getIn ['router', 'data'] currentTeamId = routerData.get('_teamId') currentRoomId = routerData.get('_roomId') if roomData.get('isArchived') and _teamId is current...
JavaScript
CoffeeScript
jianliaoim/talk-os
talk-web/client/handlers/topic.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/topic.coffee
60
82
jianliaoim/talk-os:talk-web/client/handlers/topic.coffee:3:completion
completion
exports.archive = (roomData) -> _teamId = roomData.get('_teamId') _roomId = roomData.get('_id') store = recorder.getState() routerData = store.getIn ['router', 'data'] currentTeamId = routerData.get('_teamId') currentRoomId = routerData.get('_roomId') if roomData.get('isArchived') and _teamId is current...
.replace '%s', roomData.get('topic') notifyActions.info warningText if currentRoomId is _roomId generalRoom = query.topicsByOne store, currentTeamId routerHanlders.room currentTeamId, generalRoom.get('_id') dispatcher.handleServerAction type: 'topic/archive', data: roomData # http://talk.ci/d...
CoffeeScript
CoffeeScript
jianliaoim/talk-os
talk-web/client/handlers/topic.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/topic.coffee
60
82
jianliaoim/talk-os:talk-web/client/handlers/topic.coffee:4:raw_corpus
raw_corpus
exports.update = (roomData) -> _teamId = roomData.get('_teamId') _roomId = roomData.get('_id') store = recorder.getState() routerData = store.getIn ['router', 'data'] currentTeamId = routerData.get '_teamId' currentRoomId = routerData.get '_roomId' localRoomData = query.topicsByOne store, _teamId, _roomI...
CoffeeScript
jianliaoim/talk-os
talk-web/client/handlers/topic.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/topic.coffee
83
102
jianliaoim/talk-os:talk-web/client/handlers/topic.coffee:4:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript exports.update = (roomData) -> _teamId = roomData.get('_teamId') _roomId = roomData.get('_id') store = recorder.getState() routerData = store.getIn ['router', 'data'] currentTeamId = routerData.get '_teamId' currentRoomId = routerData.get '_roomId' ...
exports.update = function(roomData) { var _roomId, _teamId, currentRoomId, currentTeamId, generalRoom, localRoomData, routerData, store, warningText; _teamId = roomData.get('_teamId'); _roomId = roomData.get('_id'); store = recorder.getState(); routerData = store.getIn(['router', 'data']); currentTeamId = r...
CoffeeScript
JavaScript
jianliaoim/talk-os
talk-web/client/handlers/topic.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/topic.coffee
83
102
jianliaoim/talk-os:talk-web/client/handlers/topic.coffee:4:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript exports.update = function(roomData) { var _roomId, _teamId, currentRoomId, currentTeamId, generalRoom, localRoomData, routerData, store, warningText; _teamId = roomData.get('_teamId'); _roomId = roomData.get('_id'); store = recorder.getState(); routerData...
exports.update = (roomData) -> _teamId = roomData.get('_teamId') _roomId = roomData.get('_id') store = recorder.getState() routerData = store.getIn ['router', 'data'] currentTeamId = routerData.get '_teamId' currentRoomId = routerData.get '_roomId' localRoomData = query.topicsByOne store, _teamId, _roomI...
JavaScript
CoffeeScript
jianliaoim/talk-os
talk-web/client/handlers/topic.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/topic.coffee
83
102
jianliaoim/talk-os:talk-web/client/handlers/topic.coffee:4:completion
completion
exports.update = (roomData) -> _teamId = roomData.get('_teamId') _roomId = roomData.get('_id') store = recorder.getState() routerData = store.getIn ['router', 'data'] currentTeamId = routerData.get '_teamId' currentRoomId = routerData.get '_roomId' localRoomData = query.topicsByOne store, _teamId, _roomI...
if roomData.get('isPrivate') and not detect.inChannel(localRoomData) and currentRoomId is _roomId generalRoom = query.topicsByOne store, currentTeamId routerHanlders.room currentTeamId, generalRoom.get('_id') warningText = lang.getText('topic-%s-changed-private') .replace '%s', roomData.get('topic') ...
CoffeeScript
CoffeeScript
jianliaoim/talk-os
talk-web/client/handlers/topic.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/topic.coffee
83
102
linemanjs/lineman:test/spec-unit/lib/pretty-prints-value-spec.coffee:1:raw_corpus
raw_corpus
describe "prettyPrintsValue", -> Given -> @subject = requireSubject("lib/pretty-prints-value") describe ".prettyPrint", -> Then -> @subject.prettyPrint("blah") == "blah" Then -> @subject.prettyPrint(true) == "true" Then -> @subject.prettyPrint(false) == "false" Then -> @subject.prettyPrint(39) == "...
CoffeeScript
linemanjs/lineman
test/spec-unit/lib/pretty-prints-value-spec.coffee
MIT
61d681532d9621e578d319c279006bbb728ece4b
1,168
https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-unit/lib/pretty-prints-value-spec.coffee
1
33
linemanjs/lineman:test/spec-unit/lib/pretty-prints-value-spec.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript describe "prettyPrintsValue", -> Given -> @subject = requireSubject("lib/pretty-prints-value") describe ".prettyPrint", -> Then -> @subject.prettyPrint("blah") == "blah" Then -> @subject.prettyPrint(true) == "true" Then -> @subject.prettyPrint(fa...
describe("prettyPrintsValue", function() { Given(function() { return this.subject = requireSubject("lib/pretty-prints-value"); }); return describe(".prettyPrint", function() { Then(function() { return this.subject.prettyPrint("blah") === "blah"; }); Then(function() { return this.subjec...
CoffeeScript
JavaScript
linemanjs/lineman
test/spec-unit/lib/pretty-prints-value-spec.coffee
MIT
61d681532d9621e578d319c279006bbb728ece4b
1,168
https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-unit/lib/pretty-prints-value-spec.coffee
1
33
linemanjs/lineman:test/spec-unit/lib/pretty-prints-value-spec.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript describe("prettyPrintsValue", function() { Given(function() { return this.subject = requireSubject("lib/pretty-prints-value"); }); return describe(".prettyPrint", function() { Then(function() { return this.subject.prettyPrint("blah") === "blah";...
describe "prettyPrintsValue", -> Given -> @subject = requireSubject("lib/pretty-prints-value") describe ".prettyPrint", -> Then -> @subject.prettyPrint("blah") == "blah" Then -> @subject.prettyPrint(true) == "true" Then -> @subject.prettyPrint(false) == "false" Then -> @subject.prettyPrint(39) == "...
JavaScript
CoffeeScript
linemanjs/lineman
test/spec-unit/lib/pretty-prints-value-spec.coffee
MIT
61d681532d9621e578d319c279006bbb728ece4b
1,168
https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-unit/lib/pretty-prints-value-spec.coffee
1
33
linemanjs/lineman:test/spec-unit/lib/pretty-prints-value-spec.coffee:1:completion
completion
describe "prettyPrintsValue", -> Given -> @subject = requireSubject("lib/pretty-prints-value") describe ".prettyPrint", -> Then -> @subject.prettyPrint("blah") == "blah" Then -> @subject.prettyPrint(true) == "true" Then -> @subject.prettyPrint(false) == "false" Then -> @subject.prettyPrint(39) == "...
} } """ describe "doesn't omit function properties", -> Then -> expect(@subject.prettyPrint({f: ->})).toEqual """ { "f": "[Function]" } """ describe "catch on cyclical exceptions and revert to default object", -> Given -> @foo = a: 'b' Given -> @bar = fo...
CoffeeScript
CoffeeScript
linemanjs/lineman
test/spec-unit/lib/pretty-prints-value-spec.coffee
MIT
61d681532d9621e578d319c279006bbb728ece4b
1,168
https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-unit/lib/pretty-prints-value-spec.coffee
1
33
linemanjs/lineman:test/spec-unit/lib/pretty-prints-value-spec.coffee:1:raw_corpus
raw_corpus
describe "prettyPrintsValue", -> Given -> @subject = requireSubject("lib/pretty-prints-value") describe ".prettyPrint", -> Then -> @subject.prettyPrint(true) == "true" Then -> @subject.prettyPrint(false) == "false" Then -> @subject.prettyPrint(39) == "39" Then -> @subject.prettyPrint(undefined) == ...
CoffeeScript
linemanjs/lineman
test/spec-unit/lib/pretty-prints-value-spec.coffee
MIT
57dbe59a6ecac6ffb17b1cc8ea753c8ed5095759
1,168
https://github.com/linemanjs/lineman/blob/57dbe59a6ecac6ffb17b1cc8ea753c8ed5095759/test/spec-unit/lib/pretty-prints-value-spec.coffee
1
32
linemanjs/lineman:test/spec-unit/lib/pretty-prints-value-spec.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript describe "prettyPrintsValue", -> Given -> @subject = requireSubject("lib/pretty-prints-value") describe ".prettyPrint", -> Then -> @subject.prettyPrint(true) == "true" Then -> @subject.prettyPrint(false) == "false" Then -> @subject.prettyPrint(39...
describe("prettyPrintsValue", function() { Given(function() { return this.subject = requireSubject("lib/pretty-prints-value"); }); return describe(".prettyPrint", function() { Then(function() { return this.subject.prettyPrint(true) === "true"; }); Then(function() { return this.subject....
CoffeeScript
JavaScript
linemanjs/lineman
test/spec-unit/lib/pretty-prints-value-spec.coffee
MIT
57dbe59a6ecac6ffb17b1cc8ea753c8ed5095759
1,168
https://github.com/linemanjs/lineman/blob/57dbe59a6ecac6ffb17b1cc8ea753c8ed5095759/test/spec-unit/lib/pretty-prints-value-spec.coffee
1
32
linemanjs/lineman:test/spec-unit/lib/pretty-prints-value-spec.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript describe("prettyPrintsValue", function() { Given(function() { return this.subject = requireSubject("lib/pretty-prints-value"); }); return describe(".prettyPrint", function() { Then(function() { return this.subject.prettyPrint(true) === "true"; ...
describe "prettyPrintsValue", -> Given -> @subject = requireSubject("lib/pretty-prints-value") describe ".prettyPrint", -> Then -> @subject.prettyPrint(true) == "true" Then -> @subject.prettyPrint(false) == "false" Then -> @subject.prettyPrint(39) == "39" Then -> @subject.prettyPrint(undefined) == ...
JavaScript
CoffeeScript
linemanjs/lineman
test/spec-unit/lib/pretty-prints-value-spec.coffee
MIT
57dbe59a6ecac6ffb17b1cc8ea753c8ed5095759
1,168
https://github.com/linemanjs/lineman/blob/57dbe59a6ecac6ffb17b1cc8ea753c8ed5095759/test/spec-unit/lib/pretty-prints-value-spec.coffee
1
32
linemanjs/lineman:test/spec-unit/lib/pretty-prints-value-spec.coffee:1:completion
completion
describe "prettyPrintsValue", -> Given -> @subject = requireSubject("lib/pretty-prints-value") describe ".prettyPrint", -> Then -> @subject.prettyPrint(true) == "true" Then -> @subject.prettyPrint(false) == "false" Then -> @subject.prettyPrint(39) == "39" Then -> @subject.prettyPrint(undefined) == ...
} """ describe "doesn't omit function properties", -> Then -> expect(@subject.prettyPrint({f: ->})).toEqual """ { "f": "[Function]" } """ describe "catch on cyclical exceptions and revert to default object", -> Given -> @foo = a: 'b' Given -> @bar = foo: @foo ...
CoffeeScript
CoffeeScript
linemanjs/lineman
test/spec-unit/lib/pretty-prints-value-spec.coffee
MIT
57dbe59a6ecac6ffb17b1cc8ea753c8ed5095759
1,168
https://github.com/linemanjs/lineman/blob/57dbe59a6ecac6ffb17b1cc8ea753c8ed5095759/test/spec-unit/lib/pretty-prints-value-spec.coffee
1
32
linemanjs/lineman:test/spec-unit/lib/pretty-prints-value-spec.coffee:1:raw_corpus
raw_corpus
describe "prettyPrintsValue", -> Given -> @subject = requireSubject("lib/pretty-prints-value") describe ".prettyPrint", -> Then -> @subject.prettyPrint("blah") == "blah" Then -> @subject.prettyPrint(true) == true Then -> @subject.prettyPrint(false) == false Then -> @subject.prettyPrint(39) == 39 ...
CoffeeScript
linemanjs/lineman
test/spec-unit/lib/pretty-prints-value-spec.coffee
MIT
5d2138d91b1fb9c079e668b02683356f40c4e449
1,168
https://github.com/linemanjs/lineman/blob/5d2138d91b1fb9c079e668b02683356f40c4e449/test/spec-unit/lib/pretty-prints-value-spec.coffee
1
33
linemanjs/lineman:test/spec-unit/lib/pretty-prints-value-spec.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript describe "prettyPrintsValue", -> Given -> @subject = requireSubject("lib/pretty-prints-value") describe ".prettyPrint", -> Then -> @subject.prettyPrint("blah") == "blah" Then -> @subject.prettyPrint(true) == true Then -> @subject.prettyPrint(fals...
describe("prettyPrintsValue", function() { Given(function() { return this.subject = requireSubject("lib/pretty-prints-value"); }); return describe(".prettyPrint", function() { Then(function() { return this.subject.prettyPrint("blah") === "blah"; }); Then(function() { return this.subjec...
CoffeeScript
JavaScript
linemanjs/lineman
test/spec-unit/lib/pretty-prints-value-spec.coffee
MIT
5d2138d91b1fb9c079e668b02683356f40c4e449
1,168
https://github.com/linemanjs/lineman/blob/5d2138d91b1fb9c079e668b02683356f40c4e449/test/spec-unit/lib/pretty-prints-value-spec.coffee
1
33
linemanjs/lineman:test/spec-unit/lib/pretty-prints-value-spec.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript describe("prettyPrintsValue", function() { Given(function() { return this.subject = requireSubject("lib/pretty-prints-value"); }); return describe(".prettyPrint", function() { Then(function() { return this.subject.prettyPrint("blah") === "blah";...
describe "prettyPrintsValue", -> Given -> @subject = requireSubject("lib/pretty-prints-value") describe ".prettyPrint", -> Then -> @subject.prettyPrint("blah") == "blah" Then -> @subject.prettyPrint(true) == true Then -> @subject.prettyPrint(false) == false Then -> @subject.prettyPrint(39) == 39 ...
JavaScript
CoffeeScript
linemanjs/lineman
test/spec-unit/lib/pretty-prints-value-spec.coffee
MIT
5d2138d91b1fb9c079e668b02683356f40c4e449
1,168
https://github.com/linemanjs/lineman/blob/5d2138d91b1fb9c079e668b02683356f40c4e449/test/spec-unit/lib/pretty-prints-value-spec.coffee
1
33
linemanjs/lineman:test/spec-unit/lib/pretty-prints-value-spec.coffee:1:completion
completion
describe "prettyPrintsValue", -> Given -> @subject = requireSubject("lib/pretty-prints-value") describe ".prettyPrint", -> Then -> @subject.prettyPrint("blah") == "blah" Then -> @subject.prettyPrint(true) == true Then -> @subject.prettyPrint(false) == false Then -> @subject.prettyPrint(39) == 39 ...
} } """ describe "doesn't omit function properties", -> Then -> expect(@subject.prettyPrint({f: ->})).toEqual """ { "f": "[Function]" } """ describe "catch on cyclical exceptions and revert to default object", -> Given -> @foo = a: 'b' Given -> @bar = fo...
CoffeeScript
CoffeeScript
linemanjs/lineman
test/spec-unit/lib/pretty-prints-value-spec.coffee
MIT
5d2138d91b1fb9c079e668b02683356f40c4e449
1,168
https://github.com/linemanjs/lineman/blob/5d2138d91b1fb9c079e668b02683356f40c4e449/test/spec-unit/lib/pretty-prints-value-spec.coffee
1
33
linemanjs/lineman:test/spec-unit/lib/pretty-prints-value-spec.coffee:1:raw_corpus
raw_corpus
describe "prettyPrintsValue", -> Given -> @subject = requireSubject("lib/pretty-prints-value") describe ".prettyPrint", -> Then -> @subject.prettyPrint("blah") == "blah" Then -> @subject.prettyPrint(true) == true Then -> @subject.prettyPrint(false) == false Then -> @subject.prettyPrint(39) == 39 ...
CoffeeScript
linemanjs/lineman
test/spec-unit/lib/pretty-prints-value-spec.coffee
MIT
539444b831eb941c7411035198b815bfd421690c
1,168
https://github.com/linemanjs/lineman/blob/539444b831eb941c7411035198b815bfd421690c/test/spec-unit/lib/pretty-prints-value-spec.coffee
1
26
linemanjs/lineman:test/spec-unit/lib/pretty-prints-value-spec.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript describe "prettyPrintsValue", -> Given -> @subject = requireSubject("lib/pretty-prints-value") describe ".prettyPrint", -> Then -> @subject.prettyPrint("blah") == "blah" Then -> @subject.prettyPrint(true) == true Then -> @subject.prettyPrint(fals...
describe("prettyPrintsValue", function() { Given(function() { return this.subject = requireSubject("lib/pretty-prints-value"); }); return describe(".prettyPrint", function() { Then(function() { return this.subject.prettyPrint("blah") === "blah"; }); Then(function() { return this.subjec...
CoffeeScript
JavaScript
linemanjs/lineman
test/spec-unit/lib/pretty-prints-value-spec.coffee
MIT
539444b831eb941c7411035198b815bfd421690c
1,168
https://github.com/linemanjs/lineman/blob/539444b831eb941c7411035198b815bfd421690c/test/spec-unit/lib/pretty-prints-value-spec.coffee
1
26
linemanjs/lineman:test/spec-unit/lib/pretty-prints-value-spec.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript describe("prettyPrintsValue", function() { Given(function() { return this.subject = requireSubject("lib/pretty-prints-value"); }); return describe(".prettyPrint", function() { Then(function() { return this.subject.prettyPrint("blah") === "blah";...
describe "prettyPrintsValue", -> Given -> @subject = requireSubject("lib/pretty-prints-value") describe ".prettyPrint", -> Then -> @subject.prettyPrint("blah") == "blah" Then -> @subject.prettyPrint(true) == true Then -> @subject.prettyPrint(false) == false Then -> @subject.prettyPrint(39) == 39 ...
JavaScript
CoffeeScript
linemanjs/lineman
test/spec-unit/lib/pretty-prints-value-spec.coffee
MIT
539444b831eb941c7411035198b815bfd421690c
1,168
https://github.com/linemanjs/lineman/blob/539444b831eb941c7411035198b815bfd421690c/test/spec-unit/lib/pretty-prints-value-spec.coffee
1
26
linemanjs/lineman:test/spec-unit/lib/pretty-prints-value-spec.coffee:1:completion
completion
describe "prettyPrintsValue", -> Given -> @subject = requireSubject("lib/pretty-prints-value") describe ".prettyPrint", -> Then -> @subject.prettyPrint("blah") == "blah" Then -> @subject.prettyPrint(true) == true Then -> @subject.prettyPrint(false) == false Then -> @subject.prettyPrint(39) == 39 ...
"baz": "biz", "nest": { "wow": 18 } } """ describe "catch on cyclical exceptions and revert to default object", -> Given -> @foo = a: 'b' Given -> @bar = foo: @foo Given -> @foo.bar = @bar When -> @result = @subject.prettyPrint(@foo) Then -> @resu...
CoffeeScript
CoffeeScript
linemanjs/lineman
test/spec-unit/lib/pretty-prints-value-spec.coffee
MIT
539444b831eb941c7411035198b815bfd421690c
1,168
https://github.com/linemanjs/lineman/blob/539444b831eb941c7411035198b815bfd421690c/test/spec-unit/lib/pretty-prints-value-spec.coffee
1
26
soyjavi/QuoJS:spec/core.coffee:1:raw_corpus
raw_corpus
describe "Core", -> # User = undefined # beforeEach -> # User = Monocle.Module.create() it "is healthy", -> expect(Quo).toBeTruthy() expect($$).toBeTruthy()
CoffeeScript
soyjavi/QuoJS
spec/core.coffee
MIT
9be6e3f2fe1072145236b0f111b4f6431ba2376b
2,055
https://github.com/soyjavi/QuoJS/blob/9be6e3f2fe1072145236b0f111b4f6431ba2376b/spec/core.coffee
1
9
soyjavi/QuoJS:spec/core.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript describe "Core", -> # User = undefined # beforeEach -> # User = Monocle.Module.create() it "is healthy", -> expect(Quo).toBeTruthy() expect($$).toBeTruthy() ```
describe("Core", function() { // User = undefined // beforeEach -> // User = Monocle.Module.create() return it("is healthy", function() { expect(Quo).toBeTruthy(); return expect($$).toBeTruthy(); }); });
CoffeeScript
JavaScript
soyjavi/QuoJS
spec/core.coffee
MIT
9be6e3f2fe1072145236b0f111b4f6431ba2376b
2,055
https://github.com/soyjavi/QuoJS/blob/9be6e3f2fe1072145236b0f111b4f6431ba2376b/spec/core.coffee
1
9
soyjavi/QuoJS:spec/core.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript describe("Core", function() { // User = undefined // beforeEach -> // User = Monocle.Module.create() return it("is healthy", function() { expect(Quo).toBeTruthy(); return expect($$).toBeTruthy(); }); }); ```
describe "Core", -> # User = undefined # beforeEach -> # User = Monocle.Module.create() it "is healthy", -> expect(Quo).toBeTruthy() expect($$).toBeTruthy()
JavaScript
CoffeeScript
soyjavi/QuoJS
spec/core.coffee
MIT
9be6e3f2fe1072145236b0f111b4f6431ba2376b
2,055
https://github.com/soyjavi/QuoJS/blob/9be6e3f2fe1072145236b0f111b4f6431ba2376b/spec/core.coffee
1
9
soyjavi/QuoJS:spec/core.coffee:1:completion
completion
describe "Core", -> # User = undefined # beforeEach ->
# User = Monocle.Module.create() it "is healthy", -> expect(Quo).toBeTruthy() expect($$).toBeTruthy()
CoffeeScript
CoffeeScript
soyjavi/QuoJS
spec/core.coffee
MIT
9be6e3f2fe1072145236b0f111b4f6431ba2376b
2,055
https://github.com/soyjavi/QuoJS/blob/9be6e3f2fe1072145236b0f111b4f6431ba2376b/spec/core.coffee
1
9
jsdf/coffee-react-transform:test/react.coffee:1:raw_corpus
raw_corpus
# react mock for tests elements = require '../src/htmlelements' makeEl = (name) -> (children) -> type: name, children: children, render: -> module.exports = createClass: (cl) -> (props) -> type: cl, props: props renderComponent: (cls) -> component = Object.create cls component.props = cls.props component...
CoffeeScript
jsdf/coffee-react-transform
test/react.coffee
MIT
b645e4fd692cc9e22d0362ffe4c153813d25054a
431
https://github.com/jsdf/coffee-react-transform/blob/b645e4fd692cc9e22d0362ffe4c153813d25054a/test/react.coffee
1
21
jsdf/coffee-react-transform:test/react.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript # react mock for tests elements = require '../src/htmlelements' makeEl = (name) -> (children) -> type: name, children: children, render: -> module.exports = createClass: (cl) -> (props) -> type: cl, props: props renderComponent: (cls) -> component = Ob...
// react mock for tests var elements, makeEl; elements = require('../src/htmlelements'); makeEl = function(name) { return function(children) { return { type: name, children: children, render: function() {} }; }; }; module.exports = { createClass: function(cl) { return function(pro...
CoffeeScript
JavaScript
jsdf/coffee-react-transform
test/react.coffee
MIT
b645e4fd692cc9e22d0362ffe4c153813d25054a
431
https://github.com/jsdf/coffee-react-transform/blob/b645e4fd692cc9e22d0362ffe4c153813d25054a/test/react.coffee
1
21
jsdf/coffee-react-transform:test/react.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript // react mock for tests var elements, makeEl; elements = require('../src/htmlelements'); makeEl = function(name) { return function(children) { return { type: name, children: children, render: function() {} }; }; }; module.exports = ...
# react mock for tests elements = require '../src/htmlelements' makeEl = (name) -> (children) -> type: name, children: children, render: -> module.exports = createClass: (cl) -> (props) -> type: cl, props: props renderComponent: (cls) -> component = Object.create cls component.props = cls.props component...
JavaScript
CoffeeScript
jsdf/coffee-react-transform
test/react.coffee
MIT
b645e4fd692cc9e22d0362ffe4c153813d25054a
431
https://github.com/jsdf/coffee-react-transform/blob/b645e4fd692cc9e22d0362ffe4c153813d25054a/test/react.coffee
1
21
jsdf/coffee-react-transform:test/react.coffee:1:completion
completion
# react mock for tests elements = require '../src/htmlelements' makeEl = (name) -> (children) -> type: name, children: children, render: -> module.exports = createClass: (cl) -> (props) -> type: cl, props: props
renderComponent: (cls) -> component = Object.create cls component.props = cls.props component.render() DOM: do -> dom = {} for name, val of elements dom[name] = makeEl name dom
CoffeeScript
CoffeeScript
jsdf/coffee-react-transform
test/react.coffee
MIT
b645e4fd692cc9e22d0362ffe4c153813d25054a
431
https://github.com/jsdf/coffee-react-transform/blob/b645e4fd692cc9e22d0362ffe4c153813d25054a/test/react.coffee
1
21
nevir/groc:lib/utils.coffee:1:raw_corpus
raw_corpus
# Miscellaneous code fragments reside here. Utils = # Detect and return the language that a given file is written in. # # The language is also annotated with a name property, matching the laguages key in LANGUAGES. getLanguage: (filePath) -> unless @_languageDetectionCache? @_languageDetectionCache = ...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9b38ac3601e667fd245bbb1d57df7b20df7f2ab5
579
https://github.com/nevir/groc/blob/9b38ac3601e667fd245bbb1d57df7b20df7f2ab5/lib/utils.coffee
1
42
nevir/groc:lib/utils.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript # Miscellaneous code fragments reside here. Utils = # Detect and return the language that a given file is written in. # # The language is also annotated with a name property, matching the laguages key in LANGUAGES. getLanguage: (filePath) -> unless @_...
// Miscellaneous code fragments reside here. var Utils; Utils = { // Detect and return the language that a given file is written in. // The language is also annotated with a name property, matching the laguages key in LANGUAGES. getLanguage: function(filePath) { var baseName, i, j, language, len, len1, matc...
CoffeeScript
JavaScript
nevir/groc
lib/utils.coffee
MIT
9b38ac3601e667fd245bbb1d57df7b20df7f2ab5
579
https://github.com/nevir/groc/blob/9b38ac3601e667fd245bbb1d57df7b20df7f2ab5/lib/utils.coffee
1
42
nevir/groc:lib/utils.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript // Miscellaneous code fragments reside here. var Utils; Utils = { // Detect and return the language that a given file is written in. // The language is also annotated with a name property, matching the laguages key in LANGUAGES. getLanguage: function(filePa...
# Miscellaneous code fragments reside here. Utils = # Detect and return the language that a given file is written in. # # The language is also annotated with a name property, matching the laguages key in LANGUAGES. getLanguage: (filePath) -> unless @_languageDetectionCache? @_languageDetectionCache = ...
JavaScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9b38ac3601e667fd245bbb1d57df7b20df7f2ab5
579
https://github.com/nevir/groc/blob/9b38ac3601e667fd245bbb1d57df7b20df7f2ab5/lib/utils.coffee
1
42
nevir/groc:lib/utils.coffee:1:completion
completion
# Miscellaneous code fragments reside here. Utils = # Detect and return the language that a given file is written in. # # The language is also annotated with a name property, matching the laguages key in LANGUAGES. getLanguage: (filePath) -> unless @_languageDetectionCache? @_languageDetectionCache = ...
mapFiles: (resolveRoot, files, stripPrefixes) -> # Ensure that we're dealing with absolute paths across the board files = files.map (f) -> path.resolve resolveRoot, f # And that the strip prefixes all end with a /, to avoid a target path being absolute. stripPrefixes = stripPrefixes.map (p) -> "#{path.r...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9b38ac3601e667fd245bbb1d57df7b20df7f2ab5
579
https://github.com/nevir/groc/blob/9b38ac3601e667fd245bbb1d57df7b20df7f2ab5/lib/utils.coffee
1
42
nevir/groc:lib/utils.coffee:2:raw_corpus
raw_corpus
result # Attempt to guess strip prefixes for a given set of arguments. guessStripPrefixes: (arguments) -> result = [] for arg in arguments # Most globs look something like dir/**/*.ext, so strip up to the leading * arg = arg.replace /\*.*$/, '' result.push arg if arg.slice(-1) == '/' ...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9b38ac3601e667fd245bbb1d57df7b20df7f2ab5
579
https://github.com/nevir/groc/blob/9b38ac3601e667fd245bbb1d57df7b20df7f2ab5/lib/utils.coffee
44
85
nevir/groc:lib/utils.coffee:2:completion
completion
result # Attempt to guess strip prefixes for a given set of arguments. guessStripPrefixes: (arguments) -> result = [] for arg in arguments # Most globs look something like dir/**/*.ext, so strip up to the leading * arg = arg.replace /\*.*$/, '' result.push arg if arg.slice(-1) == '/' ...
splitSource: (data, language) -> lines = data.split /\r?\n/ # Always strip shebangs - but don't shift it off the array to avoid the perf hit of walking the # array to update indices. lines[0] = '' if lines[0][0..1] == '#!' # Special case: If the language is comments-only, we can skip pygments ...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9b38ac3601e667fd245bbb1d57df7b20df7f2ab5
579
https://github.com/nevir/groc/blob/9b38ac3601e667fd245bbb1d57df7b20df7f2ab5/lib/utils.coffee
44
85
nevir/groc:lib/utils.coffee:3:raw_corpus
raw_corpus
currSegment.comments.push match[2] else currSegment.code.push line segments.push currSegment segments # Just a convenient prototype for building segments Segment: class Segment constructor: (code=[], comments=[]) -> @code = code @comments = comments # Annotate an array...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9b38ac3601e667fd245bbb1d57df7b20df7f2ab5
579
https://github.com/nevir/groc/blob/9b38ac3601e667fd245bbb1d57df7b20df7f2ab5/lib/utils.coffee
87
126
nevir/groc:lib/utils.coffee:3:completion
completion
currSegment.comments.push match[2] else currSegment.code.push line segments.push currSegment segments # Just a convenient prototype for building segments Segment: class Segment constructor: (code=[], comments=[]) -> @code = code @comments = comments # Annotate an array...
return callback() pygmentize = childProcess.spawn 'pygmentize', [ '-l', language.pygmentsLexer '-f', 'html' '-O', 'encoding=utf-8,tabsize=2' ] pygmentize.stderr.addListener 'data', (data) -> callback data.toString() pygmentize.stdin.addListener 'error', (error) -> callback error ...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9b38ac3601e667fd245bbb1d57df7b20df7f2ab5
579
https://github.com/nevir/groc/blob/9b38ac3601e667fd245bbb1d57df7b20df7f2ab5/lib/utils.coffee
87
126
nevir/groc:lib/utils.coffee:4:raw_corpus
raw_corpus
pygmentize.addListener 'exit', (args...) => # pygments spits it out wrapped in <div class="highlight"><pre>...</pre></div>. We want to # manage the styling ourselves, so remove that. result = result.replace('<div class="highlight"><pre>', '').replace('</pre></div>', '') # Extract our segments f...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9b38ac3601e667fd245bbb1d57df7b20df7f2ab5
579
https://github.com/nevir/groc/blob/9b38ac3601e667fd245bbb1d57df7b20df7f2ab5/lib/utils.coffee
128
168
nevir/groc:lib/utils.coffee:4:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript pygmentize.addListener 'exit', (args...) => # pygments spits it out wrapped in <div class="highlight"><pre>...</pre></div>. We want to # manage the styling ourselves, so remove that. result = result.replace('<div class="highlight"><pre>', '').r...
var s; pygmentize.addListener('exit', (...args) => { var error, highlighted, i, j, len, result, segment; // pygments spits it out wrapped in <div class="highlight"><pre>...</pre></div>. We want to // manage the styling ourselves, so remove that. result = result.replace('<div class="highlight"><pre>', '').repl...
CoffeeScript
JavaScript
nevir/groc
lib/utils.coffee
MIT
9b38ac3601e667fd245bbb1d57df7b20df7f2ab5
579
https://github.com/nevir/groc/blob/9b38ac3601e667fd245bbb1d57df7b20df7f2ab5/lib/utils.coffee
128
168
nevir/groc:lib/utils.coffee:4:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var s; pygmentize.addListener('exit', (...args) => { var error, highlighted, i, j, len, result, segment; // pygments spits it out wrapped in <div class="highlight"><pre>...</pre></div>. We want to // manage the styling ourselves, so remove that. result = ...
pygmentize.addListener 'exit', (args...) => # pygments spits it out wrapped in <div class="highlight"><pre>...</pre></div>. We want to # manage the styling ourselves, so remove that. result = result.replace('<div class="highlight"><pre>', '').replace('</pre></div>', '') # Extract our segments f...
JavaScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9b38ac3601e667fd245bbb1d57df7b20df7f2ab5
579
https://github.com/nevir/groc/blob/9b38ac3601e667fd245bbb1d57df7b20df7f2ab5/lib/utils.coffee
128
168
nevir/groc:lib/utils.coffee:4:completion
completion
pygmentize.addListener 'exit', (args...) => # pygments spits it out wrapped in <div class="highlight"><pre>...</pre></div>. We want to # manage the styling ourselves, so remove that. result = result.replace('<div class="highlight"><pre>', '').replace('</pre></div>', '') # Extract our segments f...
# pygmentize does not stream, so we need delimeters pygmentize.stdin.write (s.code.join "\n" for s in segments).join segmentDivider pygmentize.stdin.end() # Annotate an array of segments by running their comments through # [showdown](https://github.com/coreyti/showdown). markdownComments: (segments, proj...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9b38ac3601e667fd245bbb1d57df7b20df7f2ab5
579
https://github.com/nevir/groc/blob/9b38ac3601e667fd245bbb1d57df7b20df7f2ab5/lib/utils.coffee
128
168
nevir/groc:lib/utils.coffee:5:raw_corpus
raw_corpus
header.isFileHeader = true if header.level == 1 && segmentIndex == 0 && match.index == 0 headers.push header "<h#{header.level} id=\"#{header.slug}\">#{header.title}</h#{header.level}>" # We attach the rendered markdown to the comment segment.markdownedComments = markdown ...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9b38ac3601e667fd245bbb1d57df7b20df7f2ab5
579
https://github.com/nevir/groc/blob/9b38ac3601e667fd245bbb1d57df7b20df7f2ab5/lib/utils.coffee
170
207
nevir/groc:lib/utils.coffee:5:completion
completion
header.isFileHeader = true if header.level == 1 && segmentIndex == 0 && match.index == 0 headers.push header "<h#{header.level} id=\"#{header.slug}\">#{header.title}</h#{header.level}>" # We attach the rendered markdown to the comment segment.markdownedComments = markdown ...
# Given a title, convert it into a URL-friendly slug. slugifyTitle: (string) -> string.split(/[\s\-\_]+/).map( (s) -> s.replace(/[^\w]/g, '').toLowerCase() ).join '-' # replacer is a function that is given the match object, and returns the string to replace with. gsub: (string, matcher, replacer) -> thro...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9b38ac3601e667fd245bbb1d57df7b20df7f2ab5
579
https://github.com/nevir/groc/blob/9b38ac3601e667fd245bbb1d57df7b20df7f2ab5/lib/utils.coffee
170
207
nevir/groc:lib/utils.coffee:5:raw_corpus
raw_corpus
header.isFileHeader = true if header.level == 1 && segmentIndex == 0 && match.index == 0 headers.push header "<h#{header.level} id=\"#{header.slug}\">#{header.title}</h#{header.level}>" # We attach the rendered markdown to the comment segment.markdownedComments = markdown ...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
e2d2229cac05e6ef5625b636587ca61e21edc288
579
https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/utils.coffee
170
207
nevir/groc:lib/utils.coffee:5:completion
completion
header.isFileHeader = true if header.level == 1 && segmentIndex == 0 && match.index == 0 headers.push header "<h#{header.level} id=\"#{header.slug}\">#{header.title}</h#{header.level}>" # We attach the rendered markdown to the comment segment.markdownedComments = markdown ...
# Given a title, convert it into a URL-friendly slug. slugifyTitle: (string) -> string.split(/\s+/).map( (s) -> s.replace(/[^\w]/g, '').toLowerCase() ).join '-' # replacer is a function that is given the match object, and returns the string to replace with. gsub: (string, matcher, replacer) -> throw new ...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
e2d2229cac05e6ef5625b636587ca61e21edc288
579
https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/utils.coffee
170
207
nevir/groc:lib/utils.coffee:1:raw_corpus
raw_corpus
# Miscellaneous code fragments reside here. Utils = # Detect and return the language that a given file is written in. # # The language is also annotated with a name property, matching the laguages key in LANGUAGES. getLanguage: (filePath) -> unless @_languageDetectionCache? @_languageDetectionCache = ...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
1
39
nevir/groc:lib/utils.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript # Miscellaneous code fragments reside here. Utils = # Detect and return the language that a given file is written in. # # The language is also annotated with a name property, matching the laguages key in LANGUAGES. getLanguage: (filePath) -> unless @_...
// Miscellaneous code fragments reside here. var Utils; Utils = { // Detect and return the language that a given file is written in. // The language is also annotated with a name property, matching the laguages key in LANGUAGES. getLanguage: function(filePath) { var baseName, i, j, language, len, len1, matc...
CoffeeScript
JavaScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
1
39
nevir/groc:lib/utils.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript // Miscellaneous code fragments reside here. var Utils; Utils = { // Detect and return the language that a given file is written in. // The language is also annotated with a name property, matching the laguages key in LANGUAGES. getLanguage: function(filePa...
# Miscellaneous code fragments reside here. Utils = # Detect and return the language that a given file is written in. # # The language is also annotated with a name property, matching the laguages key in LANGUAGES. getLanguage: (filePath) -> unless @_languageDetectionCache? @_languageDetectionCache = ...
JavaScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
1
39
nevir/groc:lib/utils.coffee:1:completion
completion
# Miscellaneous code fragments reside here. Utils = # Detect and return the language that a given file is written in. # # The language is also annotated with a name property, matching the laguages key in LANGUAGES. getLanguage: (filePath) -> unless @_languageDetectionCache? @_languageDetectionCache = ...
# Map a list of file paths to relative target paths by stripping prefixes off of them. mapFiles: (files, stripPrefixes) -> # Prefixes are stripped in order of most specific to least (# of directories deep) prefixes = stripPrefixes.sort (a,b) => @pathDepth(b) - @pathDepth(a) result = {} for absPath i...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
1
39
nevir/groc:lib/utils.coffee:2:raw_corpus
raw_corpus
# How many directories deep is a given path? pathDepth: (path) -> path.split(/[\/\\]/).length # Split source code into segments (comment + code pairs) splitSource: (data, language) -> lines = data.split /\r?\n/ # Always strip shebangs - but don't shift it off the array to avoid the perf hit of walki...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
41
79
nevir/groc:lib/utils.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript # How many directories deep is a given path? pathDepth: (path) -> path.split(/[\/\\]/).length # Split source code into segments (comment + code pairs) splitSource: (data, language) -> lines = data.split /\r?\n/ # Always strip shebangs - but do...
// How many directories deep is a given path? var Segment; ({ pathDepth: function(path) { return path.split(/[\/\\]/).length; }, // Split source code into segments (comment + code pairs) splitSource: function(data, language) { var currSegment, i, len, line, lines, match, segments, singleLineMatcher; ...
CoffeeScript
JavaScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
41
79
nevir/groc:lib/utils.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript // How many directories deep is a given path? var Segment; ({ pathDepth: function(path) { return path.split(/[\/\\]/).length; }, // Split source code into segments (comment + code pairs) splitSource: function(data, language) { var currSegment, i, l...
# How many directories deep is a given path? pathDepth: (path) -> path.split(/[\/\\]/).length # Split source code into segments (comment + code pairs) splitSource: (data, language) -> lines = data.split /\r?\n/ # Always strip shebangs - but don't shift it off the array to avoid the perf hit of walki...
JavaScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
41
79
nevir/groc:lib/utils.coffee:2:completion
completion
# How many directories deep is a given path? pathDepth: (path) -> path.split(/[\/\\]/).length # Split source code into segments (comment + code pairs) splitSource: (data, language) -> lines = data.split /\r?\n/ # Always strip shebangs - but don't shift it off the array to avoid the perf hit of walki...
singleLineMatcher = ///^\s*(#{language.singleLineComment.join('|')})\s?(.*)$/// for line in lines if match = line.match singleLineMatcher if currSegment.code.length > 0 segments.push currSegment currSegment = new @Segment currSegment.comments.push match[2] else ...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
41
79
nevir/groc:lib/utils.coffee:3:raw_corpus
raw_corpus
# Annotate an array of segments by running their code through [Pygments](http://pygments.org/). highlightCode: (segments, language, callback) -> # Don't bother spawning pygments if we have nothing to highlight numCodeLines = segments.reduce ( (c,s) -> c + s.code.length ), 0 if numCodeLines == 0 for ...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
81
121
nevir/groc:lib/utils.coffee:3:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript # Annotate an array of segments by running their code through [Pygments](http://pygments.org/). highlightCode: (segments, language, callback) -> # Don't bother spawning pygments if we have nothing to highlight numCodeLines = segments.reduce ( (c,s) -> c...
// Annotate an array of segments by running their code through [Pygments](http://pygments.org/). ({ highlightCode: function(segments, language, callback) { var i, len, numCodeLines, pygmentize, result, segment, segmentDivider; // Don't bother spawning pygments if we have nothing to highlight numCodeLines ...
CoffeeScript
JavaScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
81
121
nevir/groc:lib/utils.coffee:3:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript // Annotate an array of segments by running their code through [Pygments](http://pygments.org/). ({ highlightCode: function(segments, language, callback) { var i, len, numCodeLines, pygmentize, result, segment, segmentDivider; // Don't bother spawning pyg...
# Annotate an array of segments by running their code through [Pygments](http://pygments.org/). highlightCode: (segments, language, callback) -> # Don't bother spawning pygments if we have nothing to highlight numCodeLines = segments.reduce ( (c,s) -> c + s.code.length ), 0 if numCodeLines == 0 for ...
JavaScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
81
121
nevir/groc:lib/utils.coffee:3:completion
completion
# Annotate an array of segments by running their code through [Pygments](http://pygments.org/). highlightCode: (segments, language, callback) -> # Don't bother spawning pygments if we have nothing to highlight numCodeLines = segments.reduce ( (c,s) -> c + s.code.length ), 0 if numCodeLines == 0 for ...
result = '' pygmentize.stdout.addListener 'data', (data) => result += data.toString() # Rather than spawning pygments for each segment, we stream it all in, separated by 'magic' # comments so that we can split the highlighted source back into segments. segmentDivider = "\n#{language.singleLineCom...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
81
121
nevir/groc:lib/utils.coffee:4:raw_corpus
raw_corpus
# Attach highlighted source to the highlightedCode property of a Segment. for segment, i in segments segment.highlightedCode = highlighted[i] callback() # pygmentize does not stream, so we need delimeters pygmentize.stdin.write (s.code.join "\n" for s in segments).join segmentDivider p...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
123
161
nevir/groc:lib/utils.coffee:4:completion
completion
# Attach highlighted source to the highlightedCode property of a Segment. for segment, i in segments segment.highlightedCode = highlighted[i] callback() # pygmentize does not stream, so we need delimeters pygmentize.stdin.write (s.code.join "\n" for s in segments).join segmentDivider p...
# showdown generates header ids by lowercasing & dropping non-word characters. We'd like # something a bit more readable. markdown = @gsub markdown, /<h(\d) id="[^"]+">([^<]+)<\/h\d>/g, (match) => header = level: parseInt match[1] title: match[2] slug: @sl...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
123
161
nevir/groc:lib/utils.coffee:5:raw_corpus
raw_corpus
callback() # Given an array of markdowned segments, convert their list of headers into a hierarchical # outline (table of contents!) outlineHeaders: (segments) -> headers = segments.reduce ( (a, s) -> a.concat s.headers ), [] return [] unless headers.length > 0 result = [] stack = [] for h...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
163
201
nevir/groc:lib/utils.coffee:5:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript callback() # Given an array of markdowned segments, convert their list of headers into a hierarchical # outline (table of contents!) outlineHeaders: (segments) -> headers = segments.reduce ( (a, s) -> a.concat s.headers ), [] return [] unless heade...
callback()({ // Given an array of markdowned segments, convert their list of headers into a hierarchical // outline (table of contents!) outlineHeaders: function(segments) { var header, headers, i, len, node, ref, result, stack; headers = segments.reduce((function(a, s) { return a.concat(s.headers);...
CoffeeScript
JavaScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
163
201
nevir/groc:lib/utils.coffee:5:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript callback()({ // Given an array of markdowned segments, convert their list of headers into a hierarchical // outline (table of contents!) outlineHeaders: function(segments) { var header, headers, i, len, node, ref, result, stack; headers = segments.red...
callback() # Given an array of markdowned segments, convert their list of headers into a hierarchical # outline (table of contents!) outlineHeaders: (segments) -> headers = segments.reduce ( (a, s) -> a.concat s.headers ), [] return [] unless headers.length > 0 result = [] stack = [] for h...
JavaScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
163
201
nevir/groc:lib/utils.coffee:5:completion
completion
callback() # Given an array of markdowned segments, convert their list of headers into a hierarchical # outline (table of contents!) outlineHeaders: (segments) -> headers = segments.reduce ( (a, s) -> a.concat s.headers ), [] return [] unless headers.length > 0 result = [] stack = [] for h...
if stack.length == 0 result.push node else stack.slice(-1)[0].children.push node stack.push node result # Sometimes you just don't want any of them hanging around. trimBlankLines: (string) -> string.replace(/^[\r\n]+/, '').replace(/[\r\n]+$/, '') # Given a title, convert it...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
163
201
nevir/groc:lib/utils.coffee:6:raw_corpus
raw_corpus
result = '' matcher.lastIndex = 0 furthestIndex = 0 while (match = matcher.exec string) != null result += string[furthestIndex...match.index] + replacer match furthestIndex = matcher.lastIndex result + string[furthestIndex...]
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
203
212
nevir/groc:lib/utils.coffee:6:completion
completion
result = '' matcher.lastIndex = 0 furthestIndex = 0 while (match = matcher.exec string) != null
result += string[furthestIndex...match.index] + replacer match furthestIndex = matcher.lastIndex result + string[furthestIndex...]
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
c09080fb2ed0244eb591c25327eaf49600f84ffc
579
https://github.com/nevir/groc/blob/c09080fb2ed0244eb591c25327eaf49600f84ffc/lib/utils.coffee
203
212
nevir/groc:lib/utils.coffee:2:raw_corpus
raw_corpus
# How many directories deep is a given path? pathDepth: (path) -> path.split(/[\/\\]/).length # Split source code into segments (comment + code pairs) splitSource: (data, language) -> lines = data.split /\r?\n/ # Always strip shebangs - but don't shift it off the array to avoid the perf hit of walki...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9c20a6e2c073c00bb72028f0ac47728353ffd47a
579
https://github.com/nevir/groc/blob/9c20a6e2c073c00bb72028f0ac47728353ffd47a/lib/utils.coffee
41
86
nevir/groc:lib/utils.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript # How many directories deep is a given path? pathDepth: (path) -> path.split(/[\/\\]/).length # Split source code into segments (comment + code pairs) splitSource: (data, language) -> lines = data.split /\r?\n/ # Always strip shebangs - but do...
// How many directories deep is a given path? var Segment; ({ pathDepth: function(path) { return path.split(/[\/\\]/).length; }, // Split source code into segments (comment + code pairs) splitSource: function(data, language) { var currSegment, i, len, line, lines, match, segments, singleLineMatcher; ...
CoffeeScript
JavaScript
nevir/groc
lib/utils.coffee
MIT
9c20a6e2c073c00bb72028f0ac47728353ffd47a
579
https://github.com/nevir/groc/blob/9c20a6e2c073c00bb72028f0ac47728353ffd47a/lib/utils.coffee
41
86
nevir/groc:lib/utils.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript // How many directories deep is a given path? var Segment; ({ pathDepth: function(path) { return path.split(/[\/\\]/).length; }, // Split source code into segments (comment + code pairs) splitSource: function(data, language) { var currSegment, i, l...
# How many directories deep is a given path? pathDepth: (path) -> path.split(/[\/\\]/).length # Split source code into segments (comment + code pairs) splitSource: (data, language) -> lines = data.split /\r?\n/ # Always strip shebangs - but don't shift it off the array to avoid the perf hit of walki...
JavaScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9c20a6e2c073c00bb72028f0ac47728353ffd47a
579
https://github.com/nevir/groc/blob/9c20a6e2c073c00bb72028f0ac47728353ffd47a/lib/utils.coffee
41
86
nevir/groc:lib/utils.coffee:2:completion
completion
# How many directories deep is a given path? pathDepth: (path) -> path.split(/[\/\\]/).length # Split source code into segments (comment + code pairs) splitSource: (data, language) -> lines = data.split /\r?\n/ # Always strip shebangs - but don't shift it off the array to avoid the perf hit of walki...
currSegment.comments.push match[2] else currSegment.code.push line segments.push currSegment segments # Just a convenient prototype for building segments Segment: class Segment constructor: (code=[], comments=[]) -> @code = code @comments = comments # Annotate an array...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9c20a6e2c073c00bb72028f0ac47728353ffd47a
579
https://github.com/nevir/groc/blob/9c20a6e2c073c00bb72028f0ac47728353ffd47a/lib/utils.coffee
41
86
nevir/groc:lib/utils.coffee:3:raw_corpus
raw_corpus
# We'll just split the output at the end. pygmentize doesn't stream its output, and a given # source file is small enough that it shouldn't matter. result = '' pygmentize.stdout.addListener 'data', (data) => result += data.toString() # Rather than spawning pygments for each segment, we stream it...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9c20a6e2c073c00bb72028f0ac47728353ffd47a
579
https://github.com/nevir/groc/blob/9c20a6e2c073c00bb72028f0ac47728353ffd47a/lib/utils.coffee
88
130
nevir/groc:lib/utils.coffee:3:completion
completion
# We'll just split the output at the end. pygmentize doesn't stream its output, and a given # source file is small enough that it shouldn't matter. result = '' pygmentize.stdout.addListener 'data', (data) => result += data.toString() # Rather than spawning pygments for each segment, we stream it...
error.pygmentsOutput = result return callback error # Attach highlighted source to the highlightedCode property of a Segment. for segment, i in segments segment.highlightedCode = highlighted[i] callback() # pygmentize does not stream, so we need delimeters pygmentize.stdin.w...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9c20a6e2c073c00bb72028f0ac47728353ffd47a
579
https://github.com/nevir/groc/blob/9c20a6e2c073c00bb72028f0ac47728353ffd47a/lib/utils.coffee
88
130
nevir/groc:lib/utils.coffee:4:raw_corpus
raw_corpus
# showdown generates header ids by lowercasing & dropping non-word characters. We'd like # something a bit more readable. markdown = @gsub markdown, /<h(\d) id="[^"]+">([^<]+)<\/h\d>/g, (match) => header = level: parseInt match[1] title: match[2] slug: @sl...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9c20a6e2c073c00bb72028f0ac47728353ffd47a
579
https://github.com/nevir/groc/blob/9c20a6e2c073c00bb72028f0ac47728353ffd47a/lib/utils.coffee
132
174
nevir/groc:lib/utils.coffee:4:completion
completion
# showdown generates header ids by lowercasing & dropping non-word characters. We'd like # something a bit more readable. markdown = @gsub markdown, /<h(\d) id="[^"]+">([^<]+)<\/h\d>/g, (match) => header = level: parseInt match[1] title: match[2] slug: @sl...
# Given an array of markdowned segments, convert their list of headers into a hierarchical # outline (table of contents!) outlineHeaders: (segments) -> headers = segments.reduce ( (a, s) -> a.concat s.headers ), [] return [] unless headers.length > 0 result = [] stack = [] for header in heade...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9c20a6e2c073c00bb72028f0ac47728353ffd47a
579
https://github.com/nevir/groc/blob/9c20a6e2c073c00bb72028f0ac47728353ffd47a/lib/utils.coffee
132
174
nevir/groc:lib/utils.coffee:5:raw_corpus
raw_corpus
stack.push node result # Sometimes you just don't want any of them hanging around. trimBlankLines: (string) -> string.replace(/^[\r\n]+/, '').replace(/[\r\n]+$/, '') # Given a title, convert it into a URL-friendly slug. slugifyTitle: (string) -> string.split(/\s+/).map( (s) -> s.replace(/[^\w]/g,...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9c20a6e2c073c00bb72028f0ac47728353ffd47a
579
https://github.com/nevir/groc/blob/9c20a6e2c073c00bb72028f0ac47728353ffd47a/lib/utils.coffee
176
201
nevir/groc:lib/utils.coffee:5:completion
completion
stack.push node result # Sometimes you just don't want any of them hanging around. trimBlankLines: (string) -> string.replace(/^[\r\n]+/, '').replace(/[\r\n]+$/, '') # Given a title, convert it into a URL-friendly slug. slugifyTitle: (string) -> string.split(/\s+/).map( (s) -> s.replace(/[^\w]/g,...
gsub: (string, matcher, replacer) -> throw new Error 'You must pass a global RegExp to gsub!' unless matcher.global? result = '' matcher.lastIndex = 0 furthestIndex = 0 while (match = matcher.exec string) != null result += string[furthestIndex...match.index] + replacer match furthestI...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
9c20a6e2c073c00bb72028f0ac47728353ffd47a
579
https://github.com/nevir/groc/blob/9c20a6e2c073c00bb72028f0ac47728353ffd47a/lib/utils.coffee
176
201
nevir/groc:lib/utils.coffee:1:raw_corpus
raw_corpus
# Miscellaneous code fragments reside here. Utils = # Map a list of file paths to relative target paths by stripping prefixes off of them. mapFiles: (files, stripPrefixes) -> # Prefixes are stripped in order of most specific to least (# of directories deep) prefixes = stripPrefixes.sort (a,b) => @pathDepth(...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
291b1ecf56d55b5aa565e08645b67e5e1a3d4d73
579
https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/utils.coffee
1
39
nevir/groc:lib/utils.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript # Miscellaneous code fragments reside here. Utils = # Map a list of file paths to relative target paths by stripping prefixes off of them. mapFiles: (files, stripPrefixes) -> # Prefixes are stripped in order of most specific to least (# of directories dee...
// Miscellaneous code fragments reside here. var Utils; Utils = { // Map a list of file paths to relative target paths by stripping prefixes off of them. mapFiles: function(files, stripPrefixes) { var absPath, file, i, j, len, len1, prefixes, result, stripPath; // Prefixes are stripped in order of most spe...
CoffeeScript
JavaScript
nevir/groc
lib/utils.coffee
MIT
291b1ecf56d55b5aa565e08645b67e5e1a3d4d73
579
https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/utils.coffee
1
39
nevir/groc:lib/utils.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript // Miscellaneous code fragments reside here. var Utils; Utils = { // Map a list of file paths to relative target paths by stripping prefixes off of them. mapFiles: function(files, stripPrefixes) { var absPath, file, i, j, len, len1, prefixes, result, strip...
# Miscellaneous code fragments reside here. Utils = # Map a list of file paths to relative target paths by stripping prefixes off of them. mapFiles: (files, stripPrefixes) -> # Prefixes are stripped in order of most specific to least (# of directories deep) prefixes = stripPrefixes.sort (a,b) => @pathDepth(...
JavaScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
291b1ecf56d55b5aa565e08645b67e5e1a3d4d73
579
https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/utils.coffee
1
39
nevir/groc:lib/utils.coffee:1:completion
completion
# Miscellaneous code fragments reside here. Utils = # Map a list of file paths to relative target paths by stripping prefixes off of them. mapFiles: (files, stripPrefixes) -> # Prefixes are stripped in order of most specific to least (# of directories deep) prefixes = stripPrefixes.sort (a,b) => @pathDepth(...
result # How many directories deep is a given path? pathDepth: (path) -> path.split(/[\/\\]/).length # Split source code into segments (comment + code pairs) splitSource: (data, language) -> lines = data.split /\r?\n/ # Always strip shebangs - but don't shift it off the array to avoid the perf hi...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
291b1ecf56d55b5aa565e08645b67e5e1a3d4d73
579
https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/utils.coffee
1
39
nevir/groc:lib/utils.coffee:2:raw_corpus
raw_corpus
for line in lines if match = line.match singleLineMatcher if currSegment.code.length > 0 segments.push currSegment currSegment = new @Segment currSegment.comments.push match[2] else currSegment.code.push line segments.push currSegment segments # Just ...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
291b1ecf56d55b5aa565e08645b67e5e1a3d4d73
579
https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/utils.coffee
41
85
nevir/groc:lib/utils.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript for line in lines if match = line.match singleLineMatcher if currSegment.code.length > 0 segments.push currSegment currSegment = new @Segment currSegment.comments.push match[2] else currSegment.code.push li...
var Segment, currSegment, i, len, line, match; for (i = 0, len = lines.length; i < len; i++) { line = lines[i]; if (match = line.match(singleLineMatcher)) { if (currSegment.code.length > 0) { segments.push(currSegment); currSegment = new this.Segment(); } currSegment.comments.push(match[2])...
CoffeeScript
JavaScript
nevir/groc
lib/utils.coffee
MIT
291b1ecf56d55b5aa565e08645b67e5e1a3d4d73
579
https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/utils.coffee
41
85
nevir/groc:lib/utils.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Segment, currSegment, i, len, line, match; for (i = 0, len = lines.length; i < len; i++) { line = lines[i]; if (match = line.match(singleLineMatcher)) { if (currSegment.code.length > 0) { segments.push(currSegment); currSegment = new this.S...
for line in lines if match = line.match singleLineMatcher if currSegment.code.length > 0 segments.push currSegment currSegment = new @Segment currSegment.comments.push match[2] else currSegment.code.push line segments.push currSegment segments # Just ...
JavaScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
291b1ecf56d55b5aa565e08645b67e5e1a3d4d73
579
https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/utils.coffee
41
85
nevir/groc:lib/utils.coffee:2:completion
completion
for line in lines if match = line.match singleLineMatcher if currSegment.code.length > 0 segments.push currSegment currSegment = new @Segment currSegment.comments.push match[2] else currSegment.code.push line segments.push currSegment segments # Just ...
'-l', language.pygmentsLexer '-f', 'html' '-O', 'encoding=utf-8,tabsize=2' ] pygmentize.stderr.addListener 'data', (data) -> callback data.toString() pygmentize.stdin.addListener 'error', (error) -> callback error # We'll just split the output at the end. pygmentize doesn't stream its out...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
291b1ecf56d55b5aa565e08645b67e5e1a3d4d73
579
https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/utils.coffee
41
85
nevir/groc:lib/utils.coffee:3:raw_corpus
raw_corpus
if highlighted.length != segments.length error = new Error util.format 'pygmentize rendered %d of %d segments; expected to be equal', highlighted.length, segments.length error.pygmentsOutput = result return callback error # Attach highlighted source to the highlightedCode prope...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
291b1ecf56d55b5aa565e08645b67e5e1a3d4d73
579
https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/utils.coffee
87
129
nevir/groc:lib/utils.coffee:3:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript if highlighted.length != segments.length error = new Error util.format 'pygmentize rendered %d of %d segments; expected to be equal', highlighted.length, segments.length error.pygmentsOutput = result return callback error ...
var error, i, j, len, s, segment; if (highlighted.length !== segments.length) { error = new Error(util.format('pygmentize rendered %d of %d segments; expected to be equal', highlighted.length, segments.length)); error.pygmentsOutput = result; return callback(error); } // Attach highlighted source to the highlig...
CoffeeScript
JavaScript
nevir/groc
lib/utils.coffee
MIT
291b1ecf56d55b5aa565e08645b67e5e1a3d4d73
579
https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/utils.coffee
87
129
nevir/groc:lib/utils.coffee:3:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var error, i, j, len, s, segment; if (highlighted.length !== segments.length) { error = new Error(util.format('pygmentize rendered %d of %d segments; expected to be equal', highlighted.length, segments.length)); error.pygmentsOutput = result; return callback...
if highlighted.length != segments.length error = new Error util.format 'pygmentize rendered %d of %d segments; expected to be equal', highlighted.length, segments.length error.pygmentsOutput = result return callback error # Attach highlighted source to the highlightedCode prope...
JavaScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
291b1ecf56d55b5aa565e08645b67e5e1a3d4d73
579
https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/utils.coffee
87
129
nevir/groc:lib/utils.coffee:3:completion
completion
if highlighted.length != segments.length error = new Error util.format 'pygmentize rendered %d of %d segments; expected to be equal', highlighted.length, segments.length error.pygmentsOutput = result return callback error # Attach highlighted source to the highlightedCode prope...
try for segment in segments markdown = converter.makeHtml segment.comments.join '\n' headers = [] # showdown generates header ids by lowercasing & dropping non-word characters. We'd like # something a bit more readable. markdown = @gsub markdown, /<h(\d) id="[^"]+">([^<]...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
291b1ecf56d55b5aa565e08645b67e5e1a3d4d73
579
https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/utils.coffee
87
129
nevir/groc:lib/utils.coffee:4:raw_corpus
raw_corpus
catch error return callback error callback() # Given an array of markdowned segments, convert their list of headers into a hierarchical # outline (table of contents!) outlineHeaders: (segments) -> headers = segments.reduce ( (a, s) -> a.concat s.headers ), [] return [] unless headers.length > ...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
291b1ecf56d55b5aa565e08645b67e5e1a3d4d73
579
https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/utils.coffee
131
172
nevir/groc:lib/utils.coffee:4:completion
completion
catch error return callback error callback() # Given an array of markdowned segments, convert their list of headers into a hierarchical # outline (table of contents!) outlineHeaders: (segments) -> headers = segments.reduce ( (a, s) -> a.concat s.headers ), [] return [] unless headers.length > ...
# Are we starting a new top level node? if stack.length == 0 result.push node else stack.slice(-1)[0].children.push node stack.push node result # Sometimes you just don't want any of them hanging around. trimBlankLines: (string) -> string.replace(/^[\r\n]+/, '').replace(...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
291b1ecf56d55b5aa565e08645b67e5e1a3d4d73
579
https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/utils.coffee
131
172
nevir/groc:lib/utils.coffee:2:raw_corpus
raw_corpus
for line in lines if match = line.match singleLineMatcher if currSegment.code.length > 0 segments.push currSegment currSegment = new @Segment currSegment.comments.push match[2] else currSegment.code.push line segments.push currSegment segments # Just ...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
540691821a2107c3cbd7e8368be08c154126d9a3
579
https://github.com/nevir/groc/blob/540691821a2107c3cbd7e8368be08c154126d9a3/lib/utils.coffee
41
85
nevir/groc:lib/utils.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript for line in lines if match = line.match singleLineMatcher if currSegment.code.length > 0 segments.push currSegment currSegment = new @Segment currSegment.comments.push match[2] else currSegment.code.push li...
var Segment, currSegment, i, len, line, match; for (i = 0, len = lines.length; i < len; i++) { line = lines[i]; if (match = line.match(singleLineMatcher)) { if (currSegment.code.length > 0) { segments.push(currSegment); currSegment = new this.Segment(); } currSegment.comments.push(match[2])...
CoffeeScript
JavaScript
nevir/groc
lib/utils.coffee
MIT
540691821a2107c3cbd7e8368be08c154126d9a3
579
https://github.com/nevir/groc/blob/540691821a2107c3cbd7e8368be08c154126d9a3/lib/utils.coffee
41
85
nevir/groc:lib/utils.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Segment, currSegment, i, len, line, match; for (i = 0, len = lines.length; i < len; i++) { line = lines[i]; if (match = line.match(singleLineMatcher)) { if (currSegment.code.length > 0) { segments.push(currSegment); currSegment = new this.S...
for line in lines if match = line.match singleLineMatcher if currSegment.code.length > 0 segments.push currSegment currSegment = new @Segment currSegment.comments.push match[2] else currSegment.code.push line segments.push currSegment segments # Just ...
JavaScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
540691821a2107c3cbd7e8368be08c154126d9a3
579
https://github.com/nevir/groc/blob/540691821a2107c3cbd7e8368be08c154126d9a3/lib/utils.coffee
41
85
nevir/groc:lib/utils.coffee:2:completion
completion
for line in lines if match = line.match singleLineMatcher if currSegment.code.length > 0 segments.push currSegment currSegment = new @Segment currSegment.comments.push match[2] else currSegment.code.push line segments.push currSegment segments # Just ...
'-l', language.pygmentsLexer '-f', 'html' '-O', 'encoding=utf-8,tabsize=2' ] pygmentize.stderr.addListener 'data', (error) -> callback error if error pygmentize.stdin.addListener 'error', (error) -> callback error if error # We'll just split the output at the end. pygmentize doesn't stream...
CoffeeScript
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
540691821a2107c3cbd7e8368be08c154126d9a3
579
https://github.com/nevir/groc/blob/540691821a2107c3cbd7e8368be08c154126d9a3/lib/utils.coffee
41
85
nevir/groc:lib/utils.coffee:3:raw_corpus
raw_corpus
if highlighted.length != segments.length error = new Error util.format 'pygmentize rendered %d of %d segments; expected to be equal', highlighted.length, segments.length error.pygmentsOutput = result return callback error # Attach highlighted source to the highlightedCode prope...
CoffeeScript
nevir/groc
lib/utils.coffee
MIT
bf64e810e5b468936ccf8e3dc7ddd9f9955b7bd8
579
https://github.com/nevir/groc/blob/bf64e810e5b468936ccf8e3dc7ddd9f9955b7bd8/lib/utils.coffee
87
120
nevir/groc:lib/utils.coffee:3:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript if highlighted.length != segments.length error = new Error util.format 'pygmentize rendered %d of %d segments; expected to be equal', highlighted.length, segments.length error.pygmentsOutput = result return callback error ...
var error, i, j, len, s, segment; if (highlighted.length !== segments.length) { error = new Error(util.format('pygmentize rendered %d of %d segments; expected to be equal', highlighted.length, segments.length)); error.pygmentsOutput = result; return callback(error); } // Attach highlighted source to the highlig...
CoffeeScript
JavaScript
nevir/groc
lib/utils.coffee
MIT
bf64e810e5b468936ccf8e3dc7ddd9f9955b7bd8
579
https://github.com/nevir/groc/blob/bf64e810e5b468936ccf8e3dc7ddd9f9955b7bd8/lib/utils.coffee
87
120